Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 02:23 17 Jun 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 Frame refresh

Author Message
Bizzie
Senior Member

Joined: 06/07/2014
Location: Australia
Posts: 185
Posted: 03:22pm 19 Jan 2016
Copy link to clipboard 
Print this post

Hi All,

Seems like there may be a problem with updating the text on a frame.
I would like to have the time as the text of a frame but the code below does not update the frame.

Micromite Plus MMBasic Ver 4.7 Beta 37
Copyright 2011-2015 Geof
> option list
OPTION DISPLAY 48, 132
OPTION LCDPANEL ILI9341, LANDSCAPE, 21, 22, 23
OPTION TOUCH 18, 14
OPTION SDCARD 49
> list
Option explicit ON

Const pg9Frm = 1
Const pg9Val1 = 2


CLS
GUI FRAME pg9Frm, Time$ + " " + Date$, 0,13,MM.HRes,MM.VRes,RGB(Yellow)
GUI CAPTION pg9Val1, "???",10,70,LB,RGB(Yellow),RGB(Black)

SetTick 1000, PrnTime

Do


Loop

Sub PrnTime
Print DT$()

CtrlVal(pg9Frm) = DT$()
CtrlVal(pg9Val1) = DT$()
End Sub


Function DT$() As string
DT$ = Time$ + " " + Date$
End Function
> run
00:00:36 01-01-2000
00:00:37 01-01-2000
00:00:38 01-01-2000
00:00:39 01-01-2000
00:00:40 01-01-2000
00:00:41 01-01-2000
00:00:42 01-01-2000
>


Seeing this code does not cause an error it must be OK to do what I want.

Just had a though and added this line :-

Option Error Abort

BUT did not change problem.Edited by Bizzie 2016-01-21
Rob White
 
TassyJim

Guru

Joined: 07/08/2011
Location: Australia
Posts: 5950
Posted: 06:38pm 19 Jan 2016
Copy link to clipboard 
Print this post

I think a frame is a static element which wouldn't usually get changed during program execution.

I am not sure if overlapping GUI elements is wise, if fact I am sure that it is NOT wise, but this is one way of getting what you are after.
Option explicit ON

Const pg9Frm = 1
Const pg9Val1 = 2


CLS
GUI FRAME pg9Frm, " ", 0,13,MM.HRes,MM.VRes,RGB(Yellow)
GUI CAPTION pg9Val1, "???",20,20,LB,RGB(Yellow),RGB(Black)

SetTick 1000, PrnTime

Do


Loop

Sub PrnTime
Print DT$()

CtrlVal(pg9Frm) = DT$()
CtrlVal(pg9Val1) = DT$()
End Sub


Function DT$() As string
DT$ = Time$ + " " + Date$
End Function


All I did was create a blank space in the frame and positioned the caption to fill that space.

You could delete and recreate the frame each second but that is likely to upset any elements that are relying on the frame such as radio buttons.

Jim
VK7JH
MMedit   MMBasic Help
 
Grogster

Admin Group

Joined: 31/12/2012
Location: New Zealand
Posts: 9133
Posted: 06:46pm 19 Jan 2016
Copy link to clipboard 
Print this post

  TassyJim said  I am not sure if overlapping GUI elements is wise, if fact I am sure that it is NOT wise, but this is one way of getting what you are after.


Do you think that includes creating multiple GUI elements but keeping them hidden?

IE: Create all your GUI element after issuing GUI DEFAULT HIDDEN, but then just show the ones you want - see page 23 of advanced manual. In this way, all GUI elements are initially hidden, but technically speaking, they will all overlap - there is no way to avoid it, when you need several screens of GUI controls. However, you are only enabling the ones on that screen vis GUI SHOW.

Do you see any issues there?

...and I digress a little from the thread topic(apologies to OP), but watching any/all threads about GUI at the moment....
Smoke makes things work. When the smoke gets out, it stops!
 
Bizzie
Senior Member

Joined: 06/07/2014
Location: Australia
Posts: 185
Posted: 06:50pm 19 Jan 2016
Copy link to clipboard 
Print this post

I would like to put the time in the frame to save some space on the 2.4" screens.
If it was not allowed I would assume it would generate an error.
Rob White
 
TassyJim

Guru

Joined: 07/08/2011
Location: Australia
Posts: 5950
Posted: 07:23pm 19 Jan 2016
Copy link to clipboard 
Print this post

  Grogster said  
Do you think that includes creating multiple GUI elements but keeping them hidden?

Hidden or disabled should be OK but having two GUI elements trying to detect the same touch is likely to cause grief.

I am not the best person to advise. I have done very little work with the GUI so far and what I have done has been very basic.

Overlapping FRAME and CAPTION seems to work OK but they are but passive elements. Adding input elements is where I would be careful.

Jim

VK7JH
MMedit   MMBasic Help
 
Geoffg

Guru

Joined: 06/06/2011
Location: Australia
Posts: 3169
Posted: 09:27pm 19 Jan 2016
Copy link to clipboard 
Print this post

I never thought of dynamically updating the caption in a frame which is why MMBasic does not check for that. But, it is easy to do. I am just finishing off the final version 5.1 so I will add that in before the close.

On overlapping GUI controls. Yes, you can have them overlapping so long as they are not looking for touch input. So, overlapping hidden controls is fine.

Geoff
Geoff Graham - http://geoffg.net
 
lew247

Guru

Joined: 23/12/2015
Location: United Kingdom
Posts: 1676
Posted: 10:40am 18 Jun 2016
Copy link to clipboard 
Print this post

I have been playing around with a 7" SSD 1963 LCD a micromite 64 pin and RTC connected, using MMBasic 5.1 and trying to learn the GUI commands

Can someone explain WHY I'm getting the time in the GUI FRAME as well as displayed in the Frame where I actually wanted it?

Remember I'm still extremely new to programming and struggling to get things into my head.
Why does the code "have to have the CONST lines?

Also is it possible to specify a background colour for the frame?

Also is it possible to make the font inside the frame larger?

sorry for so many "weird" questions.

[code]
Option explicit ON
RTC GETTIME

Const abc = 1
Const bcd = 2
CONST cde = 3
CONST def = 4

CLS
GUI FRAME abc,"",50,50,600,350,RGB(RED)
GUI CAPTION bcd,"",325,220,LB,RGB(BLUE)

SetTick 1000, PrnTime
GUI FRAME cde,"" , 80,80,200,100,RGB(GREEN)
GUI CAPTION def, "Hello Lewis", 120,120,LB,RGB(WHITE)

Do

Loop

Sub PrnTime

CtrlVal(abc) = DT$()
CtrlVal(bcd) = DT$()
End Sub

Function DT$() As string
DT$ = Time$ + " " + Date$
End Function
[/code]
Edited by lew247 2016-06-19
 
Print this page


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

© JAQ Software 2024