sherkas Posted April 19, 2006 Share Posted April 19, 2006 Im trying to have a GUI with 32 labels (looks like backpack slots for a game) Is it possible to have a onevent for when they click one? Basically I have 40 backpack slots that are labels that look white. When they click one, I want it to update some fields and when they hit a button turn that label a different color. I cant seem to get the onevent to register the click, nor find a way to make it so I can find out what label they clicked. I tried GUISetOnEvent($GUI_EVENT_PRIMARYDOWN, "Clicked") And set $slot[0] = GuiCtrlCreateLabel("1.1", 20, 20, 20, 20) But whenever I click on my GUI it never accesses the functoin Clicked... What do I do? Link to comment Share on other sites More sharing options...
GaryFrost Posted April 19, 2006 Share Posted April 19, 2006 Im trying to have a GUI with 32 labels (looks like backpack slots for a game) Is it possible to have a onevent for when they click one? Basically I have 40 backpack slots that are labels that look white. When they click one, I want it to update some fields and when they hit a button turn that label a different color. I cant seem to get the onevent to register the click, nor find a way to make it so I can find out what label they clicked. I tried GUISetOnEvent($GUI_EVENT_PRIMARYDOWN, "Clicked") And set $slot[0] = GuiCtrlCreateLabel("1.1", 20, 20, 20, 20) But whenever I click on my GUI it never accesses the functoin Clicked... What do I do? Supply a script the runs to show what you have that isn't working for you, you'll get better help that way. SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference. Link to comment Share on other sites More sharing options...
sherkas Posted April 19, 2006 Author Share Posted April 19, 2006 (edited) Basically the function clicked is never ran. I cant seem to get any onevents to work actually. #include <GuiConstants.au3> AutoItSetOption ( "GUIOnEventMode", 1 ) Dim $slot[32];Slots 0-31 = 32 slots GUISetOnEvent($GUI_EVENT_PRIMARYDOWN, "Clicked") ; GUI GuiCreate("Stall Moniter", 500, 300) GuiSetIcon(@SystemDir & "\mspaint.exe", 0) $slot[0] = GuiCtrlCreateLabel("1.1", 20, 20, 20, 20) GuiCtrlSetBkColor(-1, 0xFFFFFF ) GUISetState (@SW_SHOW) Do Sleep( 1000 ) While 1 = 1 Func Clicked() GUICtrlSetBkColor ( $slot[0], 0xFF0000 ) EndFunc Edited April 19, 2006 by sherkas Link to comment Share on other sites More sharing options...
GaryFrost Posted April 19, 2006 Share Posted April 19, 2006 #include <GuiConstants.au3> AutoItSetOption("GUIOnEventMode", 1) Dim $slot[32];Slots 0-31 = 32 slots ; GUI GUICreate("Stall Moniter", 500, 300) GUISetOnEvent($GUI_EVENT_PRIMARYDOWN, "Clicked") GUISetIcon(@SystemDir & "\mspaint.exe", 0) $slot[0] = GUICtrlCreateLabel("1.1", 20, 20, 20, 20) GUICtrlSetBkColor(-1, 0xFFFFFF) GUISetState(@SW_SHOW) While 1 Sleep(200) WEnd Func Clicked() GUICtrlSetBkColor($slot[0], 0xFF0000) EndFunc ;==>Clicked SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference. Link to comment Share on other sites More sharing options...
sherkas Posted April 19, 2006 Author Share Posted April 19, 2006 heh look at that! What was wrong? I assume I need to have the script looping fairly fast to catch it? Link to comment Share on other sites More sharing options...
GaryFrost Posted April 19, 2006 Share Posted April 19, 2006 heh look at that! What was wrong? I assume I need to have the script looping fairly fast to catch it? look where the GUISetOnEvent($GUI_EVENT_PRIMARYDOWN, "Clicked") line is SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now