Guys,
Thanks for all your help, but.....
I don't need the client width of a created listbox, edit control or whatsoever.
What I am after is the expected width of a scroll bar, in order to create a control with sufficient space for both, text and the scrollbar..
In that respect Aldo already gave me the answer I need.
------------------
mailto:[email protected][email protected]</A>
www.basicguru.com/zijlema/
Announcement
Collapse
No announcement yet.
Width of a scroll bar
Collapse
X
-
GetClientRect returns size minus scrollbars, if such exist. See:
Code:'¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤ ' Template '¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤ #COMPILE EXE #INCLUDE "WIN32API.INC" '¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤ ' Create dialog and controls, etc '¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤ FUNCTION PBMAIN () AS LONG LOCAL hDlg AS LONG, rc AS RECT, rc2 AS RECT DIALOG NEW 0, "Test",,, 180, 115, %DS_MODALFRAME OR %WS_CAPTION OR %WS_SYSMENU, 0 TO hDlg CONTROL ADD TEXTBOX, hDlg, 10, "", 4, 4, 172, 50, %WS_CHILD OR _ %ES_MULTILINE OR %WS_VSCROLL, %WS_EX_CLIENTEDGE CONTROL ADD TEXTBOX, hDlg, 11, "", 4, 60, 172, 50, %WS_CHILD OR _ %ES_MULTILINE, %WS_EX_CLIENTEDGE GetClientRect GetDlgItem(hDlg, 10), rc GetClientRect GetDlgItem(hDlg, 11), rc2 CONTROL SET TEXT hDlg, 10, "ClientWidth:" & STR$(rc.nRight) CONTROL SET TEXT hDlg, 11, "ClientWidth:" & STR$(rc2.nRight) DIALOG SHOW MODAL hDlg END FUNCTION
------------------
Leave a comment:
-
-
From MSDN:
The GetDialogBaseUnits function retrieves the system's dialog base units, which are the average width and height of characters in the system font.
For dialog boxes that do not use the system font (DDT), the conversion from dialog template units to pixels depends on the font used by the dialog box.
This means that it's necessary ro use MapDialogRect. Almost sure that PB Dialog Pixels to Units uses exactly this function.
------------------
E-MAIL: [email protected]
Leave a comment:
-
-
Thanks Aldo,
I have to know such standard API things, but sometimes I'm worse than my laptop: 'out of memory'. Let's assume it is my age.
------------------
mailto:[email protected][email protected]</A>
www.basicguru.com/zijlema/
Leave a comment:
-
-
Get the width of a vertical scroll bar by using GetSystemMetrics( %SM_CXVSCROLL ) - this will give you the width in pixels. Then you can use GetDialogBaseUnits to convert it to DUs.
------------------
[This message has been edited by Aldo Cavini (edited April 02, 2001).]
Leave a comment:
-
-
Width of a scroll bar
Guys,
When designing dialogs I'm using GetTextExtentPoint32, in order to retrieve correct values for cx and cy.
For listboxes and edit controls there is one minor unsolved matter: when those controls have a vertical scroll bar, text sometimes disappears behind that bar. What is the number of du's to take in account for the expected width of a scroll bar?
------------------
mailto:[email protected][email protected]</A>
www.basicguru.com/zijlema/Tags: None
-
Leave a comment: