| Posted: 12:58am 14 Jul 2018 |
Copy link to clipboard |
 Print this post |
|
Hi all,
I've got a GUI Caption problem that is baffling me... I got this one when I was trying to do long strings and display it in the Caption box. Because it annoys me to have horizontal scroll bars in programing, I build the string as needed (as you can see in the code) just to keep it where I want it.
So, my problem is that when I specify the alignment (LM, CB, or whatever) the Vertical align always seems to defaulting to middle... If I set the coordinates for text display at 10,10 - the long string runs over the top edge of the LCD.
Here's my code (reduced to a bare minimum to find what's going on)
option explicit dim HelpStr as string dim Align as string
Align = "LB" '<<----- Change here for new alignment. Options are - L C R + T M B cls line 0,mm.vres/2,mm.hres,mm.vres/2,1,RGB(RED) '<<---- Shows where the LCD center is SetMsg '<<------- Build the message print len(HelpStr) '<<----- Just check and show the length text 10,mm.vres/2,"Some Text",Align,2,1,RGB(White),rgb(Black) '<<---- Just to check the Align string pause 1500 ShowHelp '<<---- Show the GUI CAPTION area with the initial message pause 1500 ShowMsg '<<---- Show the new message in the GUI CAPTION area do:loop
'------ sub SetMsg 'Build the string so it doesn't run off the MM Edit screen HelpStr = "This is a long string to~" '<<---- Comment out some of the following lines to see the effect HelpStr = HelpStr + "test the possibilities ~" HelpStr = HelpStr + "of a help screen that ~" HelpStr = HelpStr + "will flash up after a ~" HelpStr = HelpStr + "user touches a HELP ~" HelpStr = HelpStr + "button or to show any ~" HelpStr = HelpStr + "extra details that may~" HelpStr = HelpStr + "be needed in a program~" end sub
'------ sub ShowMsg ctrlval(#3) = HelpStr$ end sub
'------ sub ShowHelp Font 2 gui caption #3,"Gui~Caption~for~testing~alignment",10,mm.vres/2,Align,RGB(White),rgb(Black) end sub
Any ideas what I've done wrong on that one? It's most noticeable with REALLY long strings...
Thanks, John
John |