08.09.2026, 06:44
(This post was last modified: 08.09.2026, 07:08 by Dale Yarker.)
Code:
'same for GRAPHIC LINE and XPRINT LINE
#compile exe
global hDlg as long
function pbmain() as long
dialog new 0, "SET center Line Test",,,200,200, %ws_sysmenu, 0 to hDlg
local V1, V2 as single
'V1=94 'TWO LINE
'V1=95 'THREE LINE
V1=95.2 'FOUR LINE
'Positons and sizes are integers (specifically LONGs).
'So 95 and 95.2 are both 95 due to truncation when
'setting a float to an integral.
'
'remark out 2 or 3 line for v1 94 ,95
'
'!!!!!!!!!!!!!!!!! you did not use style %SS_CENTER on the LABELs !!!!!!!!!!!!!
'%ss_center centers the text within the width of the label
control add label, hDlg, 203,"4444" , 55, 50,75,12,%ss_centerĀ 'FOUR LINE
control set color hDlg, 203, -1, %rgb_yellow 'just to show center of what
control add label, hDlg, 203,"3333" , 55, 60,75,12,%ss_center 'THREE LINE
control add label, hDlg, 203,"2222" , 55, 70,75,12, %ss_center , 'TWO LINE
control add label, hDlg, 203,"1111" , 55, 80,75,12, %ss_center
'
'position of LINE is position of LABEL plus half width of LABEL
'minus half width of LINE
control add line, hDlg, 206,"" , 55+(75/2)-(27/2), V1,27,1, %ss_blackframe
control add label, hDlg, 203,"3333" , 55, 100,75,12,%ss_center
dialog show modal hDlg
end functionCode:
'could also use _ key and change the Y LOCATION
#compile exe
function pbmain() as long
local hDlg, hFontTerminal as long 'OEM CharSet = %OEM_CHARSET = 255
dialog new 0, "SET center Line Test",,,200,200, %ws_sysmenu, 0 to hDlg
local V1 as single
V1=70
'
'!!!!!!!!!!!!!!! again no %SS_CENTER style !!!!!!!!!!
'To place exactly in center of DIALOG takes arithmetic on LABEL position
'similar as shown in previous post for LINE
control add label, hDlg, 203,"ABC" , 55, 60,100,12, %ss_center
control add label, hDlg, 204,"___" , 55, V1,100,12, %ss_center
control set color hDlg, 204, -1, %rgb_yellow
control add label, hDlg, 205,"GHJ" , 55, 90,100,12, %ss_center
dialog show modal hDlg
end function**********************************
Albert, I used two "New Reply"s, but forum merged them. I tried as two to separate the different problems. Not a useful feature IMO.
Cheers
