Rodger Posted April 5, 2010 Share Posted April 5, 2010 Hello, I have the following combobox: $hPCMStatusComboBox = _GUICtrlComboBox_Create ($GUI,"", 10, 515, 300, 35) If want to disable it, I do: GUICtrlSetState(_WinAPI_GetDlgCtrlID($hPCMStatusComboBox),$GUI_DISABLE) but the combobox isn't disabled. Why isn't the combobox disabled? Thx, Rodger Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted April 5, 2010 Moderators Share Posted April 5, 2010 Rodger,It is often asking for tears at bedtime if you try and mix built-in commands (which need ControlIDs) and UDF created controls (which return handles). Use this instead - it works for me: WinSetState($hPCMStatusComboBox, "", @SW_DISABLE)M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
somdcomputerguy Posted April 5, 2010 Share Posted April 5, 2010 Do you have #Include <WinAPI.au3> at the beginning of your script? - Bruce /*somdcomputerguy */ If you change the way you look at things, the things you look at change. Link to comment Share on other sites More sharing options...
Rodger Posted April 5, 2010 Author Share Posted April 5, 2010 Rodger, It is often asking for tears at bedtime if you try and mix built-in commands (which need ControlIDs) and UDF created controls (which return handles). Use this instead - it works for me: WinSetState($hPCMStatusComboBox, "", @SW_DISABLE) M23 Thank you very much!!! It Works !! Link to comment Share on other sites More sharing options...
somdcomputerguy Posted April 5, 2010 Share Posted April 5, 2010 I was going to suggest similar to what Melba23 said, but I read in the help file that _WinAPI_GetDlgCtrlID returns an ID, that WinSetState needs. The fact that using _WinAPI_GetDlgCtrlID in this case seems irrelevant to me is beside the point though. - Bruce /*somdcomputerguy */ If you change the way you look at things, the things you look at change. Link to comment Share on other sites More sharing options...
Yoriz Posted April 5, 2010 Share Posted April 5, 2010 I've had similar problem when creating a listview from the udf that i wanted to show,hide,enable and disable. I ended up using from the following from WinAPI.au3 which gives another way of doing it using the Hwnd rather then the controlID. _WinAPI_EnableWindow($hWnd, False) ; Disabled _WinAPI_EnableWindow($hWnd, True) ; Enabled _WinAPI_ShowWindow($hWnd, @SW_HIDE) ; Hiden _WinAPI_ShowWindow($hWnd, @SW_SHOW) ; Shown GDIPlusDispose - A modified version of GDIPlus that auto disposes of its own objects before shutdown of the Dll using the same function Syntax as the original.EzMySql UDF - Use MySql Databases with autoit with syntax similar to SQLite UDF. Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted April 5, 2010 Moderators Share Posted April 5, 2010 snowmaker,When the UDF creates the combo, it allocates a CtrID using the UDFGlobalID.au3 include file. This number is allocated by Windows and is very different from the internal ControlID used by AutoIt to identify its own controls - as you can see here:#include <GUIConstantsEx.au3> #Include <GuiComboBox.au3> #include <WinAPI.au3> $hGUI = GUICreate("Test", 500, 500) $hDummy = GUICtrlCreateDummy() ConsoleWrite("AutoIt ControlID: " & $hDummy & @CRLF) $hCombo = _GUICtrlComboBox_Create($hGUI, "", 10, 10, 200, 20) $iCtrlID = _WinAPI_GetDlgCtrlID($hCombo) ConsoleWrite("UDF CtrlID: " & $iCtrlID & @CRLF) GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit EndSwitch WEndSo using the returned CtrlID value is useless in a built-in command which expects an AutoIt ControlID.Gets confusing sometimes, doesn't it. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
iresolver Posted April 18, 2015 Share Posted April 18, 2015 can you disable an item listed in the combo box? 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