TheCreator Posted July 5, 2007 Share Posted July 5, 2007 Hello all I've got a proglem. I've got a list, list 1 and list 2. I've got the lists populated with text, and would like to allow the user to delete text with one button. This requires that I keep track of the focus on the list, I did something like: where the Id was needed, CTRLGetFocus, but I think that if the user has the button focused, to click delete, this won't work. Is there a way to get this working? Thanks, ~~TheCreator~~Visit http://tysdomain.com for personal software and website solutions. Link to comment Share on other sites More sharing options...
Siao Posted July 5, 2007 Share Posted July 5, 2007 (edited) #include <GUIConstants.au3> Opt("GUIOnEventMode", 1) $Gui = GUICreate("", 400, 300) GUISetOnEvent($GUI_EVENT_CLOSE, "guiClose") $Button1 = GUICtrlCreateButton("", 150, 240, 100, 40) GUICtrlSetOnEvent(-1, "Button1Click") $List1 = GUICtrlCreateList("", 50, 50, 150, 150) GUICtrlSetData(-1, "a1|a2|a3|a4") GUICtrlSetOnEvent(-1, "List1Click") $List2 = GUICtrlCreateList("", 200, 50, 150, 150) GUICtrlSetData(-1, "b1|b2|b3|b4") GUICtrlSetOnEvent(-1, "List2Click") GUISetState(@SW_SHOW) Global $clear = 0 While 1 Sleep(100) WEnd Func guiClose() Exit EndFunc Func Button1Click() If $clear = 0 Then Return GUICtrlSetData($clear, "") EndFunc Func List1Click() $clear = $List1 GUICtrlSetData($Button1, "Clear List1") EndFunc Func List2Click() $clear = $List2 GUICtrlSetData($Button1, "Clear List2") EndFunc Although ContextMenu probably would be a more elegant solution than a button. Edited July 5, 2007 by Siao "be smart, drink your wine" Link to comment Share on other sites More sharing options...
PsaltyDS Posted July 5, 2007 Share Posted July 5, 2007 Although ContextMenu probably would be a more elegant solution than a button.I like that! Both your script, and the ContextMenu idea! Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
TheCreator Posted July 5, 2007 Author Share Posted July 5, 2007 It worked! <3 Thanks! ~~TheCreator~~Visit http://tysdomain.com for personal software and website solutions. 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