Jump to content

Relative Position in GUI


harryh

Recommended Posts

How can I save these as a relative size to the screen resoultion to prevent problems.

 


    DogCreate.BuyButton = guiCreateButton(0.84, 0.34, 0.15, 0.05, "Purchase Dog", true)


	DogCreate.NameBox = guiCreateEdit(0.87, 0.23, 0.11, 0.03, "", true)

	DogCreate.MaleRadio = guiCreateRadioButton(0.89, 0.32, 0.01, 0.01, "", true)

	DogCreate.FemaleRadio = guiCreateRadioButton(0.96, 0.32, 0.01, 0.01, "", true)
	guiRadioButtonSetSelected(DogCreate.FemaleRadio, true)

	DogCreate.BreedBox = guiCreateComboBox(0.87, 0.27, 0.11, 0.03, "", true)

 

Link to comment
  • Moderators

You are already using relative positions and sizes. What's the current problem you are facing ? (Maybe adding screenshots of the current problem and what it should look like would help us to see what you are trying to fix).

Link to comment

I thought they were relative.

Here the other part of code


function DogCreateText()
	if createDogMenuOpen then
        dxDrawLine((screenW * 0.8276) - 1, (screenH * 0.2185) - 1, (screenW * 0.8276) - 1, screenH * 0.4093, tocolor(251, 5, 11, 255), 1, false)
        dxDrawLine(screenW * 0.9901, (screenH * 0.2185) - 1, (screenW * 0.8276) - 1, (screenH * 0.2185) - 1, tocolor(251, 5, 11, 255), 1, false)
        dxDrawLine((screenW * 0.8276) - 1, screenH * 0.4093, screenW * 0.9901, screenH * 0.4093, tocolor(251, 5, 11, 255), 1, false)
        dxDrawLine(screenW * 0.9901, screenH * 0.4093, screenW * 0.9901, (screenH * 0.2185) - 1, tocolor(251, 5, 11, 255), 1, false)
        dxDrawRectangle(screenW * 0.8276, screenH * 0.2185, screenW * 0.1625, screenH * 0.1907, tocolor(34, 27, 48, 255), false)
        dxDrawText("Name:", screenW * 0.8328, screenH * 0.2333, screenW * 0.8698, screenH * 0.2602, tocolor(255, 255, 255, 255), 1.00, "pricedown", "left", "top", false, false, false, false, false)
        dxDrawText("Breed:", screenW * 0.8328, screenH * 0.2694, screenW * 0.8698, screenH * 0.2963, tocolor(255, 255, 255, 255), 1.00, "pricedown", "left", "top", false, false, false, false, false)
        dxDrawText("Gender:", screenW * 0.8328, screenH * 0.3056, screenW * 0.8698, screenH * 0.3324, tocolor(255, 255, 255, 255), 1.00, "pricedown", "left", "top", false, false, false, false, false)
        --dxDrawText("", 1723, 330, 1723, 330, tocolor(255, 255, 255, 255), 1.00, "default", "left", "top", false, false, false, false, false)
        dxDrawText("F", screenW * 0.9500, screenH * 0.3185, screenW * 0.9552, screenH * 0.3324, tocolor(255, 255, 255, 255), 1.00, "default-bold", "left", "top", false, false, false, false, false)
        dxDrawText("M", screenW * 0.8870, screenH * 0.3185, screenW * 0.8922, screenH * 0.3324, tocolor(255, 255, 255, 255), 1.00, "default-bold", "left", "top", false, false, false, false, false)
	end
end
addEventHandler("onClientRender", getResourceRootElement(), DogCreateText)

Here is a print screen:

de962604290740ea8d4307418b3ae7ce.png

 

Link to comment

i talking about this:

        GUIEditor.window[1] = guiCreateWindow(0.33, 0.35, 0.22, 0.24, "", true) --Relative
        guiWindowSetSizable(GUIEditor.window[1], false)

        GUIEditor.button[1] = guiCreateButton(24, 185, 99, 40, "", false, GUIEditor.window[1]) --Absolute
        GUIEditor.button[2] = guiCreateButton(294, 185, 99, 40, "", false, GUIEditor.window[1])  --Absolute

 

tihs work 100%

Edited by TheMOG
  • Like 1
Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...