AcceptsFocusFromKeyboard

Hi List

I need to modify metodo “AcceptsFocusFromKeyboard” of the control “radiobutton”. I want that it does not have focus from the keyboard, as I can change it?

Thanks

Sorry my English bad.,

Mary Dinora Guevara wrote:

Hi List
I need to modify metodo "AcceptsFocusFromKeyboard" of the control "radiobutton". I want that it does not have focus from the keyboard, as I can change it?

Sorry, AcceptsFocusFromKeyboard is not overridable from wxPython. What you could try instead is to bind the EVT_SET_FOCUS event and then send a navigate event to cause the focus to move to the next control. Something like this should do it, although you may want to try and sense whether focus is moving forward or backward and then pass the appropriate flags to Navigate:

  def OnSetFocus(self, evt):
    self.Navigate()

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!

Thanks for the quick answer, but my problem continues, first WxPython gives an error me and the program is closed and in second case which I want it is that it does not accept the focus from the keyboard, but if doing click with mouse. I hope you can help me, Thanks

error.bmp (322 KB)

···

----- Original Message -----

From:
Robin Dunn

To: wxPython-users@lists.wxwidgets.org

Sent: Thursday, May 11, 2006 9:41 PM

Subject: Re: [wxPython-users] AcceptsFocusFromKeyboard

Mary Dinora Guevara wrote:

Hi List
I need to modify metodo “AcceptsFocusFromKeyboard” of the control
“radiobutton”. I want that it does not have focus from the keyboard, as
I can change it?

Sorry, AcceptsFocusFromKeyboard is not overridable from wxPython. What
you could try instead is to bind the EVT_SET_FOCUS event and then send a
navigate event to cause the focus to move to the next control.
Something like this should do it, although you may want to try and sense
whether focus is moving forward or backward and then pass the
appropriate flags to Navigate:

def OnSetFocus(self, evt):
self.Navigate()


Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!


To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwidgets.org
For additional commands, e-mail: wxPython-users-help@lists.wxwidgets.org

Mary Dinora Guevara wrote:

Thanks for the quick answer, but my problem continues, first WxPython gives an error me and the program is closed and in second case which I want it is that it does not accept the focus from the keyboard, but if doing click with mouse. I hope you can help me, Thanks

Please make a small runnable sample that shows the problem so we can more easily diagnose it.

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!

H I will be away for 3 weeks- how can i unregister or pause delivery?
ThanX

···

--
Best regards,
the_shelter mailto:pdftex@the-shelter.de

Hi Robin,

Annexed I am sending the code and xrc to you of the program where I have the problem:

1.-Set order of tabulation with the controls ’ Unknown’ although works with the GetParent, but not like using it with the TextCtrl.

2.-I want that ’ radiobutton’ does not accept the focus of the keyboard, but if doing click with mouse.

I hope that you can help me and excuses my English badly.

gui_prueba.py (4.01 KB)

prueba2.xrc (8.12 KB)

···

----- Original Message -----

From:
Robin Dunn

To: wxPython-users@lists.wxwidgets.org

Sent: Friday, May 12, 2006 2:58 PM

Subject: Re: [wxPython-users] AcceptsFocusFromKeyboard

Mary Dinora Guevara wrote:

Thanks for the quick answer, but my problem continues, first WxPython
gives an error me and the program is closed and in second case which I
want it is that it does not accept the focus from the keyboard, but if
doing click with mouse. I hope you can help me, Thanks

Please make a small runnable sample that shows the problem so we can
more easily diagnose it.


Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!


To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwidgets.org
For additional commands, e-mail: wxPython-users-help@lists.wxwidgets.org

Mary Dinora Guevara wrote:

Hi Robin,
Annexed I am sending the code and xrc to you of the program where I have the problem:
1.-Set order of tabulation with the controls ' Unknown' although works with the GetParent, but not like using it with the TextCtrl.

Because the textctrl's parent is the panel, so it is a sibling of the unknown control's parent. You probably could handle this by checking the the control's parent is self, and if it is then use the control, otherwise use the parent. When you sort that out for both controls, then you can do the MoveAfterInTabOrder.

2.-I want that ' radiobutton' does not accept the focus of the keyboard, but if doing click with mouse.

I'm getting an error in the masked edit code so I can't run your sample, but I think the way I would approach it is to handle the focus events like we talked about before, and also catch the mouse events for the radio button and handle toggling the state of the radio button in the mouse event handlers. So basically it would never get the focus, but you can still set or clear the items with the mouse.

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!

Thanks for all your answers, and Excuse the annoyance, but you could show an example to me to cause that a control does not have the focus from the keyboard, but if with mouse? It is that not like doing it. Thanks

···

----- Original Message -----

From:
Robin Dunn

To: wxPython-users@lists.wxwidgets.org

Sent: Wednesday, May 17, 2006 3:14 AM

Subject: Re: [wxPython-users] AcceptsFocusFromKeyboard

Mary Dinora Guevara wrote:

Hi Robin,
Annexed I am sending the code and xrc to you of the program where I have
the problem:
1.-Set order of tabulation with the controls ’ Unknown’ although works
with the GetParent, but not like using it with the TextCtrl.

Because the textctrl’s parent is the panel, so it is a sibling of the
unknown control’s parent. You probably could handle this by checking
the the control’s parent is self, and if it is then use the control,
otherwise use the parent. When you sort that out for both controls,
then you can do the MoveAfterInTabOrder.

2.-I want that ’ radiobutton’ does not accept the focus of the keyboard,
but if doing click with mouse.

I’m getting an error in the masked edit code so I can’t run your sample,
but I think the way I would approach it is to handle the focus events
like we talked about before, and also catch the mouse events for the
radio button and handle toggling the state of the radio button in the
mouse event handlers. So basically it would never get the focus, but
you can still set or clear the items with the mouse.


Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!


To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwidgets.org
For additional commands, e-mail: wxPython-users-help@lists.wxwidgets.org

Mary Dinora Guevara wrote:

Thanks for all your answers, and Excuse the annoyance, but you could show an example to me to cause that a control does not have the focus from the keyboard, but if with mouse? It is that not like doing it. Thanks

Catch the EVT_SET_FOCUS event and in the handler move the focus to some other control. Catch the EVT_LEFT_DOWN event and in the handler toggle the checked state of the radio button.

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!

Perfect. Thanks by the fast answer!

Mary :slight_smile:

···

----- Original Message -----

From:
Robin Dunn

To: wxPython-users@lists.wxwidgets.org

Sent: Friday, May 19, 2006 2:45 AM

Subject: Re: [wxPython-users] AcceptsFocusFromKeyboard

Mary Dinora Guevara wrote:

Thanks for all your answers, and Excuse the annoyance, but you could
show an example to me to cause that a control does not have the focus
from the keyboard, but if with mouse? It is that not like doing it. Thanks

Catch the EVT_SET_FOCUS event and in the handler move the focus to some
other control. Catch the EVT_LEFT_DOWN event and in the handler toggle
the checked state of the radio button.


Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!


To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwidgets.org
For additional commands, e-mail: wxPython-users-help@lists.wxwidgets.org