Jump to content

Search the Community

Showing results for tags 'dual list'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • General
    • Announcements and Site News
    • Administration
  • AutoIt v3
    • AutoIt Help and Support
    • AutoIt Technical Discussion
    • AutoIt Example Scripts
  • Scripting and Development
    • Developer General Discussion
    • Language Specific Discussion
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Categories

  • AutoIt Team
    • Beta
    • MVP
  • AutoIt
    • Automation
    • Databases and web connections
    • Data compression
    • Encryption and hash
    • Games
    • GUI Additions
    • Hardware
    • Information gathering
    • Internet protocol suite
    • Maths
    • Media
    • PDF
    • Security
    • Social Media and other Website API
    • Windows
  • Scripting and Development
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Member Title


Location


WWW


Interests

Found 1 result

  1. I'm having a problem with two lists to update. A populated volunteer list on the right and an empty worker list on the left. The idea is to Add a worker from volunteer list into the worker list and this should remove that selection from the volunteer list so that they cannot be selected again. So at all times, the worker + volunteer lists should equal the starting volunteer list. And Removing a worker from the list will add them back into the volunteer list. The code below runs but even though MsgBox is returning values, the lists are not being updated properly. When I add a worker, the volunteer list still shows them and in fact the list is duplicated (2 copies). When I add second worker, I get WorkerA and WorkerAWorkerB in the list, and now volunteer list is 3 copies. When removing WorkerA, they remain in the list. I'm fairly certain my regexp is good 'cause I tested it with RegExp.exe program. What have I missed? #include <ButtonConstants.au3> #include <DateTimeConstants.au3> #include <GUIConstantsEx.au3> #include <GUIListBox.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <GuiMonthCal.au3> #include <Array.au3> Opt("GUIOnEventMode", 1) Global $defVolunteer = "Bob Barker" Local $workers, $volunteers ClrEvent() #Region ### START Koda GUI section ### Form=r:\autoit examples\koda\forms\volunteeraddevent.kxf Local $FormAddEvent = GUICreate("Add Event", 422, 481, 302, 137) GUISetFont(12, 400, 0, "MS Sans Serif") GUISetBkColor(0xA6CAF0) GUISetOnEvent($GUI_EVENT_CLOSE, "FormAddEventClose") GUISetOnEvent($GUI_EVENT_MINIMIZE, "") GUISetOnEvent($GUI_EVENT_MAXIMIZE, "") GUISetOnEvent($GUI_EVENT_RESTORE, "") GUICtrlCreateLabel("Volunteer(s):", 160, 200, 112, 28, 0) GUICtrlSetFont(-1, 14, 400, 0, "MS Sans Serif") Local $VolWorked = GUICtrlCreateList("", 24, 176, 129, 246, BitOR($LBS_NOTIFY,$LBS_SORT,$WS_BORDER)) GUICtrlSetResizing(-1, $GUI_DOCKHEIGHT) Local $ButtonAdd = GUICtrlCreateButton("<< &Add", 168, 256, 97, 33, $BS_NOTIFY) GUICtrlSetOnEvent(-1, "ButtonAddClick") Local $ButtonRemove = GUICtrlCreateButton("&Remove >>", 168, 312, 97, 33, $BS_NOTIFY) GUICtrlSetOnEvent(-1, "ButtonRemoveClick") Local $VolList = GUICtrlCreateList("", 272, 176, 129, 246, BitOR($LBS_NOTIFY,$LBS_SORT,$WS_BORDER)) GUICtrlSetData(-1, $volunteers, $defVolunteer) GUICtrlSetResizing(-1, $GUI_DOCKHEIGHT) Local $ButtonEventDone = GUICtrlCreateButton("&Done", 90, 432, 97, 40, $BS_NOTIFY) GUICtrlSetOnEvent(-1, "ButtonEventDoneClick") Local $ButtonEventCancel = GUICtrlCreateButton("&Cancel", 235, 432, 97, 40, $BS_NOTIFY) GUICtrlSetOnEvent(-1, "ButtonEventCancelClick") GUISetState(@SW_HIDE) #EndRegion ### END Koda GUI section ### Func ClrEvent() $workers = "" $volunteers = "Bob Barker|Al Muh|Noele Muh|Carol Tartin|Don Floods|Lora Floods" EndFunc Func FormAddEventClose() GUISetState(@SW_HIDE) Exit EndFunc Func ButtonEventCancelClick() if (MsgBox(36, "Are You Sure?", "Cancel all changes and exit?") = 6) Then FormAddEventClose() EndFunc Func ButtonEventDoneClick() If (StringLen($workers) = 0) Then MsgBox(16, "Missing Workers", "A volunteer must be added to the list on the left." & @CRLF & "Select from Volunteer list on right and use the Add button.", 10) Else MsgBox(0, "Results", "Workers: " & $workers & @CRLF & @CRLF) EndIf EndFunc Func ButtonAddClick() Local $picked = GUICtrlRead($VolList) ; MsgBox(0, "Adding Before", "Worker picked: " & $picked & @CRLF & @CRLF & "Volunteer list: " & $volunteers & @CRLF & @CRLF, 10) $workers &= $picked StringRegExpReplace($volunteers, "(\|" & $picked & "$)", "") ; remove last item matched StringRegExpReplace($volunteers, "(" & $picked & "\|)", "") ; remove anywhere else GUICtrlSetData($VolList, $volunteers) GUICtrlSetData($VolWorked, $workers) MsgBox(0, "Adding Worker", "Worker picked: " & $picked & @CRLF & @CRLF & "Volunteer list: " & $volunteers & @CRLF & @CRLF, 10) EndFunc Func ButtonRemoveClick() Local $picked = GUICtrlRead($VolWorked) MsgBox(0, "Removing Before", "Volunteer removed: " & $picked & @CRLF & @CRLF & "Worker list: " & $workers & @CRLF & @CRLF, 10) $volunteers &= $picked StringRegExpReplace($workers, "(\|" & $picked & "$)", "") StringRegExpReplace($workers, "(" & $picked & "\|)", "") GUICtrlSetData($VolList, $volunteers) GUICtrlSetData($VolWorked, $workers) MsgBox(0, "Removing Worker", "Volunteer removed: " & $picked & @CRLF & @CRLF & "Worker list: " & $workers & @CRLF & @CRLF, 10) EndFunc GUISetState(@SW_SHOW) Local $msg While 1 $msg=GUIGetMsg() If (($msg = $GUI_EVENT_CLOSE) Or ($msg = $ButtonEventDone) Or ($msg = $ButtonEventCancel)) Then ExitLoop WEnd GUISetState(@SW_HIDE) GUIDelete() Exit
×
×
  • Create New...