Jump to content

[solved] whats wrong with this gui window?


dzek (varez)

Recommended Posts

Im starting to have fun with GUI windows,

but i cant understand some strange behaviours..

why with this:

missionSelectWindow1 = {}
	missionSelectWindow1 = guiCreateWindow(0.35,0.15,0.3162,0.5717,"Mission Test",true)
	guiWindowSetSizable(missionSelectWindow1,false)
	missionSelect_Place_Button1 = guiCreateButton(0.08,0.20,0.84,0.1,"NO",true,missionSelectWindow1)
	missionSelect_Place_Button2 = guiCreateButton(0.08,0.35,0.84,0.1,"NO",true,missionSelectWindow1)
	missionSelect_Place_Button3 = guiCreateButton(0.08,0.50,0.84,0.1,"YES2",true,missionSelectWindow1)
	missionSelect_Place_Button4 = guiCreateButton(0.08,0.65,0.84,0.1,"NO2",true,missionSelectWindow1)
	missionSelect_Exit_Button1  = guiCreateButton(0.08,0.90,0.84,0.1,"EXIT",true,missionSelectWindow1)
	missionSelect_Label1 = guiCreateLabel(0.17,0.1,0.668,0.2233,"Select place and prize",true,missionSelectWindow1)
	guiLabelSetVerticalAlign(missionSelect_Label1,"top")
	guiLabelSetHorizontalAlign(missionSelect_Label1,"center",false)
	--guiSetVisible (missionSelectWindow1, false)

first button is unclickable (it will call an event when i click somewhere in the label..) but its positioned where it should be .. :?:

and one more thing, as i dont want to create next topic:

is there any way to destroy button? i want text on buttons to be dynamic, so..

i dont see any functions to destroy gui windows,labels,buttons...

Edited by Guest
Link to comment

Im starting to have fun with GUI windows,

but i cant understand some strange behaviours..

why with this:

missionSelectWindow1 = {}		missionSelectWindow1 = guiCreateWindow(0.35,0.15,0.3162,0.5717,"Mission Test",true)		guiWindowSetSizable(missionSelectWindow1,false)		missionSelect_Place_Button1 = guiCreateButton(0.08,0.20,0.84,0.1,"NO",true,missionSelectWindow1)		missionSelect_Place_Button2 = guiCreateButton(0.08,0.35,0.84,0.1,"NO",true,missionSelectWindow1)		missionSelect_Place_Button3 = guiCreateButton(0.08,0.50,0.84,0.1,"YES2",true,missionSelectWindow1)		missionSelect_Place_Button4 = guiCreateButton(0.08,0.65,0.84,0.1,"NO2",true,missionSelectWindow1)		missionSelect_Exit_Button1  = guiCreateButton(0.08,0.90,0.84,0.1,"EXIT",true,missionSelectWindow1)		missionSelect_Label1 = guiCreateLabel(0.17,0.1,0.668,0.2233,"Select place and prize",true,missionSelectWindow1)		guiLabelSetVerticalAlign(missionSelect_Label1,"top")		guiLabelSetHorizontalAlign(missionSelect_Label1,"center",false)		--guiSetVisible (missionSelectWindow1, false)

first button is unclickable (it will call an event when i click somewhere in the label..) but its positioned where it should be .. :?:

and one more thing, as i dont want to create next topic:

is there any way to destroy button? i want text on buttons to be dynamic, so..

i dont see any functions to destroy gui windows,labels,buttons...

Edited by Guest
Link to comment

ah!

thanks for all the info,

but this still confuses me, as

when i click anywhere NOT on a button but inside gui window it fires events for all buttons :/

missionSelectWindow1 = {}
	missionSelectWindow1 = guiCreateWindow(0.35,0.15,0.3162,0.5717,"test",true)
	guiWindowSetSizable(missionSelectWindow1,false)
	missionSelect_Place_Button1 = guiCreateButton(0.08,0.20,0.84,0.1,"NO",true,missionSelectWindow1)
	missionSelect_Place_Button2 = guiCreateButton(0.08,0.35,0.84,0.1,"NO",true,missionSelectWindow1)
	missionSelect_Place_Button3 = guiCreateButton(0.08,0.50,0.84,0.1,"YES2",true,missionSelectWindow1)
	missionSelect_Place_Button4 = guiCreateButton(0.08,0.65,0.84,0.1,"NO2",true,missionSelectWindow1)
	missionSelect_Exit_Button1  = guiCreateButton(0.08,0.90,0.84,0.1,"EXIT",true,missionSelectWindow1)
	missionSelect_Label1 = guiCreateLabel(0.08,0.1,0.84,0.1,"Select place and prize",true,missionSelectWindow1)
	guiLabelSetVerticalAlign(missionSelect_Label1,"top")
	guiLabelSetHorizontalAlign(missionSelect_Label1,"center",false)
	guiSetVisible (missionSelectWindow1, false)
	addEventHandler ("onClientGUIClick", missionSelect_Place_Button1, missionStart)
	addEventHandler ("onClientGUIClick", missionSelect_Place_Button2, missionStart)
	addEventHandler ("onClientGUIClick", missionSelect_Exit_Button1, guiCancel)

edit:

i did

setElementData(missionSelect_Place_Button1,"number",'1')

for every button

and then

function missionStart(whichMouse, state, absoluteX, absoluteY)
local number = getElementData(source,"number")
outputChatBox(number)
end

gives me nothing if i click not on the button..

so it fires so much events it found, but without a source?..

this will be probably something really stupid, im feeling it

Link to comment

ah!

thanks for all the info,

but this still confuses me, as

when i click anywhere NOT on a button but inside gui window it fires events for all buttons :/

missionSelectWindow1 = {}		missionSelectWindow1 = guiCreateWindow(0.35,0.15,0.3162,0.5717,"test",true)		guiWindowSetSizable(missionSelectWindow1,false)		missionSelect_Place_Button1 = guiCreateButton(0.08,0.20,0.84,0.1,"NO",true,missionSelectWindow1)		missionSelect_Place_Button2 = guiCreateButton(0.08,0.35,0.84,0.1,"NO",true,missionSelectWindow1)		missionSelect_Place_Button3 = guiCreateButton(0.08,0.50,0.84,0.1,"YES2",true,missionSelectWindow1)		missionSelect_Place_Button4 = guiCreateButton(0.08,0.65,0.84,0.1,"NO2",true,missionSelectWindow1)		missionSelect_Exit_Button1  = guiCreateButton(0.08,0.90,0.84,0.1,"EXIT",true,missionSelectWindow1)		missionSelect_Label1 = guiCreateLabel(0.08,0.1,0.84,0.1,"Select place and prize",true,missionSelectWindow1)		guiLabelSetVerticalAlign(missionSelect_Label1,"top")		guiLabelSetHorizontalAlign(missionSelect_Label1,"center",false)		guiSetVisible (missionSelectWindow1, false)		addEventHandler ("onClientGUIClick", missionSelect_Place_Button1, missionStart)		addEventHandler ("onClientGUIClick", missionSelect_Place_Button2, missionStart)		addEventHandler ("onClientGUIClick", missionSelect_Exit_Button1, guiCancel)

edit:

i did

setElementData(missionSelect_Place_Button1,"number",'1')

for every button

and then

function missionStart(whichMouse, state, absoluteX, absoluteY)	local number = getElementData(source,"number")	outputChatBox(number)end

gives me nothing if i click not on the button..

so it fires so much events it found, but without a source?..

this will be probably something really stupid, im feeling it

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...