Jump to content
Sign in to follow this  
NSearch

GUI Combo Box

Recommended Posts

NSearch

I have a GUI which allows the user to choose what state they want, but I would like them to be able to use just the keyboard to select the variable, instead of clicking on the combo box value. This is what I am currently using:

$Label_15 = GuiCtrlCreateLabel("State:", 30, 380, 140, 20)
$state = GuiCtrlCreateCombo("", 30, 400, 80, 21)
GUICtrlSetData(-1,"Alabama|Alaska|Arizona|Arkansas|California|Colorado|Connecticut|District of Columbia|Delaware|Florida|Georgia|Hawaii|Idaho|Illinois|Indiana|Iowa|Kansas|Kentucky|Louisiana|Maine

|Maryland|Massachusetts|Michigan|Minnesota|Mississippi|Missouri|Montana|Nebraska|Nevada|New Hampshire|New Jersey|New Mexico|New York|North Carolina|North Dakota|Ohio|Oklahoma|Oregon|Pennsylvania|Rhode Island|South Carolina|South Dakota|Tennessee|Texas|Utah|Vermont|Virginia|Washington|West Virginia|Wisconsin|Wyoming","")

What I am hoping for is when the user tabs to the combo box, they can hit the i key and it jumps to Idaho, hit i again and it jumps to Illinois....etc.

Thanks.

Share this post


Link to post
Share on other sites
CyberSlug

#include <GuiConstants.au3>

GuiCreate("foo", 800, 600)
$Label_15 = GuiCtrlCreateLabel("State:", 30, 380, 140, 20)

; IMPORANT:  Height of box is height of the drop down list on Windows XP
$state = GuiCtrlCreateCombo("", 30, 400, 80, 199, $CBS_DROPDOWNLIST)
GUICtrlSetData(-1,"Alabama|Alaska|Arizona|Arkansas|California|Colorado|Connecticut|District of Columbia|Delaware|Florida|Georgia|Hawaii|Idaho|Illinois|Indiana|Iowa|Kansas|Kentucky|Louisiana|Maine

|Maryland|Massachusetts|Michigan|Minnesota|Mississippi|Missouri|Montana|Nebraska|Nevada|New Hampshire|New Jersey|New Mexico|New York|North Carolina|North Dakota|Ohio|Oklahoma|Oregon|Pennsylvania|Rhode Island|South Carolina|South Dakota|Tennessee|Texas|Utah|Vermont|Virginia|Washington|West Virginia|Wisconsin|Wyoming","Alabama")

GuiSetState()
While GuiGetMsg() <> $GUI_EVENT_CLOSE
Wend


Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig!

Share this post


Link to post
Share on other sites
ChrisL

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.