wxComboBox and wxTE_PROCESS_ENTER


#1

Hi all,

i am trying to use wxComboBox (instead of wxChoice) to capture
wxTE_PROCESS_ENTER event.

If i enable TE_PROCESS_ENTER flag on the resulting xrc file, i get an
‘Unknown style flag wxTE_PROCESS_ENTER’ on app loading.

Probably wxComboBox doesn’t reconize this kind of event.

How do i catch this event for the wxComboBox widget?

Thank you all.

bio.


#2

On Sun, Nov 30, 2008 at 10:27 AM, Fabio P.
removed_email_address@domain.invalidwrote:

Hi all,

i am trying to use wxComboBox (instead of wxChoice) to capture
wxTE_PROCESS_ENTER event.

If i enable TE_PROCESS_ENTER flag on the resulting xrc file, i get an
‘Unknown style flag wxTE_PROCESS_ENTER’ on app loading.

Probably wxComboBox doesn’t reconize this kind of event.

How do i catch this event for the wxComboBox widget?

Thank you all.

bio.

Wx::TE_PROCESS_ENTER can be set programmatically by
window#toggle_window_style(Wx::TE_PROCESS_ENTER)

…now it works, but enabling this flag, the widget loose TAB controls
(TAB
/ SHIFT+TAB)

To try it out, on the ‘BigDemo -> wxComboBox’ example if i add this flag

on line 23:

cb = Wx::ComboBox.new(self, 500, “default value”, Wx::Point.new(90,50),
Wx::DEFAULT_SIZE,
sampleList,
Wx::CB_DROPDOWN|Wx::TE_PROCESS_ENTER)

i get the enter event but no tabbing is possible.

Is it a bug?

Thank you for your help.

bio


#3

The problem lies in the fact, that Wx::ComboBox has a Drop down, and a
Text
Edit in it. I believe that Fabio wants the Enter event, so that he can
add
what a person enters into the Drop Down, if I am understanding
correctly.
The best thing to do, is to monitor evt_keypress, and create a new item,
and
update that item in the combo box, as the person types stuff into it.
Either that, or monitor on focus lost, and check to see if the item is
in
the combo box, if not, add it. Though, that can lead to it’s own
problems,
as a person could switch between the controls several times, and have
several items added if he changes the text each and every time he tabs
between the controls.

Just a couple of suggestions on how to work around it.


#4

Fabio P. wrote:

Wx::TE_PROCESS_ENTER can be set programmatically by
window#toggle_window_style(Wx::TE_PROCESS_ENTER)

…now it works, but enabling this flag, the widget loose TAB controls
(TAB / SHIFT+TAB)

The fact that setting this style when the control is created suggests to
me that it’s not really meant to work like that, and I don’t understand
what you’re trying to do here. Why do you want a ComboBox that processes
ENTER?

cb = Wx::ComboBox.new(self, 500, “default value”,
Wx::Point.new(90,50), Wx::DEFAULT_SIZE,
sampleList,
Wx::CB_DROPDOWN|Wx::TE_PROCESS_ENTER)

i get the enter event but no tabbing is possible.

Is it a bug?

I don’t know. I expect if the control is told to consume ENTER, it also
consumes TAB.

alex


#5

Hi Alex & Mario,

i am working on an invoice form, where the user should be able to fill
fields using mainly tab, numeric keys and confirm by enter on every
field
he’s working on. The basic reason for that, is the user should only type
on
the keyboard avoiding as much as possible using mouse for speed reason.

On Sun, Nov 30, 2008 at 7:11 PM, Mario S. removed_email_address@domain.invalid wrote:

The problem lies in the fact, that Wx::ComboBox has a Drop down, and a Text
Edit in it.

right.

I believe that Fabio wants the Enter event, so that he can add what a
person enters into the Drop Down, if I am understanding correctly.

Basically i use Enter to validate user input

The best thing to do, is to monitor evt_keypress

Is ComboBox able to trigger keypress event??

On Sun, Nov 30, 2008 at 11:06 AM, Alex F. removed_email_address@domain.invalid wrote:

Fabio Petrucc
The fact that setting this style when the control is created suggests to
me that it’s not really meant to work like that, and I don’t understand
what you’re trying to do here. Why do you want a ComboBox that processes
ENTER?

The above user inserts hundreds of products a day and he knows exactly
what
vat code to use for that kind of product, without having to choose from
a
dropdown menu. The ENTER is to confirm what he typed.

ComboBox let you do that quite well standardizing behaviour between
fields.

I don’t know. I expect if the control is told to consume ENTER, it also
consumes TAB.

Unfortunately, on ComboBox, if you enable enter you loose the
opportunity to
use the tab

thank you both.

bio.


#6

Ok i’ve found my way:

Now my ComboBox consumes ENTER and TAB keys :slight_smile:

One more question:

I use window#navigate() to simulate TAB.
calling it by default param is fine even if it doesn’t reconize the
mapping
constant Wx::NavigationKeyEvent::IsForward

what about if i’d like to navigate backward?

i supposed a constant like Wx::NavigationKeyEvent::IsBackward

but i get an uninitialized constant
Wxruby2::Wx::NavigationKeyEvent::IsBackward

any suggestion?

regards.

bio


#7

Fabio P. wrote:

what about if i’d like to navigate backward?

i supposed a constant like Wx::NavigationKeyEvent::IsBackward

but i get an uninitialized constant
Wxruby2::Wx::NavigationKeyEvent::IsBackward

Try using the following values to indicate backwards and forwards to
Window#navigate (never even knew about that method until today…)

IsBackward = 0
IsForward = 1

alex


#8

wxruby-users mailing list
removed_email_address@domain.invalid
http://rubyforge.org/mailman/listinfo/wxruby-users