Jump to content

Search the Community

Showing results for tags 'Listbox'.

  • 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

Categories

  • Forum FAQ
  • AutoIt

Calendars

  • Community Calendar

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 21 results

  1. So I have a GUI that creates a listbox with some items in it. when the gui starts it reads a list of items to select from a sqlite db and stores it in an array ($sItemsToSelect). At least it should. The issue is that its not selecting any items and im not sure why. The below example I believe demonstrates this. When the example gui below starts I am expecting it to select Items 1 and Items 3. Can someone help me correct the below please? #include <GUIConstantsEx.au3> #include <GuiListBox.au3> Global $hGUI = GUICreate("Test GUI", 175, 120) Global $idList = GUICtrlCreateList("", 10, 10, 150, 100) GUICtrlSetData($idList, "Item 1|Item 2|Item 3|Item 4") GUISetState(@SW_SHOW, $hGUI) Global $aItemsToSelect = StringSplit("Item 1|Item 3", "|", 2) _SelectItems($idList, $aItemsToSelect) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop EndSwitch WEnd Func _SelectItems($idList, $aItemsToSelect) Local $hList = GUICtrlGetHandle($idList) ConsoleWrite("Selecting specified items..." & @CRLF) Local $iFound, $sItem, $iErrCount = 0 _GUICtrlListBox_SetSel($hList, False, -1) For $i = 0 To UBound($aItemsToSelect) - 1 $sItem = $aItemsToSelect[$i] $iFound = _GUICtrlListBox_FindString($hList, $sItem) If $iFound = -1 Then ConsoleWriteError("Item '" & $sItem & "' not found in ListBox." & @CRLF) $iErrCount += 1 Else _GUICtrlListBox_SetSel($hList, True, $iFound) ConsoleWrite("Selected item: '" & $sItem & "' at index " & $iFound & @CRLF) EndIf Next If $iErrCount > 0 Then MsgBox($MB_ICONERROR, "Error", "One or more items could not be selected. Check the console for details.") Else ConsoleWrite("All items selected successfully." & @CRLF) EndIf EndFunc Many Thanks in Advance!
  2. How to add a horizontal scroll the listbox? I have tried $WS_HSCROLL, and I have tried using _GUICtrlListView_SetColumnWidth to set the listbox column width to be larger than the listbox itself as one post suggested. None of it is working. expand popup #Include <SQLite.au3> #include <GuiListBox.au3> #include <GuiListView.au3> #include <Date.au3> #include <File.au3> #include <Array.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <ScrollBarConstants.au3> #Include <Math.au3> #Include <Inet.au3> #Region CreateGUI     ;create gui     Global $hGUI = GUICreate("Applanix Automation", 400, 350, 210, 0)     GUISetOnEvent($GUI_EVENT_CLOSE, EndCode)     Global $btnBrowse = GUICtrlCreateButton("Start", 10, 2, 76, 20)     Global $lblBrowse = GUICtrlCreateLabel("Project Directory", 100, 5, 286, 16)     Global $Label_5 = GUICtrlCreateLabel("APPLANIX", 10, 30, 76, 20)     Global $Label_1 = GUICtrlCreateLabel("TIME SYNC", 10, 55, 76, 20)     Global $Label_2 = GUICtrlCreateLabel("INJ TC", 10, 80, 76, 20)     Global $Label_3 = GUICtrlCreateLabel("INJ PP", 10, 105, 76, 20)     Global $Label_4 = GUICtrlCreateLabel("DR", 10, 130, 76, 20)     Global $lblApplxStatus = GUICtrlCreateLabel("n/x", 100, 30, 56, 20)     Global $lblTSStatus = GUICtrlCreateLabel("n/x", 100, 55, 56, 20)     Global $lblITCStatus = GUICtrlCreateLabel("n/x", 100, 80, 56, 20)     Global $lblIPPStatus = GUICtrlCreateLabel("n/x", 100, 105, 56, 20)     Global $lblDRStatus = GUICtrlCreateLabel("n/x", 100, 130, 56, 20)     Global $lstLog = GUICtrlCreateList(" ", 30, 155, 346, 176, $listBoxStyle)     GUISetState(@SW_SHOWNORMAL)     for $i = 0 to 50         GUICtrlSetData($lstLog,_NowTime(5) & " " &  50 - $i & " testttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttt")     Next     _GUICtrlListView_SetColumnWidth($lstLog,0,500) #EndRegion ;CreateGUI While 1 wend
  3. I am a bit confused about how to change the contents of one listbox item. I have been trying to use _GuiCtrlIListbox_GetItemData and _GuiCtrlIListbox_SetItemData. Is this correct? I have tried using _GuiCtrlIListbox_GetItemText also. I have code as follows that is intended to replace the first 4 characters of the entry with 5 dashes : $sLbxEntry = _GuiCtrlListbox_GetItemData($gLbxPlayList, $iLstIdx) FnuDebug("Listbox entry no: " & $iLstIdx & ", Listbox error = " & @error & ", Content: " & $sLbxEntry) $sLbxEntry = "-----" & StringMid($sLbxEntry, 5) _GUICtrlListBox_SetItemData($gLbxPlayList, $iLstIdx, $sLbxEntry) ;results of debug: ;DEBUG: Listbox entry no: 3, Listbox error = 0, Content: 0 It would appear that the first line of code is returning "0" yet that listbox entry is clearly populated with text. I suspect I am misunderstanding something very basic?
  4. Hello all, I am trying to get scrolling events for ListBox (mouse wheel and up/down arrows) but without success. The event not occured on row change but if I click on it - yes The ComboBox works fine even if not in focus (with mouse wheel) but I prefer visual look of ListBox. In addition to all, I can't change the height of control. Unfortunately it depends only on font size and same fonts has different heights between InputBox and ComboBox Is there a way to get over the issue? Any other ideas for unit selection realization are welcome #include <GuiComboBox.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <ListBoxConstants.au3> Global $idCombo, $idComboUnit, $idList, $idListUnit Global $sComboInitUnit = "pJ", $fComboVal = 7.5 Global $sListInitUnit = "nF", $fListVal = 0.15 Units_Conversion_Example() Func Units_Conversion_Example() ; Create GUI GUICreate("Units Conversion", 400, 296) $idCombo = GUICtrlCreateInput($fComboVal, 22, 20, 91, 26) GUICtrlSetFont(-1, 13, 400, 0, "MS Reference Sans Serif") $idComboUnit = GUICtrlCreateCombo("", 112, 20, 50, 30) GUICtrlSetData(-1, "uJ|nJ|pJ", $sComboInitUnit) GUICtrlSetFont(-1, 13, 400, 0, "MS Reference Sans Serif") $idList = GUICtrlCreateInput($fListVal, 22, 80, 91, 26) GUICtrlSetFont(-1, 13, 400, 0, "MS Reference Sans Serif") $idListUnit = GUICtrlCreateList("", 112, 80, 57, 26, BitOR($LBS_NOTIFY,$LBS_NOSEL,$WS_VSCROLL)) GUICtrlSetData(-1, "uF|nF|pF", $sListInitUnit) GUICtrlSetFont(-1, 13, 400, 0, "MS Reference Sans Serif") GUISetState(@SW_SHOW) GUIRegisterMsg($WM_COMMAND, "WM_COMMAND") Do Sleep(5) Until GUIGetMsg() = $GUI_EVENT_CLOSE GUIDelete() EndFunc ;==>Example Func WM_COMMAND($hWnd, $iMsg, $wParam, $lParam) #forceref $hWnd, $iMsg Local $hWndFrom, $iIDFrom, $iCode, $hWndCombo, $hWndListBox If Not IsHWnd($idComboUnit) Then $hWndCombo = GUICtrlGetHandle($idComboUnit) If Not IsHWnd($idListUnit) Then $hWndListBox = GUICtrlGetHandle($idListUnit) $hWndFrom = $lParam $iIDFrom = BitAND($wParam, 0xFFFF) ; Low Word $iCode = BitShift($wParam, 16) ; Hi Word Switch $hWndFrom Case $hWndCombo Switch $iCode Case $LBN_SELCHANGE ConsoleWrite(GUICtrlRead($idComboUnit) & @CRLF) EndSwitch Case $hWndListBox Switch $iCode Case $CBN_SELCHANGE ConsoleWrite(GUICtrlRead($idListUnit) & @CRLF) EndSwitch EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>WM_COMMAND
  5. Hi, here are few functions for the ListBox. I have searched the forum, but most of the functions are for listview, so i took one example code from melba23 (clear selection) and wrote few more functions. (Because my current project needs them). These functions work only on a Multi-selection ListBox . Edit: Only 1 function does not work with single selection box. The functions do: Clear Selection, Delete Selected items, Invert Selection, Move selected items up and down. The example code has 2 Listboxes. The selected items on the left ListBox can be moved up and down. The right Listbox has buttons for the other functions. #include <GUIConstantsEx.au3> #include <GuiListBox.au3> #include <WindowsConstants.au3> #include <Array.au3> Local $singlesel = 0, $iMsgBoxAnswer = 0 ;MsgBox features: Title=Yes, Text=Yes, Buttons=Yes and No, Icon=Question, Modality=Task Modal $iMsgBoxAnswer = MsgBox(8228, "Choose Listbox selecton type", "Yes for single, No for multi selection box") If $iMsgBoxAnswer = 6 Then $singlesel = 1 ;Yes Local $BL_1,$BL_2,$BR_1,$BR_2,$BR_3,$BR_4,$BR_5,$BR_6 Global $hForm1 = GUICreate("Listbox test", 349, 287) $LB_1 = GUICtrlCreateList("", 6, 40, 157, 244, BitOR($LBS_NOTIFY, $LBS_MULTIPLESEL, $WS_HSCROLL, $WS_VSCROLL, $LBS_DISABLENOSCROLL)) If $singlesel = 1 Then $LB_2 = GUICtrlCreateList("", 179, 40, 157, 244, BitOR($LBS_NOTIFY, $WS_HSCROLL, $WS_VSCROLL, $LBS_DISABLENOSCROLL)) Else $LB_2 = GUICtrlCreateList("", 179, 40, 157, 244, BitOR($LBS_NOTIFY, $LBS_MULTIPLESEL, $WS_HSCROLL, $WS_VSCROLL, $LBS_DISABLENOSCROLL)) $BR_3 = GUICtrlCreateButton("Reverse Sel", 272, 22, 68, 17) EndIf $BL_1 = GUICtrlCreateButton("Up", 20, 3, 35, 18) $BL_2 = GUICtrlCreateButton("Down", 60, 3, 35, 18) $BR_1 = GUICtrlCreateButton("Up", 200, 3, 35, 18) $BR_2 = GUICtrlCreateButton("Down", 240, 3, 35, 18) $BR_4 = GUICtrlCreateButton("Clear Sel", 217, 22, 52, 17) $BR_5 = GUICtrlCreateButton("Delete", 175, 22, 40, 17) $BR_6 = GUICtrlCreateButton("Populate", 290, 3, 50, 18) GUISetState(@SW_SHOW) For $x = 0 To 50 If $x <= 10 Then GUICtrlSetData($LB_1, $x & " test", 0) GUICtrlSetData($LB_2, $x & " Test", 0) Next While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $BL_1 $a = Listbox_ItemMoveUD($LB_1, -1) If $a > -1 Then WinSetTitle($hForm1, "", "Moved items: " & $a) Case $BL_2 $a = Listbox_ItemMoveUD($LB_1, 1) If $a > -1 Then WinSetTitle($hForm1, "", "Moved items: " & $a) Case $BR_1 Listbox_ItemMoveUD($LB_2, -1) Case $BR_2 Listbox_ItemMoveUD($LB_2, 1) Case $BR_3 Listbox_ReverseSelection($LB_2) Case $BR_4 Listbox_ClearSelection($LB_2) Case $BR_5 Listbox_DeleteSelectedItems($LB_2) Case $BR_6 ;Populate GUICtrlSetData($LB_2, "") ; Clears the listbox For $x = 0 To 50 GUICtrlSetData($LB_2, $x & " Test", 0) Next EndSwitch WEnd ;note $hLB_ID - is the Listbox id Func Listbox_DeleteSelectedItems($hLB_ID) Local $aSel = _GUICtrlListBox_GetSelItems($hLB_ID) ;Get selected items Local $i, $slb = 0, $y, $x If $aSel[0] = 0 Then ;If the array is empty, there is no selection, or it is a single selection listbox For $x = 0 To _GUICtrlListBox_GetCount($hLB_ID) - 1 $y = _GUICtrlListBox_GetSel($hLB_ID, $x) If $y = True Then $slb = 1 _GUICtrlListBox_DeleteString($hLB_ID, $x) ;Perform a delete on single sel. LB ExitLoop EndIf Next EndIf If $slb = 0 Then _GUICtrlListBox_BeginUpdate($hLB_ID) For $i = $aSel[0] To 1 Step -1 ;Loop backwards and delete the selected items _GUICtrlListBox_DeleteString($hLB_ID, $aSel[$i]) Next _GUICtrlListBox_EndUpdate($hLB_ID) EndIf EndFunc ;==>Listbox_DeleteSelectedItems Func Listbox_ClearSelection($hLB_ID) ;Removes the selection from multi and single selection ListBox Local $aSel = _GUICtrlListBox_GetSelItems($hLB_ID) ;Code from Melba23 - Autoit Forum Local $slb, $x, $y If $aSel[0] = 0 Then _GUICtrlListBox_SetCurSel($hLB_ID, -1) $slb = 1 EndIf If $slb = 0 Then _GUICtrlListBox_BeginUpdate($hLB_ID) For $i = 1 To $aSel[0] _GUICtrlListBox_SetSel($hLB_ID, $aSel[$i], False) Next _GUICtrlListBox_EndUpdate($hLB_ID) EndIf EndFunc ;==>Listbox_ClearSelection Func Listbox_ReverseSelection($hLB_ID) ;Logically, this function works only on multi-selection listboxes Local $i Local $aCou = _GUICtrlListBox_GetCount($hLB_ID) Local $cSel = _GUICtrlListBox_GetCaretIndex($hLB_ID) ;Save the caret _GUICtrlListBox_BeginUpdate($hLB_ID) For $i = 0 To $aCou _GUICtrlListBox_SetSel($hLB_ID, $i, Not (_GUICtrlListBox_GetSel($hLB_ID, $i))) Next _GUICtrlListBox_SetCaretIndex($hLB_ID, $cSel) ;Restore the caret _GUICtrlListBox_EndUpdate($hLB_ID) EndFunc ;==>Listbox_ReverseSelection Func Listbox_ItemMoveUD($hLB_ID, $iDir = -1) ;Listbox_ItemMoveUD - Up/Down Move Multi/Single item in a ListBox ;$iDir: -1 up, 1 down ;Return values -1 nothing to do, 0 nothing moved, >0 performed moves Local $iCur, $iNxt, $aCou, $aSel, $i, $m = 0, $y, $slb = 0 ;Current, next, Count, Selection, loop , movecount $aSel = _GUICtrlListBox_GetSelItems($hLB_ID) ;Put selected items in an array $aCou = _GUICtrlListBox_GetCount($hLB_ID) ;Get total item count of the listbox If $aSel[0] = 0 Then $y = _GUICtrlListBox_GetCurSel($hLB_ID) If $y > -1 Then _ArrayAdd($aSel, $y) $aSel[0] = 1 $slb = 1 EndIf EndIf ;WinSetTitle($hGUI, "", $aSel[0]) ;Debugging info Select Case $iDir = -1 ;Move Up For $i = 1 To $aSel[0] If $aSel[$i] > 0 Then $iNxt = _GUICtrlListBox_GetText($hLB_ID, $aSel[$i] - 1) ;Save the selection index - 1 text _GUICtrlListBox_ReplaceString($hLB_ID, $aSel[$i] - 1, _GUICtrlListBox_GetText($hLB_ID, $aSel[$i])) ;Replace the index-1 text with the index text _GUICtrlListBox_ReplaceString($hLB_ID, $aSel[$i], $iNxt) ;Replace the selection with the saved var $m = $m + 1 EndIf Next For $i = 1 To $aSel[0] ;Restore the selections after moving If $aSel[$i] > 0 Then If $slb = 0 Then _GUICtrlListBox_SetSel($hLB_ID, $aSel[$i] - 1, 1) Else _GUICtrlListBox_SetCurSel($hLB_ID, $aSel[$i] - 1) EndIf EndIf Next Return $m Case $iDir = 1 ;Move Down If $aSel[0] > 0 Then For $i = $aSel[0] To 1 Step -1 If $aSel[$i] < $aCou - 1 Then $iNxt = _GUICtrlListBox_GetText($hLB_ID, $aSel[$i] + 1) _GUICtrlListBox_ReplaceString($hLB_ID, $aSel[$i] + 1, _GUICtrlListBox_GetText($hLB_ID, $aSel[$i])) _GUICtrlListBox_ReplaceString($hLB_ID, $aSel[$i], $iNxt) $m = $m + 1 EndIf Next EndIf For $i = $aSel[0] To 1 Step -1 ;Restore the selections after moving If $aSel[$i] < $aCou - 1 Then If $slb = 0 Then _GUICtrlListBox_SetSel($hLB_ID, $aSel[$i] + 1, 1) Else _GUICtrlListBox_SetCurSel($hLB_ID, $aSel[$i] + 1) EndIf EndIf Next Return $m EndSelect Return -1 EndFunc ;==>Listbox_ItemMoveUD
  6. Hi, This is my very first post in this forum and am also new with Autoit programming so be easy on me. Below is the code that I am trying to get the index of the item selected. No problem getting the text. Case $listEdition   ; handle of the list             local $index=0             $item=GUICTRLRead($listEdition)    ; This will return the text in the list             ; ==============   The loop below always fails  ==================             ; Meaning _GUICtrlListView_GetItemSelected($listEdition, $i) always return FALSE. WHY ???????              For $i = 0 To $editionArray[0] - 1   ; The content of the list in an array where editionArray[0] contains total count of items                 If _GUICtrlListView_GetItemSelected($listEdition, $i) Then                     $index = $i                     exitloop                 EndIf              Next              ;===================================================             ConsoleWrite( "Select Edition:     " & $item & "  index: " & $index & @CR) ....... Please look at the comments in the code & the pix attached. _GUICtrlListView_GetItemSelected($listEdition, $i) always returns FALSE. Another problem is on the list. It also populate the total count of items from the Array. How can I skip this item from populating to the list ?. Please advise and thanks
  7. Hi first step i write ipconfig output to ipconfig.txt. Now i try to find all Adapters and get for each adapter: Adapter Name, Description, Media State and Mac Adress and put it to listbox. I search for "Ethernet Adapter" but they are other entrys like Wireless Adapter .. How can i get all Adapters from ipconfig.txt and information for each adapter Adapter Name, Description, Media State and Mac Adress and write to listbox ? Would appreciate any help! #include <File.au3> #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <GUIListBox.au3> #include <WindowsConstants.au3> $Form1 = GUICreate("Form1", 451, 328, 856, 237) $Button1 = GUICtrlCreateButton("Button1", 8, 8, 75, 25) $List1 = GUICtrlCreateList("", 88, 8, 353, 305) GUISetState(@SW_SHOW) While 1 $msg = GUIGetMsg() Select ;Case $GUI_EVENT_CLOSE Case $msg = $GUI_EVENT_CLOSE Exitloop Case $msg = $Button1 $FilePath= "C:\temp\IPconfig.txt" $StringToSearch= "Ethernet adapter" $CaseSense=0 $Lines=_FileCountLines($FilePath) $hFile=FileOpen($FilePath,0) $Lines=_FileCountLines($FilePath) For $i=0 To Number($Lines) $Test=FileReadLine($hFile,$i) If StringInStr($Test,$StringToSearch,$CaseSense) Then $filereadAdapter = FileReadLine($hFile,$i) $filereadDescription = FileReadLine($hFile,$i+4) $filereadMediaState = FileReadLine($hFile,$i+2) $filereadMAcAdress = FileReadLine($hFile,$i+5) GUICtrlSetData($List1 , "Adapter: " & $filereadAdapter & @CRLF& "Description: "& $filereadDescription & @CRLF & "Media State: " & $filereadMediaState & @CRLF & "Mac Adress: " & $filereadMAcAdress& @CRLF) ;ExitLoop EndIf Next FileClose($hFile)
  8. can we create a list box with Columns? welcome everybody Dears I have a question if you let me can we create a list box with Columns? i know we can create a list view with Columns but my question is about the list box I'm waiting your responses Thank you in advance
  9. Hello Today I'm working on listbox but there might be something that I'm missing... I made a little script that allow the user to swap 2 items for the listbox. So the user select for example the 3rd item, press the button "Up" and it switch with the 2nd one, same with the "Down" button that switch with the 4th one. But when I select the 3rd item and switch it the item become unselected and I would like to select it again after the manipulation : As you can see in the comment of the script, _GUICtrlListBox_SetSel don't highlight/select them once the swap process is done.. What am I missing ?
  10. I know there are listbox and listview, but now I have? here is the video of infowindow I tried to read mouse selection like for listbox: $listWindow = "[CLASS:TFormResearchGR]" $topicsList = "[CLASS:TMWrapper; INSTANCE:255]" WinWait($listWindow, "", 60) $hdlWindow = WinGetHandle($listWindow) $hdlList = ControlGetHandle($hdlWindow, "", $topicsList) _GUICtrlListBox_ClickItem($hdlList, 0, "left") $countOfList = _GUICtrlListBox_GetCount($hdlList) ConsoleWrite("Count of list: " & $countOfList & @LF) count of list is not working. I realiezed that there are difference between listbox and listview, but this is something different. and till now I never saw that you can go inside with infotool and also get instances. so Im confused how to get the list number and the names of selection?
  11. This is not a working example -- I'm asking about the principle... Here we have the often seen code to detect a double-click on an item in one ListBox (ID in $idListBox is of course created by other code). To catch that ListBox item, I have only added $sBookmark to it. This could be a pick list application. $idListBox = 0x004A0FB0 GUIRegisterMsg($WM_COMMAND, "_WM_COMMAND") Func _WM_COMMAND($hWnd, $iMsg, $wParam, $lParam) #forceref $hWnd, $iMsg Local $hWndFrom, $iIDFrom, $iCode, $hWndListBox, _ $sBookmark If Not IsHWnd($idListBox) Then $hWndListBox = GUICtrlGetHandle($idListBox) $hWndFrom = $lParam $iIDFrom = BitAND($wParam, 0xFFFF) ; Low Word $iCode = BitShift($wParam, 16) ; Hi Word Switch $hWndFrom Case $idListBox, $hWndListBox $sBookmark = _GUICtrlListBox_GetText( $hWndFrom, _GUICtrlListBox_GetCurSel($hWndFrom) ) Switch $iCode Case $LBN_DBLCLK ConsoleWrite("you double-clicked " & $sBookmark & @CRLF) EndSwitch EndSwitch Return $GUI_RUNDEFMSG EndFunc Now, my question is: can one modify the _WM_COMMAND function to allow for a dynamic number of ListBoxes? (meaning, user-defined -- the amount of ListBoxes/pick lists can change at any time). Let's assume I dynamically obtained an array with ListBox ID's for (in this case) 5 pick lists: One part of the solution seems to work with the For... Next loop I added below, but I'm wondering if that is the ultimate? (knowing this Func has to be as fast as possible) The part where I can't find anything that works for a dynamic amount of ListBox ID's is in the Case check... I tried _ArrayToTxt($aIdListBox, ", ", 1), messed with Eval(), and trying Case $aIdListBox[start] To $aIdListBox[end] Func _WM_COMMAND($hWnd, $iMsg, $wParam, $lParam) #forceref $hWnd, $iMsg Local $hWndFrom, $iIDFrom, $iCode, $hWndListBox, _ $sBookmark For $i = 1 To UBound($aIdListBox) - 1 ; is this solution fast enough? (it seems to work well) If Not IsHWnd($aIdListBox[$i]) Then $hWndListBox = GUICtrlGetHandle($aIdListBox[$i]) ExitLoop ; cause there can only be one hit(?) EndIf Next $hWndFrom = $lParam $iIDFrom = BitAND($wParam, 0xFFFF) ; Low Word $iCode = BitShift($wParam, 16) ; Hi Word Switch $hWndFrom Case [WHAT TO PUT HERE if nr of ListBoxes is dynamic?], $hWndListBox ; <= MAIN question $sBookmark = _GUICtrlListBox_GetText( $hWndFrom, _GUICtrlListBox_GetCurSel($hWndFrom) ) Switch $iCode Case $LBN_DBLCLK ConsoleWrite("you double-clicked " & $sBookmark & @CRLF) EndSwitch Return $GUI_RUNDEFMSG EndFunc - - - As a workaround, I can probably add the maximum number of allowed ListBoxes to the Case check, seperated by commas, but only display the number of ListBoxes needed. But I'm hoping it can be made truly dynamical...? Thank You : )
  12. Hi Guys I got a problem, hope someone can help me, many thanks. I'm trying to read items from a listbox1($ListChoCom) to an array, and load this array to another listbox2($ListSuitCmd) which is on the different tab. But, now, I cannot select items on the listbox2. I only can select from listbox1. Here is the code and the screenshots. Func btnNext2() Dim $SelCmdArray[10] For $i = 0 To _GUICtrlListBox_GetCount($ListChoCom) - 1 $SelCmdArray[$i] = _GUICtrlListBox_GetText($ListChoCom, $i) ReDim $SelCmdArray[UBound($SelCmdArray) + 1] GUICtrlSetData($ListSuitCmd, $SelCmdArray[$i]) Next _GUICtrlTab_ClickTab($Tab1, 2) EndFunc Screenshot 1: I can select item from this listbox1. screenshot2: I cannot select item from listbox2, The item that been highlight is what I select from listbox1. Thank you very much indeed.
  13. Hi all, I am playing with GUIRegisterMsg function for learning it. This is my code. It is not working. The error msg is this Variable used without being declared.: $tNMHDR = DllStructCreate($tagNMHDR, $lParam) $tNMHDR = DllStructCreate($tagNMHDR, ^ ERROR I can't find lParam as a declared variable in _GUICtrlListView_Create.au3 in help file. #include <ButtonConstants.au3> #include <ComboConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <GUIListBox.au3> #include <WindowsConstants.au3> #include <MouseOnEvent.au3> #include <Alert.au3> #include <ListBoxConstants.au3> Opt("GUIOnEventMode", 1) #Region ### START Koda GUI section ### Form=K:\GUI Reg Msg Test works\GRM test GUI.kxf Global $Form1 = GUICreate("Form1", 611, 430, 260, 140) GUISetFont(12, 400, 0, "Segoe UI") GUISetOnEvent($GUI_EVENT_CLOSE, "Form1Close") GUISetOnEvent($GUI_EVENT_MINIMIZE, "Form1Minimize") GUISetOnEvent($GUI_EVENT_MAXIMIZE, "Form1Maximize") GUISetOnEvent($GUI_EVENT_RESTORE, "Form1Restore") Global $Button1 = GUICtrlCreateButton("Button1", 368, 360, 137, 49) GUICtrlSetOnEvent(-1, "Button1Click") Global $List1 = GUICtrlCreateList("", 16, 216, 161, 181) GUICtrlSetOnEvent(-1, "List1Click") Global $Combo1 = GUICtrlCreateCombo("Combo1", 352, 24, 193, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL)) GUICtrlSetOnEvent(-1, "Combo1Change") Global $Input1 = GUICtrlCreateInput("Input1", 48, 32, 169, 33) GUICtrlSetOnEvent(-1, "Input1Change") Global $Edit1 = GUICtrlCreateEdit("", 248, 80, 321, 161) GUICtrlSetData(-1, "Edit1") GUICtrlSetOnEvent(-1, "Edit1Change") GUIRegisterMsg($WM_NOTIFY,"List1Click") GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### Local $tmp = ["Orange","Apple","Banana","Papaya","Grapes"] For $i = 0 to 4 GUICtrlSetData($List1,$tmp[$i]) Next While 1 Sleep(100) WEnd Func List1Click($hWnd, $iMsg, $wParam, $lParam) #forceref $hWnd, $iMsg Local $hWndFrom,$iIDfrom, $iCode, $tNMHDR, $hWndList, $tInfo $hWndList = $List1 if Not IsHWnd($List1) Then $hWndList = GUICtrlGetHandle($List1) $tNMHDR = DllStructCreate($tagNMHDR, $lParam) $hWndFrom = HWnd(DllStructGetData($tNMHDR,"hWndFrom")) $iIDfrom = DllStructGetData($tNMHDR,"IDFrom") $iCode = DllStructGetData($tNMHDR, "Code") Switch $hWndFrom Case $List1 Switch $iCode Case $LBN_DBLCLK ;$tInfo = DllStructCreate($tagNMMOUSE) Alert("You Clicked Twice") EndSwitch EndSwitch Return $GUI_RUNDEFMSG EndFuncThis gui is only for learning pupose. So please don't mind its aesthetic style.
  14. Hello all! With your help I have been able to conquer every problem I've faced thus far in using AutoIt, but I've come across something that I 1) don't fully understand and 2) am not sure how to even begin tackling. I have the following list box in a GUI that I am trying to automate that I cannot read any data from. I have discussed this in a previous thread and tried several solutions, but the conclusion was that OCR would probably be the best way to go. You can see the list info and the list box(the data has been edited out) below: I need to find a way to view the data in the list box and choose the user parameter(in this case, the correct library). There will also be instances where I will simply need to get data from another list and validate it it. I believe the major issue is that the list is populated at runtime(this was discussed in a previous thread) and that is why I cannot directly access the data in the list. I have viewed both of these threads: but am not able to full grasp how I should be using either of them. Unfortunately this means that I also don't really have a script to post at this point in time either. If anyone that has experience with this can help me out or point me in the right direction, that would be a huge help. This is the last piece of the puzzle for me and it has absolutely driven me crazy I am trying to incorporate everything into AutoItx4Java, but am prepared to run an executable for these portions if necessary. Thanks in advance for any help you might be able to give! I will do my best to get back to you with any questions as soon as I can.
  15. Hello All, I have searched the forums and google trying to see if there is a way to disable click on any of the items in a listbox. I also am trying to update the listbox items, I have certain populated items which I would like to update each one on the fly. Any help is appreciated.
  16. Hello guys! I've got a simple question: - Is it possible to display a ToolTip on ListBox Item? - I want to display it when an Item is too long for the ListBox width, and a part of it is hidden (Just like a ListView does, but for a ListBox) Thanks!
  17. Hello everyone! Maybe someone knows. Is it possible to make long items listboks transferred / broken into multiple lines?
  18. New here - only just started working with AutoIt for the first time last week. I am using AutoIt to automate several different executables/Install Wizards, most of which are from printer manufacturers to install their drivers and select the one you want to create printers (Windows 7). I've completed about 4 of these so far. I have finally come upon my first ListBox - except according to Window Info, it is a "TEPListBox.UnicodeClass." Have no idea if that makes a difference or not. I have searched the Wiki here and searched many other forums - almost all seem to be about how to create your own GUIs with ListBoxes, but I'm finding very little on selecting a single item from a ListBox. This window has two ListBoxes - the first one is a "TListBox" with just one option, so I don't have to worry about that. The 2nd ListBox is this "TEPListBox" with about 120 printer names listed. I just need to select/highlight the printer name we need and then hit the "Next" button, but I guess maybe I'm using the wrong commands (with what I could find online). Here is the Summary of the Window Info for this 2nd ListBox: >>>> Control <<<< Class: TEPListBox.UnicodeClass Instance: 1 ClassnameNN: TEPListBox.UnicodeClass1 Name: Advanced (Class): [CLASS:TEPListBox.UnicodeClass; INSTANCE:1] ID: 2294372 Text: Position: 248, 148 Size: 233, 121 ControlClick Coords: 76, 72 Style: 0x54210941 ExStyle: 0x00000200 Handle: 0x0000000000230264 >>>> Mouse <<<< Position: 715, 564 Cursor ID: 0 Color: 0xFFFFFF >>>> StatusBar <<<< >>>> ToolsBar <<<< >>>> Visible Text <<<< &Exit &Help &Next > < &Previous &Change location... >>>> Hidden Text <<<< And here are some of the commands I've tried: ControlCommand ("Selecting The Printer", "", "[CLASS:TEPListBox.UnicodeClass; INSTANCE:1]", "SelectString", "ZDesigner LP 2844") ControlCommand ("Selecting The Printer", "", "[CLASS:TEPListBox; INSTANCE:1]", "SelectString", "ZDesigner LP 2844") ControlCommand ("Selecting The Printer", "", "[CLASS:ListBox; INSTANCE:1]", "SelectString", "ZDesigner LP 2844") ControlCommand ("Selecting The Printer", "", "[CLASS:ListBox]", "SelectString", "ZDesigner LP 2844") Highlight just stays on the first option in the ListBox with all of these, so not sure where to proceed. Or is ControlCommand just not the way I want to go here? One other thing - there is a lot of text in this window, but what's listed as "Visible text" is just the text in each of the four buttons below. There is "Printers" above this ListBox (the "P" is underlined), but that is not listed as a "Visible text" for this window and I'm not sure why. Thank you
  19. Hi Forum In the Koda Form Designer the Updown Button only works for an Inputbox. I want to move things up and down in a listbox to sort it manually, but i can't get this done. Is there any solution? thx Spen
  20. Sorry if this has already been discussed, but I spent a lot of time searching the forum, and experimenting... without success. Here is my problem. I am trying to automate a VirtualDubMod.exe video encoding application. Everything works fine, except when I get to this window that contains a listbox (title: "Available Streams".) The AutoIt V3 Window Info says the following: In Basic Control Info Class: Listbox Instance: 1 in the Control tab: Class: Listbox Instance: 1 ClassnameNN: Listbox1 Advanced (Class) [CLASS: Listbox, INSTANCE: 1] ID: 1402 Text (blank) ... The listbox may contain one or several items describing video streams, and I would like to do several things: (1) Find an item that contains a specific string, and then select that item (that might be the most critical) Other things I'd like to do, but not critically important: (2) be able to select an item by rank: #1 or #3 (3) read the strings in the items in the listbox (4) and/or find out how many items are in the listbox (5) or, (lower priority) right click on each item and select one of the actions on the context menu, for example "Direct Stream Copy" or "Full Processing" I have tried to do this, hoping to identify the item that contains: "Long_amer_drag.ac3" WinWait("Available streams") $r = ControlCommand("Available streams", "", "[CLASSNN:ListBox1]", "FindString", "Long_amer_drag.ac3") MsgBox(4096, "Audio streams", " Reference $r = " &amp; $r)I get $r = 0 (the item that contains the string is in 2nd position), so that must be wrong. I also tried, hoping to select the right item: WinWait("Available streams") $r = ControlCommand("Available streams", "", "[CLASSNN:ListBox1]", "SelectString", "Long_amer_drag.ac3") MsgBox(4096, "Audio streams", " Reference $r = " &amp; $r)I also get $r = 0, and the selection doesn't move to the right item. I haven't found many options to pursue. I hope someone will be able to point me in the right direction. Thanks.
  21. Friends, I have written a program that among other things displays data in 3 listboxes. when the window has its original size, it works fine. But if I increase the size the window vertically the listboxes stretch as they should, and I can't select their top entries with the mouse . The last listbox entries are not affected. The more I stretch the window vertically, the more entries become out of reach by the mouse. Also the highest entry that can be selected by the mouse is iffy. It has to be low on the entry. But the keyboard arrow keys can select them with no problem. The listboxes are resized with the window because of commands like GUICtrlSetResizing ( $ControlHandle, $GUI_DOCKTOP + $GUI_DOCKSIZE + $GUI_DOCKRIGHT ) and that's probably where there is a problem with listview selection. My OS is windows 2008R1, and I've tried this using both beta 17 and version 3.3.6.1, if that has anything to do with it. Ideas anyone? Here is the code to build a sample UI to reproduce the problem. It puts a list the folders into a listbox. Run it, try to select the top entries, then stretch the window vertically and try to select the top entries: #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> Opt("GUIOnEventMode", 1) Opt('MustDeclareVars', 1) Dim $Win, $lblFolderList, $lbFolders Main () Func Main () $Win = GUICreate("Test Script", @DesktopWidth / 2 - 255, 188, 192, @DesktopHeight / 2 - 45, $WS_OVERLAPPEDWINDOW);$WS_SIZEBOX + $WS_MINIMIZE) $lblFolderList = GUICtrlCreateLabel("Folders List", 4, 8, 37, 17) GUICtrlSetResizing ( $lblFolderList, $GUI_DOCKLEFT + $GUI_DOCKWIDTH + $GUI_DOCKTOP ) $lbFolders = GUICtrlCreateList("", 4, 24, 65, 168) GUICtrlSetResizing ( $lbFolders, $GUI_DOCKLEFT + $GUI_DOCKWIDTH + $GUI_DOCKTOP + $GUI_DOCKBOTTOM ) GUISetState(@SW_SHOW) PopulateFolders() GUISetOnEvent($GUI_EVENT_CLOSE, "OnExit") GUISetState() While 1 Sleep ( 1000 ) WEnd EndFunc Func OnExit() Exit EndFunc Func PopulateFolders() Dim $Search, $Found Dim $InitDir = "C:\" GUICtrlSetData ( $lbFolders, "|" ) $Search = FileFindFirstFile ( $InitDir & "\*.*" ) if $Search > -1 Then While 1 $Found = FileFindNextFile ( $Search ) if @error Then ExitLoop If @extended = 1 Then GUICtrlSetData ( $lbFolders, $Found ) EndIf WEnd EndIf EndFunc
×
×
  • Create New...