AutoHotkey Community

It is currently May 25th, 2012, 11:44 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 4 posts ] 
Author Message
PostPosted: February 7th, 2008, 11:36 pm 
Offline

Joined: November 1st, 2006, 8:33 pm
Posts: 21
Location: Chicago, IL
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


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 8th, 2008, 12:48 pm 
"controlgetpos" does not works withtab controls?


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: February 8th, 2008, 1:11 pm 
Offline

Joined: October 17th, 2006, 4:15 pm
Posts: 7501
Location: Australia
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).


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 8th, 2008, 7:08 pm 
Offline

Joined: November 1st, 2006, 8:33 pm
Posts: 21
Location: Chicago, IL
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 )


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: BrandonHotkey, Exabot [Bot], Google Feedfetcher, LazyMan, Tegno and 19 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group