Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > ActiveX COM > Docking Pane
  New Posts New Posts RSS Feed - How to return focus to docked window
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

How to return focus to docked window

 Post Reply Post Reply
Author
Message
jiri View Drop Down
Newbie
Newbie


Joined: 31 October 2003
Location: Czech Republic
Status: Offline
Points: 38
Post Options Post Options   Thanks (0) Thanks(0)   Quote jiri Quote  Post ReplyReply Direct Link To This Post Topic: How to return focus to docked window
    Posted: 28 October 2004 at 4:46am

I have SDI app with docking pane. I have following problem:

I show modal window from any docked window. When I close modal window, focus is in main form. It is easy to reproduce this behaviour putting following code to the frmPane in SDISample. Form1 is empty new form

Private Sub txtContent_KeyUp(KeyCode As Integer, Shift As Integer)
    Form1.Show vbModal
End Sub

Thanks for answer

Jiri

Back to Top
JSram View Drop Down
Groupie
Groupie


Joined: 22 October 2004
Status: Offline
Points: 42
Post Options Post Options   Thanks (0) Thanks(0)   Quote JSram Quote  Post ReplyReply Direct Link To This Post Posted: 02 November 2004 at 12:06pm
Ok I haven't got that far yet, but sure will... just wonder, what happen if you code

Private Sub txtContent_KeyUp(KeyCode As Integer, Shift As Integer)
    Form1.Show vbModal, Me
End Sub

any differance? Not sure but maybe you have to code wise pin the pane or make sure it's pinned as if it closes it probably can't regain focus.

Just an idea.
Back to Top
jiri View Drop Down
Newbie
Newbie


Joined: 31 October 2003
Location: Czech Republic
Status: Offline
Points: 38
Post Options Post Options   Thanks (0) Thanks(0)   Quote jiri Quote  Post ReplyReply Direct Link To This Post Posted: 02 November 2004 at 12:34pm

I try following:

Form1.Show vbModal, Me
But the result is the same as without "Me".

Jiri

 

Back to Top
JSram View Drop Down
Groupie
Groupie


Joined: 22 October 2004
Status: Offline
Points: 42
Post Options Post Options   Thanks (0) Thanks(0)   Quote JSram Quote  Post ReplyReply Direct Link To This Post Posted: 02 November 2004 at 12:54pm
Ok sorry,

it was just an idea. I assume it would be the same if you used the calling form name as referense instead of Me as well?

I'm not really "there" yet, trying to rebuild my app using the codejock controls. Maybe it's not a good idea to load a form from a pane, I don't know. have you tried to simply pop up a msgbox and see if that show the same pattern?

An other idea I come to think of, instead of is to load the form in a bit other way.

In the form you want to show, make a
Public Function/Sub ShowMe()
    Me.Show Modal
End Function/Sub

Private Sub txtContent_KeyUp(KeyCode As Integer, Shift As Integer)
    Call    Form1.ShowMe
    Me.SetFocus
End Sub

I use this technique often to show a modal, for other reasons like returning a variable/object value from a form. Maybe you don't even need the Me.SetFocus as it normally would return to the calling instans automaticly.

Back to Top
gallman View Drop Down
Newbie
Newbie


Joined: 06 September 2004
Status: Offline
Points: 18
Post Options Post Options   Thanks (0) Thanks(0)   Quote gallman Quote  Post ReplyReply Direct Link To This Post Posted: 02 November 2004 at 3:15pm

Hi Jiri,

Along the same lines as JSram's solution, you can use the Win32 API route to force a window into focus. See below for an example:

Public Declare Function PutFocus Lib "user32" Alias "SetFocus" (ByVal hWnd As Long) As Long

Then just call the function from anywhere you need to force focus. For example:
- PutFocus MyForm.hWnd
- PutFocus MyForm.MyControl.hWnd

This comes in handy if you have a specific form and/or control within a pane that needs to get the focus.

Good luck!

Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.156 seconds.