I'm working on a script that needs to work with a huge database inside a combobox.
I'm looking for the best way to link a multidimensional array to that data to load that data on to textfields.
combo item 0 = "A", data = [index linked to combo item 0] [1,0,5,4,87,9,"xyz"]
combo item 1 = "B", data = [index linked to combo item 1] [1,6,5,4,87,9,"zzz"]
combo item 3 = "A", data = [index linked to combo item 3] [1,6,4,4,87,9,"aaa"] ; yes also double items!
Would also like to be able to delete and add items on the fly btw..
Local $INDEX ; ubound wil be resized like a stack while loading from a textfile ;inside gui: local $Combo = GUICtrlCreateCombo('...', 10, 10, 290, 25) ;gui loop: While True Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $Combo display() ; how do i link my array index to the combo labels to know what to show in the textfields? ; NOTE: (there are duplicate items in the combobox!) EndSwitch WEnd Any toughs are welcome.
I was thinking about using _GUICtrlComboBox_GetCurSel($Combo) and use that integer to refer to the index (dimension 1) of the array
I have read the Tutorial. Used the Help File and used an example script by @Melba23. I am still struggling.
To use GUIRegisterMsg one needs the following
a control in the GUI a GUIRegisterMsg instruction in the GUI to link the control to the WM_COMMAND function a Case statement in the Switch loop to run it a WM_COMMAND function and a processor function... Mine looks like this
;~ ; QuickSearch combo box $g_cbQwkSrch = GUICtrlCreateCombo("", 8, 26, 180, 17) ; start blank GUICtrlSetTip($g_cbQwkSrch, "Type to search", "QuickSearch") GUIRegisterMsg($WM_COMMAND, "__WM_COMMAND_QWKSEARCH_CMB") ;------------------------------------ ; use in Switch Loop ;~ ; QuickSearch Case $g_cbQwkSrch ConsoleWrite("221 Case $g_cbQwkSrch" & @CRLF) ;-------------------------------------- Func _QwkSrch_Edit_Changed() ConsoleWrite("41 _QwkSrch_Edit_Changed" & @CRLF) ; Autocomplete the edit _GUICtrlComboBox_AutoComplete($g_cbQwkSrch) ; Change the label to match the autocompleted edit entry EndFunc ;==>_QwkSrch_Edit_Changed Func __WM_COMMAND_QWKSEARCH_CMB($hWnd, $iMsg, $wParam, $lParam) ; GUIRegisterMsg($WM_COMMAND, "__WM_COMMAND_QWKSEARCH_CMB") ConsoleWrite("50 _WM_COMMAND_QWKSEARCH_CMB fired " & @CRLF) Local $Found = '' #forceref $hWnd, $iMsg If $lParam = GUICtrlGetHandle($g_cbQwkSrch) And BitShift($wParam, 16) = $CBN_EDITCHANGE Then ; Our combo edit content has changed ; get data from source ---------------------------- Local $datafromsource = fFindFilesForQuickSearch($stringtofind) ; datafromsource convert to Combo friendly format ; Add data to combo _GUICtrlComboBox_BeginUpdate($g_cbQwkSrch) GUICtrlSetData($g_cbQwkSrch, $Found) _GUICtrlComboBox_EndUpdate($g_cbQwkSrch) EndIf _QwkSrch_Edit_Changed() ; Action this function EndIf EndFunc ;==>_WM_COMMAND_QWKSEARCH_CMB Func fFindFilesForQuickSearch($stringtofind) ; helper function for QuickSearch ; get data here Return $aResult EndFunc ;==>fFindFilesForQuickSearch Now the following:
Can I declare the variable $g_cbQwkSrch in Global, then use in multiple functions - reassigning different combo's to it as I go along? Should GUIRegisterMsg be expressly de-registered, or does that happen automatically at GuiDelete()? Where is the best/correct place to call GUIRegisterMsg? With the creation of its control, before the GUISetState, or before the start of the loop? The Help File contains this entry, what is the intent? Must this always be called with four args, or a max of four... !!! To make the user function workable you have to define it with maximum 4 function parameters otherwise the function won't be called !!!
Best example I could find is here
The way I understand this, the standard Windows messages, such as Left/Right Click etc are covered by AutoIt macros, but the real power is locked up inside this WM_NOTIFY . I have tried, but I am not even sure I understand what I am looking at.
I need help understanding this. What I am looking for is Help file or Tutorial explaining how this works?
Perhaps if there is a script showing both the working of an AutoIt macro and the WM_NOTIFY in action, it would help.
Right now I am so lost, I do not even know what are the right questions to ask. One issue I have is on ListViews, how to combine the "Click" of a line with a standard Switch loop? Like users clicks a line, then get the loop to detect the click and ;do something ...
Hey everyone, I'm curious if there is a way to incorporate a checkbox with a combo GUICtrl?
so for instance I have a GUI that has a bunch of checkboxes that allow me to open certain programs as needed. (this is just some parsing of my code, sorry, noob here and not sure what the preferred method of displaying code is, please enlighten me)
$L0742 = GUICtrlCreateCheckbox("L07 4.2", 110, 320, 100)
$L07502 = GUICtrlCreateCheckbox("L07 5.0.2", 110, 350, 100)
$GenComm = GUICtrlCreateCheckbox("GenComm", 110, 380, 100)
$Templates = GUICtrlCreateCheckbox("Templates", 110, 410, 100)
$MCT = GUICtrlCreateCheckbox("MCT", 110, 440, 100)
$Desktop_Shortcuts = GUICtrlCreateCheckbox("Desktop Shortcuts by Tester", 110, 470, 200)
Case $msg = $RunBtn
if GUICtrlRead($L0742) = $GUI_CHECKED then Run("C:\Program Files\Varian\Paxscan\L07 Rel4.2\viva\viva.exe", "")
if GUICtrlRead($L07502) = $GUI_CHECKED then Run("C:\Program Files\Varian\Paxscan\L07 Rel5\viva\viva.exe", "")
if GUICtrlRead($GenComm) = $GUI_CHECKED then Run("\\Fpanelfs1\FPShared\Desktop_Shortcuts_by_Tester\Matt\CPI Generator\CPI Generator Windows 7 64 Bit\GenComm\GenComm.NET.exe", "")
if GUICtrlRead($Templates) = $GUI_CHECKED then ShellExecute("\\Fpanelfs1\FPProjects\Documentation Controlled\Test_Templates")
if GUICtrlRead($MCT) = $GUI_CHECKED then Run("\\Fpanelfs1\FPProjects\Documentation Controlled\Manufacturing Software\MCT\MCT.exe","")
if GUICtrlRead($Desktop_Shortcuts) = $GUI_CHECKED then ShellExecute("\\Fpanelfs1\fpshared\Desktop_Shortcuts_by_Tester")
so i click some checkboxes, and hit a run button and the programs which are checked run, great.
BUT i want to add a bunch of options under one checkbox. A combo that will list a bunch of versions of a program that can be opened. something like this... but I want that program to be part of a checkbox
$ViVAComboBox = GUICtrlCreateCombo("L01 Rel 13", 110, 320, 100)
GUICtrlSetData($ViVAComboBox, "L04|L05|L07 Rel 4.2|L07 Rel 5.0.2|L09", "L07 Rel 4.2")
is this possible? is there another GUICtrl that does this better that i am not aware of?
I created a little script we use at work for inputing date and time stamps into our ticket system.
Now I thought it would look nice in a Metro style GUI, I found an UDF on the forum what does almost everything I want.
I have but one thing I can't seem to find and don't have the skills to create.
The gui uses one pulldown menu (GUICtrlCreateCombo) it stays in the older looking style.
I attached the script and files I have, also in the zip you find an example of what I am looking for.
Hope you guys can help me