![]() |
|
center line not working with add label - Printable Version +- PowerBASIC Users Meeting Point (https://pump.richheimer.de) +-- Forum: User to User Discussions (https://pump.richheimer.de/forumdisplay.php?fid=3) +--- Forum: PowerBASIC for Windows (https://pump.richheimer.de/forumdisplay.php?fid=4) +--- Thread: center line not working with add label (/showthread.php?tid=134) |
center line not working with add label - Robert Alvarez - 02.09.2026 #COMPILE EXE FUNCTION PBMAIN() AS LONG LOCAL hDlg AS LONG DIALOG NEW 0, "SET center Line Test",,,480,300, %WS_SYSMENU, 0 TO hDlg LOCAL AA AS STRING AA= STRING$(10, 151) ? AA 'PRINT LINES BELOW DOES NOT CONTROL ADD LABEL, hDlg, 203,AA , 55, 70,75,450, CONTROL ADD LABEL, hDlg, 203,STRING$(10, 151) , 55, 80,75,450, DIALOG SHOW MODAL hDlg END FUNCTION RE: center line not working with add label - Dale Yarker - 03.09.2026 I think I put enough comments in the code Code: #compile exeCode: #compile exeI used LABEL same size as DIALOG to stay close to post 1 code. CONTROL ADD LINE is "neater". IMO Cheers, ((correction - character 151 (decimal) is EM_DASH in ANSI)) RE: center line not working with add label - Jules Marchildon - 04.09.2026 If the goal is to draw a horizontal center line, using repeated em dashes is really relying on a text character as a graphics primitive. That's inherently font-dependent. DDT controls use a default windows font unless you explicitly specify one. If that particular font, font substitution or the way the ANSI character is converted doesn't handle character 151 as expected, you could get an incorrect character or potentially something that looks like a different line... Like Dale said, it's better to draw your own line. RE: center line not working with add label - Dale Yarker - 04.09.2026 Thankyou Jules, Your post maked me realize that I didn't stress using AS WSTRING, and AS WSTRINGZ strongly enough, even for plain text. (CONTROL ADD LINE is probably better in most cases and can also do vertical lines) RE: center line not working with add label - Robert Alvarez - 07.09.2026 '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 'remark out 2 or 3 line for v1 94 ,95 CONTROL ADD LABEL, hDlg, 203,"4444" , 55, 50,75,12, 'FOUR LINE CONTROL ADD LABEL, hDlg, 203,"3333" , 55, 60,75,12, 'THREE LINE CONTROL ADD LABEL, hDlg, 203,"2222" , 55, 70,75,12 , 'TWO LINE CONTROL ADD LABEL, hDlg, 203,"1111" , 55, 80,75,12, CONTROL ADD LINE, hDlg, 203,"" , 50, V1,27,1, '%SS_BLACKFRAME CONTROL ADD LABEL, hDlg, 203,"3333" , 55, 100,75,12, DIALOG SHOW MODAL hDlg END FUNCTION '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 CONTROL ADD LABEL, hDlg, 203,"ABC" , 55, 60,100,12 CONTROL ADD LABEL, hDlg, 204,"___" , 55, V1,100,12 CONTROL ADD LABEL, hDlg, 205,"GHJ" , 55, 90,100,12 DIALOG SHOW MODAL hDlg END FUNCTION RE: center line not working with add label - Dale Yarker - 08.09.2026 Code: 'same for GRAPHIC LINE and XPRINT LINECode: 'could also use _ key and change the Y LOCATION********************************** 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 Robert Alvarez's center line not working with add label - Dale Yarker - 19.09.2026 Is it working now? |