Set focus to control inside docking pane |
Post Reply |
Author | |
tobi
Senior Member Joined: 09 September 2004 Location: Germany Status: Offline Points: 451 |
Post Options
Thanks(0)
Posted: 10 September 2009 at 12:46pm |
I have a VB6 SDI app with one docking pane !
At application startup I want to set the focus to the textbox inside the pane, but at the end of FORM_LOAD I receive error ! I think at this moment the docking pane isn't yet ready ? Does anyone have idea when and where I can set focus to the textbox inside the pane? |
|
jpbro
Senior Member Joined: 12 January 2007 Status: Offline Points: 1355 |
Post Options
Thanks(0)
|
I don't think that this is a DockingPane limitation. You can never call SetFocus methods inside the Form_Load event because the control must be visible otherwise an error will be raised (you can try this on a regular VB6 form). You can set the focus inside the Form_Activate event though (because the form is visible at this point). If you only want this to happen once, you can use a Static variable...something like:
|
|
Product: Xtreme SuitePro (ActiveX) version 16.2.6
Platform: Windows XP - SP3 Language: Visual Basic 6.0 SP6 |
|
chrisABC
Senior Member Joined: 05 June 2008 Status: Offline Points: 258 |
Post Options
Thanks(0)
|
I used to get this error seemingly at random on different PCs. The problem is when the control (eg TextBox) you want to set Focus to is not visible when you try to set focus -- this gives error. In my apps, I think timing caused the problem to only happen sometimes (eg maybe sometimes the control is visible, sometimes it is not quite ready).
I solved this by adding a Timer to each form that needs this. Set the Timer to give a delay of 200 mSec or so, and in the Form_Activate (or other) event, set a module level variable to indicate which control is to get Focus. The Form is displayed, and then the Timer fires and sets Focus to that control. (And then set the Timer off). This can be more useful. If you have several Forms (or Panes) on screen, you can remember which control in each one had focus and set focus to it again when user returns to that form. |
|
Chris (Manchester, UK) -- www.abc6.co.uk ---- Using CodeJock ActiveX Suite 13.1.0 with Windows8, VB6 SP6
|
|
Post Reply | |
Tweet
|
Forum Jump | Forum Permissions You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |