From: Andy T. <an...@cr...> - 2001-08-26 11:25:52
|
I can't seem to find a reference to this anywhere, but am willing to have my ignorance admonished. Anyway, I'm trying to set the application focus in response to an event. In particular, when the user presses a button in my application I would like to lead them by the hand and place the cursor in another widget. For future use I'm thinking we would want to be able to change the application focus between different windows, regions, etc. If this is easy to do then feel free to send me a one line reply, alternatively I can raise this as a project issue at SF. I just thought I would share my question with the list before taking that step. Whilst I'm at it, we may want another attribute for each widget that indicates its tab order. It is sometimes useful to vary the navigation path between fields depending on various rules. Also, it may be necessary to specify widgets in a certain order in the resource file but have the default tab order through them to be different. I know this is all irrelevant if you use the mouse to navigate to a specific widget, but in the kind of applications which I sometimes write (data entry for databases) where speed of input is optimum the default user behaviour is to use the tab key to navigate between elements so that you don't have to take your hand away from the keyboard at any time. Regards, Andy -- ----------------------------------------------------------------------- From the desk of Andrew J Todd esq. "Shave my poodle!" |
From: Kevin A. <al...@se...> - 2001-08-26 14:28:06
|
> From: Andy Todd > > Anyway, I'm trying to set the application focus in response to an event. > In particular, when the user presses a button in my application I would > like to lead them by the hand and place the cursor in another widget. > > For future use I'm thinking we would want to be able to change the > application focus between different windows, regions, etc. This came up last week for me when I was trying to do a Find for one of the samples. Essentially, what you need to be able to do is post an event, specifically a wxPython SetFocus event. Now that you've reminded me, I'll go back and look at it, but we may have to wait until Rowland has some time to look at the event framework before this will get fixed. > Whilst I'm at it, we may want another attribute for each widget that > indicates its tab order. It is sometimes useful to vary the navigation > path between fields depending on various rules. Also, it may be > necessary to specify widgets in a certain order in the resource file but > have the default tab order through them to be different. There is a SF tracker issue for this: http://sourceforge.net/tracker/index.php?func=detail&aid=442241&group_id=190 15&atid=369015 > I know this is all irrelevant if you use the mouse to navigate to a > specific widget, but in the kind of applications which I sometimes write > (data entry for databases) where speed of input is optimum the default > user behaviour is to use the tab key to navigate between elements so > that you don't have to take your hand away from the keyboard at any time. I added an 'order' list to components yesterday to keep track of the order the widgets in the components dictionary were created. The creation order determines the tab order in the panel as well as how the widgets overlap right now. The first item in the .rsrc.py component list will be the first item tabbed to and will overlap any other widgets defined after it. The addition of the order list allowed me to fix the resourceEditor and Property Editor so that the output of the View Attributes and Property Editor components list now displays the widgets in the correct order. ka |
From: Kevin A. <al...@se...> - 2001-08-27 22:29:22
|
> Anyway, I'm trying to set the application focus in response to an event. > In particular, when the user presses a button in my application I would > like to lead them by the hand and place the cursor in another widget. Robin just showed me how stupid I was and after recovering from some dizziness due to banging my head against the desk I added a setFocus method to Widget. So, for any widget, you can do something like: self.components.field1.setFocus() If you want to remove the focus, then use: self.components.field1.setFocus(0) The change is checked into cvs. ka |
From: Andy T. <an...@cr...> - 2001-08-27 23:20:57
|
Kevin Altis wrote: >>Anyway, I'm trying to set the application focus in response to an event. >>In particular, when the user presses a button in my application I would >>like to lead them by the hand and place the cursor in another widget. >> > > Robin just showed me how stupid I was and after recovering from some > dizziness due to banging my head against the desk I added a setFocus method > to Widget. So, for any widget, you can do something like: > > self.components.field1.setFocus() > > If you want to remove the focus, then use: > > self.components.field1.setFocus(0) > > The change is checked into cvs. > > ka > Ta muchly, hope the pain subsides quickly. I'll include it in the next version of dbBrowser to show a working example. Regards, Andy -- ----------------------------------------------------------------------- From the desk of Andrew J Todd esq. "Shave my poodle!" |