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. _______________________________________________ wxruby-users mailing list wxruby-users@rubyforge.org http://rubyforge.org/mailman/listinfo/wxruby-users
On Sun, Nov 30, 2008 at 10:27 AM, Fabio Petrucci <fabio.petrucci at gmail.com>wrote:> 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 -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/wxruby-users/attachments/20081130/a5c06aee/attachment.html>
Fabio Petrucci 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
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. On Sun, Nov 30, 2008 at 11:06 AM, Alex Fenton <alex at pressure.to> wrote:> Fabio Petrucci 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 > _______________________________________________ > wxruby-users mailing list > wxruby-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/wxruby-users >-- Mario Steele http://www.trilake.net http://www.ruby-im.net http://rubyforge.org/projects/wxruby/ http://rubyforge.org/projects/wxride/ -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/wxruby-users/attachments/20081130/4097b533/attachment.html>
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 Steele <mario at ruby-im.net> 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_keypressIs ComboBox able to trigger keypress event?? On Sun, Nov 30, 2008 at 11:06 AM, Alex Fenton <alex at pressure.to> 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. -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/wxruby-users/attachments/20081201/10cc2943/attachment-0001.html>
Ok i''ve found my way: Now my ComboBox consumes ENTER and TAB keys :) 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 On Mon, Dec 1, 2008 at 12:29 AM, Fabio Petrucci <fabio.petrucci at gmail.com>wrote:> 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 Steele <mario at ruby-im.net> 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 Fenton <alex at pressure.to> 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. > >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/wxruby-users/attachments/20081201/de88debc/attachment.html>
Fabio Petrucci wrote:> Ok i''ve found my way: > > Now my ComboBox consumes ENTER and TAB keys :) > > 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::IsBackwardTry 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
-1, 1, 2, 3... [?] 0.. obvious! thank you Alex. On Mon, Dec 1, 2008 at 6:54 PM, Alex Fenton <alex at pressure.to> wrote:> Fabio Petrucci wrote: > >> Ok i''ve found my way: >> >> Now my ComboBox consumes ENTER and TAB keys :) >> >> 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 >> > > 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 > > _______________________________________________ > wxruby-users mailing list > wxruby-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/wxruby-users >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/wxruby-users/attachments/20081201/193120a2/attachment.html> -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: image/gif Size: 226 bytes Desc: not available URL: <http://rubyforge.org/pipermail/wxruby-users/attachments/20081201/193120a2/attachment.gif>