Jump to content

managing two listboxes ith a single button


Recommended Posts

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

#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 by Siao

"be smart, drink your wine"

Link to comment
Share on other sites

Although ContextMenu probably would be a more elegant solution than a button.

I like that! Both your script, and the ContextMenu idea! :whistle:

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

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
 Share

  • Recently Browsing   0 members

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