Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > ActiveX COM > Docking Pane
  New Posts New Posts RSS Feed - [Solved]Get the position and size of Floating Pane
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

[Solved]Get the position and size of Floating Pane

 Post Reply Post Reply
Author
Message
Jebo View Drop Down
Senior Member
Senior Member


Joined: 27 October 2005
Location: Germany
Status: Offline
Points: 314
Post Options Post Options   Thanks (0) Thanks(0)   Quote Jebo Quote  Post ReplyReply Direct Link To This Post Topic: [Solved]Get the position and size of Floating Pane
    Posted: 05 September 2010 at 1:20pm
Hello,

I need the position and size of a Floating Pane. BUT HOW do I get this?

I was trying to catch it by GetWindowRect API. But the Result is WITHOUT the caption Height an Border-width of a floating pane?

So please how can I get the right values OR the Border-width plus caption Height of a floeting pane???

Back to Top
Jebo View Drop Down
Senior Member
Senior Member


Joined: 27 October 2005
Location: Germany
Status: Offline
Points: 314
Post Options Post Options   Thanks (0) Thanks(0)   Quote Jebo Quote  Post ReplyReply Direct Link To This Post Posted: 05 September 2010 at 2:38pm
ARGHHHH!!!! I have tried everything in the last many hours!

Also tried this Workaround: http://forum.codejock.com/forum_posts.asp?TID=17066

It seems it's not possible!!!

CJ, WHY?

PLEASE add a position/location property to next release!
Back to Top
jpbro View Drop Down
Senior Member
Senior Member
Avatar

Joined: 12 January 2007
Status: Offline
Points: 1336
Post Options Post Options   Thanks (0) Thanks(0)   Quote jpbro Quote  Post ReplyReply Direct Link To This Post Posted: 05 September 2010 at 5:05pm
It looks like you need to call the GetParent API twice - once on the Pane.Handle, and Once on the return value of GetParent(Pane.Handle) in order to get the top level window. So:


Private Declare Function GetParent Lib "user32.dll" (ByVal hwnd As Long) As Long


Private Sub Command1_Click()
   Dim lt_Rect As RECT
   Dim l_PaneIndex As Long   ' Pane Index to find the window size of

   GetWindowRect GetParent(GetParent(Me.DockingPane1.Panes(l_PaneIndex).Handle)), lt_Rect ' Rect contains position of window in Pixels.

   Debug.Print lt_Rect.Right - lt_Rect.Left, lt_Rect.Bottom - lt_Rect.Top   ' print width and height of window
End Sub

Product: Xtreme SuitePro (ActiveX) version 16.2.6
Platform: Windows XP - SP3

Language: Visual Basic 6.0 SP6

Back to Top
jpbro View Drop Down
Senior Member
Senior Member
Avatar

Joined: 12 January 2007
Status: Offline
Points: 1336
Post Options Post Options   Thanks (0) Thanks(0)   Quote jpbro Quote  Post ReplyReply Direct Link To This Post Posted: 05 September 2010 at 5:21pm
I guess the "correct" way would be to use the GetAncestor API instead:


Private Declare Function GetAncestor Lib "user32.dll" (ByVal hwnd As Long, ByVal gaFlags As Long) As Long
Private Const GA_ROOTOWNER As Long = 3

Private Sub Command1_Click()
   Dim lt_Rect As RECT
   Dim l_PaneIndex As Long   ' Pane Index to find the window size of

   GetWindowRect GetAncestor(Me.DockingPane1.Panes(l_PaneIndex).Handle, GA_ROOTOWNER), lt_Rect ' Rect contains position of window in Pixels.

   Debug.Print lt_Rect.Right - lt_Rect.Left, lt_Rect.Bottom - lt_Rect.Top   ' print width and height of window
End Sub


Product: Xtreme SuitePro (ActiveX) version 16.2.6
Platform: Windows XP - SP3

Language: Visual Basic 6.0 SP6

Back to Top
Jebo View Drop Down
Senior Member
Senior Member


Joined: 27 October 2005
Location: Germany
Status: Offline
Points: 314
Post Options Post Options   Thanks (0) Thanks(0)   Quote Jebo Quote  Post ReplyReply Direct Link To This Post Posted: 05 September 2010 at 6:08pm
Hi jpbro,

You are the Hero!    ...
GetParent will work!

Wow! Now I have so many hours of hard work behind me.

What's interesting is that I tested also the GetParent API but made a mistake. Then I tried it not anymore!

BIG THX!!!
Back to Top
jpbro View Drop Down
Senior Member
Senior Member
Avatar

Joined: 12 January 2007
Status: Offline
Points: 1336
Post Options Post Options   Thanks (0) Thanks(0)   Quote jpbro Quote  Post ReplyReply Direct Link To This Post Posted: 05 September 2010 at 7:48pm
Glad to help Jebo!
Product: Xtreme SuitePro (ActiveX) version 16.2.6
Platform: Windows XP - SP3

Language: Visual Basic 6.0 SP6

Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down



This page was generated in 0.078 seconds.