Nothing prints like the Tab key press was not captured. If i try other
keys it works. ENTER also is not captured like th TAB press.
I also tried:
self.MyGrid.Bind(wx.EVT_CHAR, self.OnPrint)
that does not work either.
if i put key = evt.GetKeyCode() it does not print any thing either.
Basically it seems to me that these 2 events do not capture a TAB
press.
Any way of capturing a TAB press or ENTER press to modify the default
behavior?
Because the tab key is used to navigate between controls it raises a
special kind of event, EVT_NAVIGATION_KEY, which you need to bind to
instead/as well .
Nothing prints like the Tab key press was not captured. If i try other
keys it works. ENTER also is not captured like th TAB press.
I also tried:
self.MyGrid.Bind(wx.EVT_CHAR, self.OnPrint)
that does not work either.
if i put key = evt.GetKeyCode() it does not print any thing either.
Basically it seems to me that these 2 events do not capture a TAB
press.
Any way of capturing a TAB press or ENTER press to modify the default
behavior?
> Nothing prints like the Tab key press was not captured. If i try other
> keys it works. ENTER also is not captured like th TAB press.
> I also tried:
> self.MyGrid.Bind(wx.EVT_CHAR, self.OnPrint)
> that does not work either.
> if i put key = evt.GetKeyCode() it does not print any thing either.
> Basically it seems to me that these 2 events do not capture a TAB
> press.
> Any way of capturing a TAB press or ENTER press to modify the default
> behavior?
> Thank you
> VC
Because the tab key is used to navigate between controls it raises a
special kind of event, EVT_NAVIGATION_KEY, which you need to bind to
instead/as well .
I have tried the wx.EVT_NAVIGATION_KEY, it only captures the tab when
i am switching between the grid and other elements in the same panel,
but not the tab keys within the grid.
Any ideas?
VC
···
On Mar 28, 9:51 am, VC <napoleon...@gmail.com> wrote:
Thank you for your answer, i will try that.
How about the Enter key, is that captured also through that?
VC
On Mar 28, 9:32 am, Gadget/Steve <GadgetSt...@live.co.uk> wrote:
> > Nothing prints like the Tab key press was not captured. If i try other
> > keys it works. ENTER also is not captured like th TAB press.
> > I also tried:
> > self.MyGrid.Bind(wx.EVT_CHAR, self.OnPrint)
> > that does not work either.
> > if i put key = evt.GetKeyCode() it does not print any thing either.
> > Basically it seems to me that these 2 events do not capture a TAB
> > press.
> > Any way of capturing a TAB press or ENTER press to modify the default
> > behavior?
> > Thank you
> > VC
> Because the tab key is used to navigate between controls it raises a
> special kind of event, EVT_NAVIGATION_KEY, which you need to bind to
> instead/as well .
What is it that you are trying to accomplish? Would it work to just let the grid handle the TAB normally and to bind your functionality to the cell selection event instead?
···
On 3/31/12 7:30 PM, VC wrote:
I have tried the wx.EVT_NAVIGATION_KEY, it only captures the tab when
i am switching between the grid and other elements in the same panel,
but not the tab keys within the grid.
I actually found the answer to my problem in another thread here in
the mailing list, where you gave the answer to another guy.
When i used a list editor, put a value and tabed after that, the grid
would lose focus and the focus will go to another element in the
panel, which was bothersome.
Also when i tab in the grid and reach the end of the columns of a
certain row and tab more the cursor would not automatically go to the
next row, 1st column, instead it stayed in place.
So the issue of the grid losing focus was fixed by assigning the panel
a style = 0.
Then i was able to capture the tab key:
self.Grid.Bind(wx.EVT_KEY_DOWN, self.OnTab)
def OnTab(self):
if evt.GetUnicodeKey() == wx.WXK_TAB:
(rest of the code)
Basically i set it up to where if the cursor is at the last column in
a row, the next tab will put it at the next row, 1st column (column
with index 0).
if at the last column of the last row it will pass.
Thank you
VC
···
On Apr 1, 1:38 pm, Robin Dunn <ro...@alldunn.com> wrote:
On 3/31/12 7:30 PM, VC wrote:
> I have tried the wx.EVT_NAVIGATION_KEY, it only captures the tab when
> i am switching between the grid and other elements in the same panel,
> but not the tab keys within the grid.
What is it that you are trying to accomplish? Would it work to just let
the grid handle the TAB normally and to bind your functionality to the
cell selection event instead?
--
Robin Dunn
Software Craftsmanhttp://wxPython.org