AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Getting a Tab control's client area

 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
TL



Joined: 01 Nov 2006
Posts: 9

PostPosted: Thu Feb 07, 2008 11:36 pm    Post subject: Getting a Tab control's client area Reply with quote

How can I determine the location and size of the client area within the tabs of a tab control? It should be the same for all tabs in a tab control. I want to place the child controls on the tab using defined positioning coordinates. Therefore, I need to avoid the area within the tab control in use by the tab labels (may be single or multi-line) and the borders.

I assumed that I would not be the first to have this problem but I can't find anything on this forum or in the MSDN.

Regards,
TL
Back to top
View user's profile Send private message
grupo
Guest





PostPosted: Fri Feb 08, 2008 12:48 pm    Post subject: Reply with quote

"controlgetpos" does not works withtab controls?
Back to top
Lexikos



Joined: 17 Oct 2006
Posts: 2526
Location: Australia, Qld

PostPosted: Fri Feb 08, 2008 1:11 pm    Post subject: Reply with quote

The client area is the area inside the tab control's frame, under the tabs. ControlGetPos would get the position and size of the tab control, not the tab control's client area.

Technically, tab controls don't have a non-client area (no actual window frame or caption), so the client area of a tab control is its entire area. I think "display area" is the term Microsoft uses in this context.

TL, try TCM_ADJUSTRECT (0x1328).
Back to top
View user's profile Send private message
TL



Joined: 01 Nov 2006
Posts: 9

PostPosted: Fri Feb 08, 2008 7:08 pm    Post subject: Reply with quote

Thanks lexiKos,
TCM_ADJUSTRECT provided just the solution I was looking for. Here is the guts of the code:
Code:

;RECT structure - Load Tab control's location
VarSetCapacity( TabPrc, 16, 0 )
NumPut( TabLeft, TabPrc, 0 )
NumPut( TabTop, TabPrc, 4 )
NumPut( TabRight, TabPrc, 8 )
NumPut( TabBottom, TabPrc, 12 )
SendMessage, 0x1328               ;TCM_ADJUSTRECT
           , 0                        ;False = Return tab's display region
           , &TabPrc              ;RECT structure (input and output)
           ,
           , ahk_id %Hctrl%   ;Control's handle
DisplayLeft := NumGet( TabPrc, 0 )
DisplayTop := NumGet( TabPrc, 4 )
DisplayRight := NumGet( TabPrc, 8 )
DisplayBottom := NumGet( TabPrc, 12 )
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group