 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
TL
Joined: 01 Nov 2006 Posts: 9
|
Posted: Thu Feb 07, 2008 11:36 pm Post subject: Getting a Tab control's client area |
|
|
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 |
|
 |
grupo Guest
|
Posted: Fri Feb 08, 2008 12:48 pm Post subject: |
|
|
| "controlgetpos" does not works withtab controls? |
|
| Back to top |
|
 |
Lexikos
Joined: 17 Oct 2006 Posts: 2526 Location: Australia, Qld
|
Posted: Fri Feb 08, 2008 1:11 pm Post subject: |
|
|
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 |
|
 |
TL
Joined: 01 Nov 2006 Posts: 9
|
Posted: Fri Feb 08, 2008 7:08 pm Post subject: |
|
|
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 |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|