blindwig Posted April 26, 2005 Share Posted April 26, 2005 I can't seem to figure out how to set a combobox selection. Say I create a combo referenced as $combo using GUICtrlCreateCombo. ;this works: GUICtrlSetData($combo,$default,$default) ;but if $default isn't already in the list, it gets added ;So I tried this: GUICtrlSetData($combo,GUICtrlRead($combo),$default) ;but it doesn't work either ;I wish this would work: GUICtrlSetData($combo,'',$default) ;but it clears the list ;this doesn't seem to work: ControlCommand('','',$combo,'SetCurrentSelection',$default) ;it just returns 1 no matter what I need to set the default to a string, but I don't know if that string is already in there or not. I don't want to add it if it isn't. I can't figure out how to check the list. I try using ControlCommand, but it returns 1 regardless. My UDF Threads:Pseudo-Hash: Binary Trees, Flat TablesFiles: Filter by Attribute, Tree List, Recursive Find, Recursive Folders Size, exported to XMLArrays: Nested, Pull Common Elements, Display 2dSystem: Expand Environment Strings, List Drives, List USB DrivesMisc: Multi-Layer Progress Bars, Binary FlagsStrings: Find Char(s) in String, Find String in SetOther UDF Threads I Participated:Base64 Conversions Link to comment Share on other sites More sharing options...
therks Posted April 27, 2005 Share Posted April 27, 2005 (edited) Big correction...Have a look at some of the UDF's in the latest beta.Specifically _GUICtrlComboBoxSelectString (currently mispelled as _GUICtrlCombBoxSelectString).Or if you don't want the UDF, here's the guts of the function done up for your purposes:Dim Const $CB_SELECTSTRING = 0x14D GUICtrlSendMsg($combo, $CB_SELECTSTRING, 1, $default)I think that should do it. Edited April 27, 2005 by Saunders My AutoIt Stuff | My Github Link to comment Share on other sites More sharing options...
blindwig Posted April 27, 2005 Author Share Posted April 27, 2005 sweet, thanks My UDF Threads:Pseudo-Hash: Binary Trees, Flat TablesFiles: Filter by Attribute, Tree List, Recursive Find, Recursive Folders Size, exported to XMLArrays: Nested, Pull Common Elements, Display 2dSystem: Expand Environment Strings, List Drives, List USB DrivesMisc: Multi-Layer Progress Bars, Binary FlagsStrings: Find Char(s) in String, Find String in SetOther UDF Threads I Participated:Base64 Conversions 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