Home
JAQForum Ver 20.06
Log In or Join  
Active Topics
Local Time 18:32 29 Apr 2024 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : GUI Displaybox

Author Message
busa
Regular Member

Joined: 12/02/2015
Location: Australia
Posts: 81
Posted: 03:45am 06 Jan 2017
Copy link to clipboard 
Print this post

Probably a stupid question, but how do I get 2 lines of text(or more) in a displaybox using Micromite Plus?..
 
Geoffg

Guru

Joined: 06/06/2011
Location: Australia
Posts: 3165
Posted: 04:08am 06 Jan 2017
Copy link to clipboard 
Print this post

In Ver 5.3 Beta 3 and later you can display multiple lines by using the tilde character (~) to separate each line in the string.

Geoff
Geoff Graham - http://geoffg.net
 
busa
Regular Member

Joined: 12/02/2015
Location: Australia
Posts: 81
Posted: 04:49am 06 Jan 2017
Copy link to clipboard 
Print this post

Ah, thanks Geoff, it's been driving me bonkers for the last couple of hours trying to get two lines of text. Will wait for the final 5.3 version as its not a critical issue, have just been trying out the newer commands in MM+ since acquiring an Explore 100 recently.
Regards
 
Phil23
Guru

Joined: 27/03/2016
Location: Australia
Posts: 1664
Posted: 11:08am 06 Jan 2017
Copy link to clipboard 
Print this post

Not sure If I've mentioned this before, but would it be possible to have a parameter to suppress the frame around DisplayBox etc?

If you were considering a border width parameter it could be included in that as width=0.

Reason being in some instances the display can become crowded.

This code for example:-

[Code]
Font 4
Gui Frame 99,"Temperatures",MM.HRes/80,MM.VRes*3.5/16,MM.FontWidth*15,MM.FontHeight*8,RGB(White)
Gui Caption C_TmpAmb,"Air ",MM.HRes/40, MM.VRes*5/16,LB,RGB(Cyan) : Gui Displaybox D_TmpAmb,MM.HRes*7/40,MM.VRes*4/16,MM.FontWidth*6,MM.VRes/16,,0
Gui Caption C_TmpCur,"Water ",MM.HRes/40, MM.VRes*6/16,LB,RGB(Green) : Gui Displaybox D_TmpCur,MM.HRes*7/40,MM.VRes*5/16,MM.FontWidth*6,MM.VRes/16
Gui Caption C_TmpInp,"Input ",MM.HRes/40, MM.VRes*7/16,LB,RGB(Blue) : Gui Displaybox D_TmpInp,MM.HRes*7/40,MM.VRes*6/16,MM.FontWidth*6,MM.VRes/16
Gui Caption C_TmpOut,"Output ",MM.HRes/40, MM.VRes*8/16,LB,RGB(Red) : Gui Displaybox D_TmpOut,MM.HRes*7/40,MM.VRes*7/16,MM.FontWidth*6,MM.VRes/16
Gui Caption C_TmpDif,"Diff ",MM.HRes/40, MM.VRes*9/16,LB,RGB(Magenta) : Gui Displaybox D_TmpDif,MM.HRes*7/40,MM.VRes*8/16,MM.FontWidth*6,MM.VRes/16
[/code]

Would view much cleaner without the individual frames, & just one frame around the lot. Much like I've done in a pure Basic graphics example.

[Code]
Text MM.HRes/40, MM.VRes*5/16, "Air Temp = ", LB,,, RGB(Cyan)
Text MM.HRes/40, MM.VRes*6/16, "Water Temp = ", LB,,, RGB(Green)
Text MM.HRes/40, MM.VRes*7/16, "Input Temp = ", LB,,, RGB(Blue)
Text MM.HRes/40, MM.VRes*8/16, "Output Temp = ", LB,,, RGB(Red)
Text MM.HRes/40, MM.VRes*9/16, "Temp Diff = ", LB,,, RGB(Magenta)
Text MM.HRes/40, MM.VRes*10/16, "Solar Volts = ", LB,,, RGB(Cyan)
Text MM.HRes/40, MM.VRes*11/16, "Flow Rate l/m ", LB,,, RGB(Yellow)
Text MM.HRes/40, MM.VRes*12/16, "Energy Watts ", LB,,, RGB(255,165,0)

Text MM.HRes*17/40, MM.VRes*5/16, Str$(TmpAmb,4,1), RB,,, RGB(Cyan)
Text MM.HRes*17/40, MM.VRes*6/16, Str$(TmpCur,4,1), RB,,, RGB(Green)
Text MM.HRes*17/40, MM.VRes*7/16, Str$(TmpInp,4,1), RB,,, RGB(Blue)
Text MM.HRes*17/40, MM.VRes*8/16, Str$(TmpOut,4,1), RB,,, RGB(Red)
Text MM.HRes*17/40, MM.VRes*9/16, Str$(TmpOut-TmpInp,4,1), RB,,, RGB(Magenta)
Text MM.HRes*17/40, MM.VRes*10/16, Str$(SlrVlt,4,1), RB,,, RGB(Cyan)
Text MM.HRes*17/40, MM.VRes*11/16, Str$(FlowRate,4,1), RB,,, RGB(Yellow)
Text MM.HRes*17/40, MM.VRes*12/16, Str$((FlowRate*60*(TmpOut-TmpInp)*.00117*1000),4,1), RB,,, RGB(255,165,0)
[/code]

Cheers

Phil
 
Geoffg

Guru

Joined: 06/06/2011
Location: Australia
Posts: 3165
Posted: 12:51pm 06 Jan 2017
Copy link to clipboard 
Print this post

Would GUI CAPTION do that for you?

Geoff
Geoff Graham - http://geoffg.net
 
busa
Regular Member

Joined: 12/02/2015
Location: Australia
Posts: 81
Posted: 02:52pm 06 Jan 2017
Copy link to clipboard 
Print this post

Hi Geoff,
What is the expression syntax for using the tilde character (~) to separate each line in the string. I have not been able to find any reference to it in the MM+ manual.
Regards

EDIT: For example I am trying to get this line of code to show on two lines in a display box, new line starting with 'and'.

ctrlval(display) = "The current temperature is " + str$(temp!) + "`C"~"and the relative humidity is " + str$(humidity!) + "%".

EDIT no2:
Doing it like this only gives the word 'and' on the second line.

ctrlval(display)="The current temperature is " + str$(temp!) + "`C~and the relative humidity is " + str$(humidity!) + "%"Edited by busa 2017-01-08
 
Grogster

Admin Group

Joined: 31/12/2012
Location: New Zealand
Posts: 9063
Posted: 03:16pm 06 Jan 2017
Copy link to clipboard 
Print this post

@ PHIL23 - I use Caption for this exactly as Geoff suggests. It does mean that you have to manually adjust the position of the text, but that is no real biggie as you only need to set it up once.

@ BUSA - You are building your string SLIGHTLY wrong from what I can see.

ctrlval(display) = "The current temperature is " + str$(temp!) + "`C"~"and the relative humidity is " + str$(humidity!) + "%".

Try:

ctrlval(display) = "The current temperature is " + str$(temp!) + "`C~and the relative humidity is " + str$(humidity!) + "%".

You have extra double-quote marks in the string.

Edited by Grogster 2017-01-08
Smoke makes things work. When the smoke gets out, it stops!
 
Phil23
Guru

Joined: 27/03/2016
Location: Australia
Posts: 1664
Posted: 03:23pm 06 Jan 2017
Copy link to clipboard 
Print this post

  Geoffg said   Would GUI CAPTION do that for you?

Geoff


Seem to recall trying GUI CAPTION, & from memory I needed to pull some trick to have the values update.

It certainly didn't behave dynamically they what I thought it might.
 
busa
Regular Member

Joined: 12/02/2015
Location: Australia
Posts: 81
Posted: 03:24pm 06 Jan 2017
Copy link to clipboard 
Print this post

Thanks Grogster but all that happens is in the edit to my last post. Just the one word (and)on the second line
 
Print this page


To reply to this topic, you need to log in.

© JAQ Software 2024