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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Text Box To Combo Box Puzzle 1

Status
Not open for further replies.

Jackvmae

Programmer
Feb 18, 2004
17
0
0
US
On a demo application I saw a really neat trick. I'd like to incorporate it into my application, but I can't find out how it's done. I can't find the code anywhere. Can anyone explain this "puzzle?"

On a form is an ordinary text box. No drop down arrow like your typical combo box. However when you click in the text box then it turns into a combo box complete with the arrow and drop down. When you tab out of the combo box it turns into a text box again. Can anyone provide code for how this is done?

As I said, I can't find code for this anywhere in this demo application. No event procedure. No module code. No calls to a procedure or function.
Jack

 
Probably done by overlaying a text control and a combo control over the same space on a form, and playing with the visible property on the various associated OnEnter, OnExit, GotFocus, LostFocus events.

Basically, when the text box is exposed and receives the focus, an event would be triggered which exposes the combo, moves the focus to it, then makes non visible the text box. When the combo is exited, the process is reversed.


Why not give this a try; I wouldnt think it was too hard to emulate, and would be a nice little exercise in understanding a number of the form based contol's events.

Steve Lewy
Solutions Developer
steve@lewycomputing.com.au
(dont cut corners or you'll go round in circles)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top