Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Keep combobox dropdown dropped down (expanded) 1

Status
Not open for further replies.

FancyPrairie

Programmer
Oct 16, 2001
2,917
US
When the combobox gets focus, I issue the dropdown command. This works fine. However, when the user selects an item from the combobox, the combobox closes back up. I want it to stay expanded until it loses focus.

How do I do that?
 
I thought about that, but I need a combobox.

What I'm trying to do is to create a dual list box, where when the user double clicks on an item in listbox1, the item selected is moved to listbox2. And visa-versa. However, in order to try to conserve space on my form (because I have several of these) and because the listbox may have serveral 100 items it and I don't want the user to have to scroll through them to find the one they want (because the list box only accepts the first char entered), I would like to use a combobox.

Now, I can open the combobox (cbo.dropdown) when it receives focus. But as soon as I click on an item, the combobox closes. In the OnClick event of the combobox, I have tried setting focus to another control who, in turn, returns focus back to the combobox in hopes that the GotFocus event of the combobox gets fired again. But it doesn't work.

Any ideas?
 
Howdy FancyPrairie . . .

You can make use of the forms [blue]On Timer[/blue] event for this. The problem is the combo's [blue]After Update[/blue] event needs a tiny finite amount of time to complete ... [red](it has to complete! the reason for the timer!)[/red] ... and you run your back & forth code from the [blue]On Timer[/blue] event! [thumbsup2] Example:

The combo's [blue]After Update[/blue] event would look like:
Code:
[blue]   Me.TimerInterval = 1[/blue]
The [blue]On Timer[/blue] event would look like:
Code:
[blue]   Me![purple][B][I]ComboboxName[/I][/B][/purple].Dropdown
   
   [green]'Your Back & Forth Code Here![/green]
   
   Me.TimerInterval = 0 [green]'Turn timer off[/green][/blue]
Note: you don't need any [blue]On Exit[/blue] or [blue]On Lost Focus[/blue] events for this, so disable them to prevent interaction. Do keep your [blue]On Got Focus[/blue] though.

Thats it ... perform your testing.

[blue]Your Thoughts? . . .[/blue]

See Ya! . . . . . .

Be sure to see thread181-473997 [blue]Worthy Reading![/blue] [thumbsup2]
Also faq181-2886 [blue]Worthy Reading![/blue] [thumbsup2]
 
Woooah!

Also diasble or remove the code in the combo's [blue]On Click[/blue] event. [blue]After Update[/blue] is the trigger here . . .

See Ya! . . . . . .

Be sure to see thread181-473997 [blue]Worthy Reading![/blue] [thumbsup2]
Also faq181-2886 [blue]Worthy Reading![/blue] [thumbsup2]
 
Thanks Aceman. I just got finished trying that when I got your notice. That was the only I could make it work.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top