Topic: Combobox Open

Hi All,
I'm wondering if there is any way for a Combobox to open when you tab into the field.
Right now the user has to click on the down arrow to see what is in the combobox.
It would be nice if they didn't have to click the down arrow to see what's in the combobox.
-
Thanks, Frank

2 (edited by derek 2020-08-21 11:24:34)

Re: Combobox Open

Hello Frank,
It can be done but you need to write a small script for it.
A compromise solution (apologies if you are already aware of this) might be to set the 'searchable' property of the combobox to 'true' (see screenshot in the attachment). 
Then when you tab into the combobox, just start typing and the comobox drops down with whatever matches it finds.  And if it finds a unique value, you don't need to carry on typing - just hit 'enter' at that point.
Derek.

Post's attachments

Attachment icon cbdropdown.zip 494.26 kb, 220 downloads since 2020-08-21 

Re: Combobox Open

Derek,
Thanks for the suggestions.
Currently when I Tab into a combobox field and start typing it does go to the name I am typing, that is if it is already in the list.
The problem is that I have to know what is in the list when I start typing.  I have quite a few combobox fields in my program and even though I wrote it, I don't always remember what is in each one.
-
I'd like to see the dropdown open up when I tab into the field.  Then I can scroll down to the one I want.
-
You mentioned scripting.  That sounds OK to me, however I'm not at the skill level yet where I can write one by myself from scratch.
Maybe you can guide me on creating one?  If it's not too much of a hassle.
-
Thanks, Frank

4 (edited by derek 2020-08-22 14:27:57)

Re: Combobox Open

Hi Frank,
There is a trick that you can use that might help when you don't know the values in a dropdown.
When designing your program, rather than enter the fieldname that you want to show in the dropdown (as you normally do), insert a space and then the fieldname enclosed in curly brackets (see screenshot1 in the 'dropdownnoscript' example in the attachment). 
Now when you run the program, when you tab into the combobox you can just press the spacebar and a list of the values appears;  you can, of course, if you know the value you want, start typing in the usual way.
One other thing you would want to do is to set the 'firstemptyitem' property to 'false' (see screenshot1) otherwise, even though the list of values appears once you've pressed the spacebar, the cursor doesn't start to scroll. 
This being the case, I'd also create an empty item in the list of values for any data that might not have a droppeddown value.
If you do, nevertheless, want to do this by script, have a look at the 'dropdownwithscript' example in the attachment and shout out if anything's unclear.
Derek.

Post's attachments

Attachment icon frank comboboxes.zip 974.69 kb, 234 downloads since 2020-08-22 

Re: Combobox Open

Derek,

The Script solution you provided is exactly what I wanted. However it was a little challenge to get it working.
-
I put the modified script into my script file for the program and it didn't work at first.  After some trial and error I discovered that I needed to activate the OnEnter Event for each of the comboboxes.  I'm a total novice when it comes to using the script file. 
-
Now that I see how it works, I'm assuming that you started from the OnEnter event and then wrote the rest of the script.  It does make sense.  I just started by putting the script code into the script file.  Kinda doing it backwards.
-
Now that I know a little about scripting I can see the power in using it.
-
I decided not to use the MouseOver event because if you're moving the mouse around in the form and you happen to roll over a combobox field, it automatically opens up.  Just having it open up when I Tab into it is good for me.
-
I do have a lot of forms with quite a few comboboxes, so I've got some work ahead of me.  But that's OK because I'm learning more about MVD every day.
-
Thanks again for all the help you provide smile  Frank

6 (edited by derek 2020-08-24 09:10:54)

Re: Combobox Open

Hi Frank,
Correct, the sequence you would normally follow would be to start with the form and
1)  identify the object you want to attach an event to (form, label, edit field, combobox etc etc)
2)  decide the type of event (on show, on click, on close etc etc)
3)  'activate' the event
4)  insert whatever code you need into the empty procedure within the script.
I don't know if it helps (maybe I should have attached it in my previous post) but attached are some (amended) basic screenshots (01 - 05) and a simple example that I cobbled together a few years ago.
Derek.

Post's attachments

Attachment icon mvdscript.zip 1.08 mb, 233 downloads since 2020-08-24