![]() |
& Character problem - Printable Version +- PowerBASIC Users Meeting Point (http://pump.richheimer.de) +-- Forum: User to User Discussions (http://pump.richheimer.de/forumdisplay.php?fid=3) +--- Forum: PowerBASIC for Windows (http://pump.richheimer.de/forumdisplay.php?fid=4) +--- Thread: & Character problem (/showthread.php?tid=90) Pages:
1
2
|
& Character problem - Robert Alvarez - 30.09.2025 using the & character is a problem when typing in text box and displaying it, is thee a fix type A&B screen show AB xprint show A&B type A&&B screen show A&B xprint show A&&B RE: & Character problem - Dale Yarker - 30.09.2025 unable to duplicate problem with: Code: #compile exe and typing into textbox as stated using PBWin 10 on Windows 10 Cheers, RE: & Character problem - Robert Alvarez - 01.10.2025 FORMATTING NOT SHOWING CORRECT ON POST type A&B screen show AB <-- SHOULD BE B UNDERLINE xprint show A&B type A&&B screen show A&B xprint show A&&B Here is sample code that show problem 'CODE FOR PROBLEM #COMPILE EXE #DIM ALL %UNICODE = 1 GLOBAL hDlg AS DWORD, A AS STRING CALLBACK FUNCTION XPRINTT() XPRINT ATTACH CHOOSE XPRINT A XPRINT CLOSE END FUNCTION CALLBACK FUNCTION TEXTT() CONTROL GET TEXT hDlg, 1000 TO A CONTROL SET TEXT hDlg, 1002, A END FUNCTION FUNCTION PBMAIN () AS LONG LOCAL W, RtoL AS WSTRING LOCAL R AS STRING W = CHR$$(&h1D08) RtoL = CHR$$(&h21D0) 'F4) DIALOG DEFAULT FONT "Consolas", 10, 0, 1 DIALOG NEW 0, W, , , 150, 50, %WS_OVERLAPPEDWINDOW, %WS_EX_LEFT OR _ %WS_EX_LTRREADING TO hDlg CONTROL ADD TEXTBOX, hDlg, 1000, "", 5, 5, 40, 12 CONTROL ADD BUTTON ,hDlg,1001, "DONE", 50,5,40,12, CALL TEXTT CONTROL ADD LABEL ,hDlg,1002, "XX", 50,25,40,12, ' CONTROL ADD BUTTON ,hDlg,1003, "PRINT", 100, 5,40,12, CALL XPRINTT DIALOG SHOW MODAL hDlg END FUNCTION doing xprint better to print to file than waste paper RE: & Character problem - Dale Yarker - 01.10.2025 "screen show AB <-- SHOULD BE B UNDERLINE" I get AB with B underlined in label here after clicking DONE. No idea why you don't. For A&&B I get A&B as said. The pdf after PRINT shows content of textbox for A&B and A&&B. "&&" tries to hotkey the second "&", it can't so just shows one. Post 1 did not mention display in label, so I was not surprised when the textbox when B was not underlined. All the help I have, bye from this. Cheers, RE: & Character problem - Stuart McLachlan - 01.10.2025 (01.10.2025, 12:38 AM)Robert Alvarez Wrote: FORMATTING NOT SHOWING CORRECT ON POST Known behaviour of recent versions of Windows. By default, you need to hit Alt key to show keyboard shortcuts in menus and labels (and button text). "&&" shows the character "&" in such controls and it is NOT a shortcut. To demonstrate more clearly, try "&DONE" as the button label ![]() Demonstration of what is actually stored: Code: #COMPILE EXE You can control this behaviour with: Control Panel > Ease of Access Center > Make the keyboard easier to use > Enable "Underline keyboard shortcuts and access keys". RE: & Character problem - Borje Hagsten - 01.10.2025 To always show & in static (label) control, add %SS_NOPREFIX style to it. MS explains: "Prevents interpretation of any ampersand (&) characters in the control's text as accelerator prefix characters. These are displayed with the ampersand removed and the next character in the string underlined. This static control style may be included with any of the defined static controls. An application can combine SS_NOPREFIX with other styles by using the bitwise OR (|) operator. This can be useful when filenames or other strings that may contain an ampersand (&) must be displayed in a static control in a dialog box." Code: '====================================================================== RE: & Character problem - Dale Yarker - 01.10.2025 I think he did not want to see the &, he wanted the hot-key. The & was not showing, correct, but not getting the underline indicating the hot-key took affect. RE: & Character problem - Stuart McLachlan - 01.10.2025 (01.10.2025, 02:29 PM)Borje Hagsten Wrote: To always show & in static (label) control, add %SS_NOPREFIX style to it. N.B. Applies to Labels but not to Buttons. (for a button, you have to use "&&") RE: & Character problem - Robert Alvarez - 01.10.2025 %SS_NOPREFIX Fixed the problem thanks Borje and everyone for your help and comments RE: & Character problem - Borje Hagsten - 01.10.2025 For buttons, use ownerdrawn and DrawText with %DT_NOPREFIX format. |