panky
 Guru
 Joined: 02/10/2012 Location: AustraliaPosts: 1116 |
| Posted: 04:19am 06 Jun 2018 |
Copy link to clipboard |
 Print this post |
|
John,
One way would be to create a DISPLAYBOX on page 1 of the size and position where you want to display the numberbox details then where you action your numberbox on page 2, add in the line to assign the value of the numberbox to the display box.
eg. The following code gives you an example
CLS
GUI INTERRUPT TouchDown,TouchUp InitPages font 3 DO PAGE 1 ' FONT 3 TEXT 0,0,"doing something on page 1" PAUSE 4000 ' wait a little bit PAGE 2 ' FONT 3 TEXT 0,0, "Enter a number in the box and press enter" DO LOOP UNTIL NumBoxEnter = 1 ' wait till Numberbox Enter pressed NumBoxEnter = 0 TEXT 0,0, " fall back to page 1 showing number" PAUSE 3000 CTRLVAL(#1) = "Number entered was "+STR$(CTRLVAL(#2)) ' plug numberbox value into displaybox LOOP
SUB InitPages ' doesn't have to be a sub as it is called only once ' but does make it easier to read and understand GUI SETUP 1 ' your page 1 FONT 3 GUI DISPLAYBOX #1, 100,100,400,60,RGB(WHITE),RGB(BLACK) ' note does not have to be in the same position as the numberbox below
GUI SETUP 2 ' your page 2 FONT 3 GUI NUMBERBOX #2,100,100,150,60,RGB(WHITE),RGB(BLACK) END SUB
SUB TouchDown 'not used for this demo END SUB
SUB TouchUp ' numberbox Enter pressed NumBoxEnter = 1 END SUB
... almost all of the Maximites, the MicromMites, the MM Extremes, the ArmMites, the PicoMite and loving it! |
macca Newbie
 Joined: 21/02/2017 Location: AustraliaPosts: 32 |
| Posted: 02:37pm 12 Jun 2018 |
Copy link to clipboard |
 Print this post |
|
Hi to all Code below How can I get the number box results on page 2 to show in the box on page 1. Sorry Panky but I am bit confused at this stage, Maybe I am going about this in the wrong way??
'Pages cls Const frm_ind = 20: frm_out = 22:frm_hpa = 23 Const frm_log = 40, cb_enabled = 41, c_fname = 42, tb_fname = 43 Const c_log = 44, cb_flow = 45, cb_alarm = 48, cb_warn = 49 Const frm_alarm = 50, nbr_hi = 51, nbr_lo = 52 Const c_hi = 54, c_lo = 55 Const led_high = 56, led_low = 57 Const c_bright = 58, sb_bright = 59 Const frm_logs = 61, c_det = 63, c_head = 62, c_al = 64 '***************************************************** ' Page 1 Gui Setup 1 Font 2,2 GUI DISPLAYBOX #1,0,0,MM.HRES,75,RGB(yellow),RGB(Black) CtrlVal(#1)="Page 1" Font 2,1 GUI button 11,"1",50,400,100,30,RGB(black),RGB(gray)' button 1 Font 2,1 GUI CAPTION #4,"Page 2",55,380,LT,RGB(green) GUI CAPTION #25,"Temp High",320,195,LT,RGB(green) ' Display box showing high temp settings GUI DISPLAYBOX #66, 450, 190, 75, 30,RGB(yellow),RGB(Black) '***************************************************** GUI Setup 2 Font 2,1 Colour RGB(cyan), 0 'alarm frame font 3,1 GUI Caption c_head, "Page 2", 320, 50,, RGB(80, 200, 120) Font 2 GUI Caption c_al, "Set Alarm Temp", 85, 130,, RGB(237, 145, 33) GUI Caption c_hi, "Temp High:", 70, 175,, RGB(yellow) GUI Numberbox nbr_hi, 195, 170, 60, 30, RGB(yellow),RGB(64,64,64) ' Set the high temp alarm GUI button 16,"EXIT",50,380,120,50,RGB(blue),RGB(gray) ' Back to page 1 '***************************************************** GUI INTERRUPT PenDown page 1 DO:LOOP
SUB pendown
SELECT CASE TOUCH(REF) print touch(REF) CASE 11 page 2 ' touch for page 2 CASE 16 page 1 END SELECT
EXIT SUB
Not sure if this is the way to show code Regards John |
panky
 Guru
 Joined: 02/10/2012 Location: AustraliaPosts: 1116 |
| Posted: 02:49am 13 Jun 2018 |
Copy link to clipboard |
 Print this post |
|
Macca,
The GUI NUMBERBOX command generates 2 interrupts, a TouchDown when the NUMBERBOX is first selected and a TouchUp interrupt when the Ent key on the on-screen number box display is pressed.
The on-screen numberbox ENT key also sets the number entered into the control value. Thus, in a second subroutine for TouchUp, you would assign the values from the NUMBERBOX CTRLVAL to a variable.
It is also usefull to set a flag in both routines to allow you to test in your main program loop. When checked, the flags should be cleared ready for the next touch.
eg.
Initialise: ' do all setup functions here
GUI INTERRUPT TouchDown,TouchUp
Main: ' main program loop DO ' if you want to wait on a touch to do something DO LOOP UNTIL TouchDownFlag = 1 IF TouchDownFlag = 1 THEN ' process the touch down action with SELECT CASE subroutines SELECT CASE TOUCH(REF) ' which ctrlval used? CASE 1 value_in_ctrlval_1 = CTRLVAL(1) ' etc, etc for any other number boxes END SELECT TouchDownFlag = 0 ' reset ready for next touch ENDIF IF TouchUpFlag = 1 THEN ' process the touch action with SELECT CASE subroutines SELECT CASE TOUCH(REF) ' which numberbox used? CASE numberbox_1 value_in_numberbox_1 = CTRLVAL(number_box_1) ' etc, etc for any other number boxes END SELECT TouchUpFlag = 0 ' reset for next numberbox touch ENDIF
' do whatever else needs to be done in your main program loop LOOP
SUB TouchDown ' blah blah, anything else needing to be done with a touchdown TouchDownFlag = 1 END SUB
SUB TouchUp TouchUpFlag = 1 END SUB
This is just an idea and sample code - it will need to be modified for your particular program.
Hope this helps, panky
... almost all of the Maximites, the MicromMites, the MM Extremes, the ArmMites, the PicoMite and loving it! |