Home
JAQForum Ver 20.06
Log In or Join  
Active Topics
Local Time 07:25 03 May 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 TextBox issue...

Author Message
Grogster

Admin Group

Joined: 31/12/2012
Location: New Zealand
Posts: 9066
Posted: 11:26pm 20 Dec 2016
Copy link to clipboard 
Print this post

Hello folks.


Gui Setup 1
Font 7,4
GUI DISPLAYBOX #1,0,0,MM.HRES,75,RGB(yellow),RGB(Black)
CtrlVal(#1)="MAIN MENU:"
Font 4,1
GUI CAPTION #2,"Please touch one of the following buttons",70,110,LT,RGB(white)
GUI CAPTION #3,"to access the main system components:",100,135,LT,RGB(white)
Font 7,2
GUI button BU_MAIN1,"1",50,200,75,50,RGB(black),RGB(gray)
GUI button BU_MAIN2,"2",50,275,75,50,RGB(black),RGB(gray)
GUI button BU_MAIN3,"3",50,350,75,50,RGB(black),RGB(gray)
Font 7,2
GUI CAPTION #4,"DATABASE",150,210,LT,RGB(green)
GUI CAPTION #5,"OTHER OPTIONS",150,285,LT,RGB(green)
GUI CAPTION #6,"SEND A MESSAGE NOW",150,360,LT,RGB(green)

GUI Setup 2
Font 7,3
GUI DISPLAYBOX #7,0,0,MM.HRES,75,RGB(red),RGB(white)
CtrlVal(#7)="DATABASE MENU:"
Font 4,2
GUI CAPTION #8,"Access is restricted.",75,100,LT,RGB(yellow)
Font 4,1
GUI textbox PASSWORD,250,175,250,50,RGB(white),RGB(black)
CtrlVal(PASSWORD)="##PASSWORD"
GUI caption #9,"Touch the password box or EXIT.",125,275,LT,RGB(cyan)
Font 7,2
GUI button BU_EXIT,"EXIT",75,400,200,50,RGB(blue),RGB(gray)
GUI button BU_OK,"OK",525,400,200,50,RGB(red),RGB(gray)


Call Page 1 - draws the main menu(you will need to define font 7)
Call Page 2 - draws page 2.

That is fine.

Now, call Page 1 again - no problem.
Now, call Page 2 again - PREVIOUS entry in the TextBox shows up - code IGNORES your request for the TextBox prompt in the line: CtrlVal(PASSWORD)="##PASSWORD", and the previous data contents show up as the prompt. It does not matter if you issue a CtrlVal(PASSWORD)="" to clear that one BEFORE issuing the line with the double-hash in it, the old password attempt keeps showing up.

This is a big problem because once the password is entered correctly ONCE,it will automatically show up next time you enter that page.

Am I doing something wrong here?
Can anyone else confirm that with my code example above?
Smoke makes things work. When the smoke gets out, it stops!
 
Geoffg

Guru

Joined: 06/06/2011
Location: Australia
Posts: 3165
Posted: 12:35am 21 Dec 2016
Copy link to clipboard 
Print this post

Hmm, I'm away from my test setup for the next couple of weeks so I cannot test it. Can anyone else help?
Geoff Graham - http://geoffg.net
 
erbp
Senior Member

Joined: 03/05/2016
Location: Australia
Posts: 186
Posted: 01:50am 21 Dec 2016
Copy link to clipboard 
Print this post


GUI textbox PASSWORD,250,175,250,50,RGB(white),RGB(black)
CtrlVal(PASSWORD)="##PASSWORD"


Shouldn't the control name (PASSWORD) in both the above lines be a control ref # - e.g #10?

 
disco4now

Guru

Joined: 18/12/2014
Location: Australia
Posts: 844
Posted: 02:05am 21 Dec 2016
Copy link to clipboard 
Print this post

Hi
I see what you see, however I think I can see how this works. Think of the GUI SETUP 1 and GUI SETUP 2 code you have posted as a definition of the screens.
Doing a page 1 or page 2 from the command line or in a program does not literally run this code, but just brings back these screens as defined. (You would get errors about controls already existing if its run again).

I have added enough code in pendown to action the database menu and the OK buttons.

The OK button does a
CtrlVal(21)="##PASSWORD"
and the password prompt is there next time you select database.

So basically you have to fiddle with the value of the password field in the other code, its just defined in the GUI SETUP.

If you do this sequence
page 2
enter your password
page 1
CtrlVal(21)="##PASSWORD"
page 2

it will show the PASSWORD prompt when page 2 comes again.
Regards
Gerry



Gui Setup 1
Font 2,4
GUI DISPLAYBOX #1,0,0,MM.HRES,75,RGB(yellow),RGB(Black)
CtrlVal(#1)="MAIN MENU:"
Font 4,1
GUI CAPTION #2,"Please touch one of the following buttons",70,110,LT,RGB(white)
GUI CAPTION #3,"to access the main system components:",100,135,LT,RGB(white)
Font 2,2
GUI button 11,"1",50,200,75,50,RGB(black),RGB(gray)
GUI button 12,"2",50,275,75,50,RGB(black),RGB(gray)
GUI button 13,"3",50,350,75,50,RGB(black),RGB(gray)
Font 2,2
GUI CAPTION #4,"DATABASE",150,210,LT,RGB(green)
GUI CAPTION #5,"OTHER OPTIONS",150,285,LT,RGB(green)
GUI CAPTION #6,"SEND A MESSAGE NOW",150,360,LT,RGB(green)
GUI Setup 2
Font 2,3
GUI DISPLAYBOX #7,0,0,MM.HRES,75,RGB(red),RGB(white)
CtrlVal(#7)="DATABASE MENU:"
Font 4,2
GUI CAPTION #8,"Access is restricted.",75,100,LT,RGB(yellow)
Font 4,1

GUI textbox 21,250,175,250,50,RGB(white),RGB(black)
CtrlVal(21)="##PASSWORD"
GUI caption #9,"Touch the password box or EXIT.",125,275,LT,RGB(cyan)
Font 2,2
GUI button 14,"EXIT",75,400,200,50,RGB(blue),RGB(gray)
GUI button 15,"OK",525,400,200,50,RGB(red),RGB(gray)

GUI INTERRUPT PenDown
page 1
DO:LOOP

SUB pendown

SELECT CASE TOUCH(REF)
print touch(REF)
CASE 11
page 2
CASE 15
CtrlVal(21)="##PASSWORD"
page 1
END SELECT


EXIT SUB

Latest F4 Latest H7
 
Grogster

Admin Group

Joined: 31/12/2012
Location: New Zealand
Posts: 9066
Posted: 01:06pm 21 Dec 2016
Copy link to clipboard 
Print this post

  erbp said  Shouldn't the control name (PASSWORD) in both the above lines be a control ref # - e.g #10?



It is. I am using a descriptive variable. See advanced manual, page 29.

@ disco4now - Even when run inside a program, I still get the same issue. However, I will try you idea and let you know what happens.
Smoke makes things work. When the smoke gets out, it stops!
 
disco4now

Guru

Joined: 18/12/2014
Location: Australia
Posts: 844
Posted: 02:45pm 21 Dec 2016
Copy link to clipboard 
Print this post

Hi
Not sure if you have found this but the Micromite Plus Addendum has an Advanced Graphics Programing section at about page 30.

The key thing I got from it is that the page 1,page 2 commands just cause the controls on the selected page to display, and to hide all the controls on other pages.
They won't run the code that follows the initial GUI SETUP 1/2 commands. This is only ever run once at the start and is not run again.

The controls are always there whether displayed or not, so you can read or set their CtrlVal from anywhere.

In the case of the GUI Text box for password, it's control value is set in your GUI SETUP 2 section with
CtrlVal(21)="##PASSWORD"

The other way this value is changed is pressing the text and entering a new value via the keypad.i.e. entering the password.
doing page 1, page2 etc will not (and should not) affect the new value.They will merely hide,show various controls and not manipulate their values. So the textbox stays with the value you gave for password.
To change it you need to press the text again and enter a new value, or set it in program somewhere with CtrlVal(21)="##PASSWORD"

An obvious place to check its value, change it etc is when OK is pressed.

Regards
Gerry



Latest F4 Latest H7
 
Grogster

Admin Group

Joined: 31/12/2012
Location: New Zealand
Posts: 9066
Posted: 06:26pm 21 Dec 2016
Copy link to clipboard 
Print this post

  disco4now said  The key thing I got from it is that the page 1,page 2 commands just cause the controls on the selected page to display, and to hide all the controls on other pages.
They won't run the code that follows the initial GUI SETUP 1/2 commands. This is only ever run once at the start and is not run again.


Ahhhhh!
That would explain quite a bit - I thought it re-ran those page groups each time you called the page - a misunderstanding on my part, and would explain quite a lot.

I will change my code so that when that page is called, THAT is when I put the PASSWORD prompt in the box.

I think you have nailed it though.

EDIT: You are exactly right. My mistake. I moved the CtrlVal for the texbox so that it is inside the SUB that calls that page, and now it DOES replace the prompt correctly as expected. Nice one, my son. Thanks. Edited by Grogster 2016-12-23
Smoke makes things work. When the smoke gets out, it stops!
 
Print this page


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

© JAQ Software 2024