Posted: 10:19pm 26 Oct 2023 |
Copy link to clipboard |
Print this post |
|
Hi, I'm running MMBasic V5.05.03 on a MM+ E100, with a 5" SSD1963 screen attached - backpack style.
I wanted a GUI BUTTON with the button's string changeable, so defined the button without a string, and placed a GUI CAPTION in the button, using the same background colour for both. CTRLVAL(#Caption Ref)="New string" then worked well, changing the CAPTION string after a BUTTON touch was detected from the GUI INTERRUPT.
This worked fine for a single line string, but for a 2-string CAPTION using the "~" (tilde) character to split the string, things were not so good!
Here's a short demo code just using CAPTION's that shows the problem :-
' kw\Micromite_Plus OPTION EXPLICIT OPTION DEFAULT NONE cls RGB(black) gui setup 1 gui caption 1,"A short 1-line string without a tilde character",400,150,CM,rgb(white),rgb(gray) gui caption 2,"A short 2-line string~using a tilde character",400,200,CM,rgb(white),rgb(gray) page 1:pause 2000 ctrlval(1)="Another 1-line string - no tilde character" ctrlval(2)="Another 2-line string~using a tilde character" end
MMBasic erases the 2-line string as if it was a single string, then writes the new 2-line string. Whereas the 1st string and the 2nd string fit in the button, the 1st string erasure area doesn't!
I don't think I'm doing anything wrong - but what do you think? Would someone like to run this please - and see if it does what you expect.
With best regards, Paul. Nothing so constant as change. |