···
On Tue, 16 Jul 2002 10:27:45 -0700 "Tim Roberts" <timr@probo.com> wrote:
On Tue, 16 Jul 2002 19:20:08 +0200, Andre Reitz wrote:
>
>Well my Problem is, e.g:
>
>--------------------------------
>> BUTTON1 | TEXTCTRL |*BUTTON2*|
>--------------------------------
>
>So lets say Button2 is the default Button.
>If the user has the focus on Button1, then in my opinion it is
>correct to "click" Button1 when hitting enter. (as is)
>
>But when the User hits Tab and gets into TEXTCTRL then the DefaultButton
>shall jump back to BUTTON2 (but doesnt)
>
>In Fact it Button1 stays the DefaultButton, and when Clicking enter in
>The TEXTCTRL, then Button1 is activated and not Button2 which originally was
>the Defaultbutton!
>
>Am I doing something wrong?
>
>---> I think that this doesnt work as described?
>---> am I wrong?
No, it should work exactly as you describe. If not, it's a wxWindows bug. I
will have to play with this to find out.
I'm surprised by the code snippet you sent along. wxWindows should never
modify the "default" status. Windows makes a clear distinction between the
"default" button and "focus" button, and they even get rendered differently.
I suggest you send an exact copy of what you sent me to the mailing list;
perhaps Robin has the answer.
--------------------------------------------------------------------------------
from wxPython.wx import *
class Frame(wxFrame):
def __init__(self):
wxFrame.__init__(self,None,-1,"",size=(400,400))
p=wxPanel(self,-1,pos=(0,0),size=(400,400))
b1=wxButton (p,-1,"B1",pos=(10,10))
tx=wxTextCtrl(p,-1,"tx",pos=(10,40))
b2=wxButton (p,-1,"B2",pos=(10,70))
b2.SetDefault()
EVT_BUTTON(self,b1.GetId(),self.OnB1)
EVT_BUTTON(self,b2.GetId(),self.OnB2)
def OnB1(self,event):
print "B1"
def OnB2(self,event):
print "B2"
class App(wxApp):
def OnInit(self):
f=Frame()
f.Show()
return 1
app=App()
app.MainLoop()
--------------------------------------------------------------------------------
Please try it somebody under windows and see, that the Default Button
(when Hitting Enter in the TextField) is always the Last Focussed Button (MSW only).
In my opinion this is an evil bug....
What do you think?
Greetings, Andre'
--
- Tim Roberts, timr@probo.com
Providenza & Boekelheide, Inc.
--
_____________________________________________
inworks GmbH Andre Reitz
Magirusstrasse 44 Tel. 0731/93 80 7-21
89077 Ulm http://www.inworks.de