Data entry into ComboBox

A

al jones

Okay, I'm probably re-inventing the wheel here, but I have two drop down
boxs on a form. One is "source" the other "destination", I'm using a
combobox each to provide MRU utility.

The setting I've changed are:
AutoCompleteMode -> SuggestAppend
AutocompleteSource -> FileSystemDirectory
Drop[DownStyle -> Drop Down
Sorted -> True

I populate the cbo at form load time (well, I would if I had anything with
which to populate it!)

I also have a browse button which sets cbo.text.

I'm having two problems and obviously (as always) don't know what I'm
looking for.

What event(s) are fired when I change the cbo.text - as when I insert it
from the folderbrowserdialogue (need to update the MRU list).
- and -
What event is fired when the user manually enters something and presses
return. I'm seeing nothing ....

If you can tell me how to tell what event is being fired, that would be
even better.

Thanks //al
 
L

lord.zoltar

al said:
Okay, I'm probably re-inventing the wheel here, but I have two drop down
boxs on a form. One is "source" the other "destination", I'm using a
combobox each to provide MRU utility.

The setting I've changed are:
AutoCompleteMode -> SuggestAppend
AutocompleteSource -> FileSystemDirectory
Drop[DownStyle -> Drop Down
Sorted -> True

I populate the cbo at form load time (well, I would if I had anything with
which to populate it!)

I also have a browse button which sets cbo.text.

I'm having two problems and obviously (as always) don't know what I'm
looking for.

What event(s) are fired when I change the cbo.text - as when I insert it
from the folderbrowserdialogue (need to update the MRU list).
- and -
What event is fired when the user manually enters something and presses
return. I'm seeing nothing ....

If you can tell me how to tell what event is being fired, that would be
even better.

Thanks //al

When the text in a combo box changes, there is a TextChagned event ;)
when the user changes the selected item, there is a SelectedItemChanged
event.
 
A

al jones

al said:
Okay, I'm probably re-inventing the wheel here, but I have two drop down
boxs on a form. One is "source" the other "destination", I'm using a
combobox each to provide MRU utility.

The setting I've changed are:
AutoCompleteMode -> SuggestAppend
AutocompleteSource -> FileSystemDirectory
Drop[DownStyle -> Drop Down
Sorted -> True

I populate the cbo at form load time (well, I would if I had anything with
which to populate it!)

I also have a browse button which sets cbo.text.

I'm having two problems and obviously (as always) don't know what I'm
looking for.

What event(s) are fired when I change the cbo.text - as when I insert it
from the folderbrowserdialogue (need to update the MRU list).
- and -
What event is fired when the user manually enters something and presses
return. I'm seeing nothing ....

If you can tell me how to tell what event is being fired, that would be
even better.

Thanks //al

When the text in a combo box changes, there is a TextChagned event ;)
when the user changes the selected item, there is a SelectedItemChanged
event.

Oh, I see, I just had it spelled wrong :)

I've been this round. What I'm seeing is TextChanged is being triggered
with each character entered (or suggestion accepted) [which I can
understand as one might want to do something as each character is
entered...] What I'm now seeing in my mru is "D", "D:", "D:\", etc, not
exactly what I had in mind. However, what I want is to trigger <something>
when they press enter after all the path / folder name has been entered.

I thought that cbox.SelectionChangeCommitted would be invoked - but even
with a breakpoint on the first line, I don't see it getting fired. Any
ideas what I'm missing here?

.... and I'd really appreciate it if your reply wasn't 'stop wanting that!'
:)

//al
 
L

lord.zoltar

al said:
Oh, I see, I just had it spelled wrong :)

I've been this round. What I'm seeing is TextChanged is being triggered
with each character entered (or suggestion accepted) [which I can
understand as one might want to do something as each character is
entered...] What I'm now seeing in my mru is "D", "D:", "D:\", etc, not
exactly what I had in mind. However, what I want is to trigger <something>
when they press enter after all the path / folder name has been entered.

I thought that cbox.SelectionChangeCommitted would be invoked - but even
with a breakpoint on the first line, I don't see it getting fired. Any
ideas what I'm missing here?

... and I'd really appreciate it if your reply wasn't 'stop wanting that!'
:)

I just checked, it lookes like the TextChanged event doesn't have any
way of telling you which key was pressed (which makes sense, because
TextChanged can occur due to non-keyboard input). You could listen to
the KeyDown or KeyPress events, because those WILL tell you which key
was pressed (e.keycode or something like that, I forget exactly ;) ).
I don't know if "Enter" key will be a problem or not... it might
trigger other behaviour, but I doubt it.
 
A

al jones

Refreshing this topic a little. If I change the exit to cbox1.leave then
it depends on the user to use the mouse (or tab) to go to some other box.
I find it hard to believe that MS doesn't have the enter key enabled there
so I'd guess that I'm just missing something.

Now, how do I tell which item they've selected if they select an item from
the dropdown. Reson being, once they've selected / entered / browsed to
the item, then moved out of the cbobox, I'm not displaying anything in the
text area of the combobox ....

//al
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top