marko001 Posted October 18, 2012 Share Posted October 18, 2012 (edited) Hi all, I used to work with guictrlcreatecombo, but since I couldn't find a way to erase content I decided to move to EX UDF. I have 3 combos I need to manage: $combo1 = _GUICtrlComboBoxEx_Create($Form1,"",8,48,145,100) $addhouse = GUICtrlCreateButton("Add/Edit House(s)", 11, 80, 139, 25) $Combo2 = _GUICtrlComboBoxEx_Create($Form1,"", 160, 48, 145, 25) $Button2 = GUICtrlCreateButton("Add Room", 160, 80, 67, 25) $Combo3 = _GUICtrlComboBoxEx_Create($Form1,"", 312, 48, 145, 25)Combo contents are read from a .txt file:While 1 Local $line = FileReadLine($file) If @error = -1 Then $begin = 1 Return $var EndIf If Not FileExists($rooms_dir & $line & ".rooms.txt") Then _FileCreate($rooms_dir & $line & ".rooms.txt") _GUICtrlComboBoxEx_AddString($combo1,$line) $var = 1WEnd Edited October 18, 2012 by marko001 Link to comment Share on other sites More sharing options...
FireFox Posted October 18, 2012 Share Posted October 18, 2012 Hi, And the question is? unable to retrieve "when pressed" < Can you be more specific ? Br, FireFox. Link to comment Share on other sites More sharing options...
guinness Posted October 18, 2012 Share Posted October 18, 2012 (edited) You can use the _GUICtrlComboBox_Functions with GUICtrlCreateCombo! Local $iCombo = GUICtrlCreateCombo(.... _GUICtrlComboBox_ResetContent($iCombo) Edited October 18, 2012 by guinness UDF List: _AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples... Updated: 22/04/2018 Link to comment Share on other sites More sharing options...
marko001 Posted October 18, 2012 Author Share Posted October 18, 2012 Wait, I had internet connection problem so I lost part of the message. Hi all I used to work with guictrlcreatecombo, but since I couldn't find a way to erase content I decided to move to EX UDF. I have 3 combos I need to manage: $;combo1 = _GUICtrlComboBoxEx_Create($Form1,"",8,48,145,100) $addhouse = GUICtrlCreateButton("Add/Edit House(s)", 11, 80, 139, 25) $Combo2 = _GUICtrlComboBoxEx_Create($Form1,"", 160, 48, 145, 25) $Button2 = GUICtrlCreateButton("Add Room", 160, 80, 67, 25) $Combo3 = _GUICtrlComboBoxEx_Create($Form1,"", 312, 48, 145, 25) Combo contents are read from a .txt file: While 1 Local $line = FileReadLine($file) If @error = -1 Then $begin = 1 Return $var EndIf If Not FileExists($rooms_dir & $line & ".rooms.txt") Then _FileCreate($rooms_dir & $line & ".rooms.txt") _GUICtrlComboBoxEx_AddString($combo1,$line) $var = 1 WEnd 1st question: is there a way to GUIDISABLE $combo2? I mean I need it to be unusable unless $combo1 has values inside. Then I need, as I did with simple combobox, to manage further activities when combobox is clicked and a value is selected. Im standard ways I used: Case $Combo1 If _checkitemsinroom($rooms_dir & GUICtrlRead($Combo1) & ".rooms.txt") = 0 Then ConsoleWrite(GUICtrlRead($Combo1) & ".rooms.txt" & " - VUOTO" & @CRLF) GUICtrlSetState($Combo2, $GUI_DISABLE) GUICtrlSetData($Combo2, "None") Else GUICtrlSetState($Combo2, $gui_enable) EndIf but now it doesn't work. I tried also with WM_NOTIFY expandcollapse popupFunc WM_NOTIFY($hWnd, $iMsg, $iwParam, $ilParam) #forceref $hWnd, $iMsg, $iwParam Local $hWndFrom, $iIDFrom, $iCode, $tNMHDR, $tInfo $tNMHDR = DllStructCreate($tagNMHDR, $ilParam) $hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom")) $iIDFrom = DllStructGetData($tNMHDR, "IDFrom") $iCode = DllStructGetData($tNMHDR, "Code") Switch $hWndFrom Case $combo1 Switch $iCode Case $CBEN_BEGINEDIT ; Sent when the user activates the drop-down list or clicks in the control's edit box. _DebugPrint("$CBEN_BEGINEDIT" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _ "-->IDFrom:" & @TAB & $iIDFrom & @LF & _ "-->Code:" & @TAB & $iCode) Return 0 Case $CBEN_DELETEITEM _DebugPrint("$CBEN_DELETEITEM" & _GetComboBoxEx($ilParam)) Return 0 Case $CBEN_DRAGBEGINA, $CBEN_DRAGBEGINW MsgBox(0,"","ORA?!") $tInfo = DllStructCreate($tagNMCBEDRAGBEGIN, $ilParam) If DllStructGetData($tInfo, "ItemID") Then _DebugPrint("$CBEN_DRAGBEGIN" & _GetComboBoxEx($ilParam)) _DebugPrint("$CBEN_DRAGBEGIN" & @LF & "--> hWndFrom:" & @TAB & DllStructGetData($tInfo, "hWndFrom") & @LF & _ "-->IDFrom:" & @TAB & DllStructGetData($tInfo, "IDFrom") & @LF & _ "-->Code:" & @TAB & DllStructGetData($tInfo, "Code") & @LF & _ "-->ItemID:" & @TAB & DllStructGetData($tInfo, "ItemID") & @LF & _ "-->Text:" & @TAB & DllStructGetData($tInfo, "Text")) MsgBox(0,"","ORA?!") ; return is ignored Case $CBEN_ENDEDITA, $CBEN_ENDEDITW ; Sent when the user has concluded an operation within the edit box or has selected an item from the control's drop-down list. $tInfo = DllStructCreate($tagNMCBEENDEDIT, $ilParam) _DebugPrint("$CBEN_ENDEDIT" & @LF & "--> hWndFrom:" & @TAB & DllStructGetData($tInfo, "hWndFrom") & @LF & _ "-->IDFrom:" & @TAB & DllStructGetData($tInfo, "IDFrom") & @LF & _ "-->Code:" & @TAB & DllStructGetData($tInfo, "Code") & @LF & _ "-->fChanged:" & @TAB & DllStructGetData($tInfo, "fChanged") & @LF & _ "-->NewSelection:" & @TAB & DllStructGetData($tInfo, "NewSelection") & @LF & _ "-->Text:" & @TAB & DllStructGetData($tInfo, "Text") & @LF & _ "-->Why:" & @TAB & DllStructGetData($tInfo, "Why")) Return False ; accept the notification and allow the control to display the selected item ;~ Return True ; otherwise Case $CBEN_GETDISPINFOA, $CBEN_GETDISPINFOW ; Sent to retrieve display information about a callback item _DebugPrint("$CBEN_GETDISPINFO" & _GetComboBoxEx($ilParam)) Return 0 Case $CBEN_INSERTITEM $tInfo = DllStructCreate($tagNMCOMBOBOXEX, $ilParam) Local $tBuffer = DllStructCreate("wchar Text[" & DllStructGetData($tInfo, "TextMax") & "]", DllStructGetData($tInfo, "Text")) _DebugPrint("$CBEN_INSERTITEM" & @LF & "--> hWndFrom:" & @TAB & DllStructGetData($tInfo, "hWndFrom") & @LF & _ "-->IDFrom:" & @TAB & DllStructGetData($tInfo, "IDFrom") & @LF & _ "-->Code:" & @TAB & DllStructGetData($tInfo, "Code") & @LF & _ "-->Mask:" & @TAB & DllStructGetData($tInfo, "Mask") & @LF & _ "-->Item:" & @TAB & DllStructGetData($tInfo, "Item") & @LF & _ "-->Text:" & @TAB & DllStructGetData($tBuffer, "Text") & @LF & _ "-->TextMax:" & @TAB & DllStructGetData($tInfo, "TextMax") & @LF & _ "-->Indent:" & @TAB & DllStructGetData($tInfo, "Indent") & @LF & _ "-->Image:" & @TAB & DllStructGetData($tInfo, "Image") & @LF & _ "-->SelectedImage:" & @TAB & DllStructGetData($tInfo, "SelectedImage") & @LF & _ "-->OverlayImage:" & @TAB & DllStructGetData($tInfo, "OverlayImage") & @LF & _ "-->Param:" & @TAB & DllStructGetData($tInfo, "Param")) MsgBox(0,"","ORA?!") Return 0 EndSwitch $readcomboc = _GUICtrlComboBoxEx_GetCurSel($Combo1) switch $readComboC case $combo2 Case $combo3 EndSwitch EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>WM_NOTIFY But didn't find a way. How can it be done? Thanks and best regards, Marco Link to comment Share on other sites More sharing options...
guinness Posted October 18, 2012 Share Posted October 18, 2012 _GUICtrlComboBox not _GUICtrlComboBoxEx can be used with native AutoIt controls. UDF List: _AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples... Updated: 22/04/2018 Link to comment Share on other sites More sharing options...
marko001 Posted October 18, 2012 Author Share Posted October 18, 2012 I changed to it, but how can I Case $combo1 ... .... ? I see that it works with standard combo not with it. I need the next action to be performed when a value in the 1st combo has been selected. Thanks mate, Marco Link to comment Share on other sites More sharing options...
FireFox Posted October 18, 2012 Share Posted October 18, 2012 (edited) A simple example : #include <GUIConstantsEx.au3> #region GUI Global $GUI, $coToto1 $GUI = GUICreate("MyGUI") $coToto1 = GUICtrlCreateCombo("", 10, 10) GUICtrlSetData($coToto1, "val1|val2|val3") GUISetState() #endregion While 1 $iMsg = GUIGetMsg() Switch $iMsg Case $GUI_EVENT_CLOSE _Exit() Case $coToto1 _toto1() EndSwitch Sleep(50) WEnd Func _toto1() Switch GUICtrlRead($coToto1) Case "val1" ConsoleWrite("got it!" & @CrLf) EndSwitch EndFunc Func _Exit() Exit EndFunc You can do it in many other ways. Br, FireFox. Edited October 18, 2012 by FireFox Link to comment Share on other sites More sharing options...
marko001 Posted October 18, 2012 Author Share Posted October 18, 2012 Yeah, got it. Thanks a lot Firefox.Solved - [Thread closed] Link to comment Share on other sites More sharing options...
FireFox Posted October 18, 2012 Share Posted October 18, 2012 Yeah, got it. Thanks a lot Firefox. Solved - [Thread closed] No problem The most efficient way is to put [sOLVED] in the topic title. Br, FireFox. 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