Jump to content
Sign in to follow this  
marko001

[SOLVED] - _GUICtrlComboBoxEx unable to retrieve "when pressed"

Recommended Posts

marko001

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 by marko001

Share this post


Link to post
Share on other sites
FireFox

Hi,

And the question is?

unable to retrieve "when pressed" < Can you be more specific ?

Br, FireFox.


 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

Share this post


Link to post
Share on other sites
guinness

You can use the _GUICtrlComboBox_Functions with GUICtrlCreateCombo!

Local $iCombo = GUICtrlCreateCombo(....
_GUICtrlComboBox_ResetContent($iCombo)
Edited 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 parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 22/04/2018

Share this post


Link to post
Share on other sites
marko001

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&#39;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(&#036;Form1,&quot;&quot;,8,48,145,100)
$addhouse = GUICtrlCreateButton(&quot;Add/Edit House(s)&quot;, 11, 80, 139, 25)
$Combo2 = _GUICtrlComboBoxEx_Create(&#036;Form1,&quot;&quot;, 160, 48, 145, 25)
$Button2 = GUICtrlCreateButton(&quot;Add Room&quot;, 160, 80, 67, 25)
$Combo3 = _GUICtrlComboBoxEx_Create(&#036;Form1,&quot;&quot;, 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

Func 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

Share this post


Link to post
Share on other sites
guinness

_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 parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 22/04/2018

Share this post


Link to post
Share on other sites
marko001

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

Share this post


Link to post
Share on other sites
FireFox

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 by FireFox

 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

Share this post


Link to post
Share on other sites
marko001

Yeah, got it. Thanks a lot Firefox.

Solved - [Thread closed]

Share this post


Link to post
Share on other sites
FireFox

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.


 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

Share this post


Link to post
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
Sign in to follow this  

×