Jump to content
Sign in to follow this  

Set Combo selection

Recommended Posts

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:
;but if $default isn't already in the list, it gets added

;So I tried this:
;but it doesn't work either

;I wish this would work:
;but it clears the list

;this doesn't seem to work:
;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.

Share this post

Link to post
Share on other sites

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

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  

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...