Home  |  Contents 

Microcontroller and PC projects
  Forum Index : Microcontroller and PC projects         Section
Subject Topic: Numberbox Post ReplyPost New Topic
Author
Message << Prev Topic | Next Topic >>
macca
Newbie
Newbie


Joined: 21 February 2017
Location: Australia
Online Status: Offline
Posts: 32
Posted: 05 June 2018 at 9:38pm | IP Logged Quote macca

Hi to all
I have two pages and on the second page there is a numberbox. On entering a number in the numberbox (Page 2) is there a way to print the results of the numberbox on page 1
regards
John


Back to Top View macca's Profile Search for other posts by macca
 
panky
Guru
Guru
Avatar

Joined: 02 October 2012
Location: Australia
Online Status: Offline
Posts: 521
Posted: 06 June 2018 at 2:19pm | IP Logged Quote panky

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



__________________
DonTSM1,Duinomite,CGCMM1,CGCMM2,2xDimitech,3xWWuMites,MicksMuP,Grogster1A,4xPeterMuM+,Zonker DIP-600,3xCGuKits,CGuBoard2,SnadPic100,SCBP64 & Exp100,PMMZ144,PMMZ100 .. and loving it![:D
Back to Top View panky's Profile Search for other posts by panky
 
macca
Newbie
Newbie


Joined: 21 February 2017
Location: Australia
Online Status: Offline
Posts: 32
Posted: 06 June 2018 at 11:50pm | IP Logged Quote macca

Hi and thank you panky for your reply
I will play around with this tomorrow.
Cold wet and miserable here in the west
regards
John
Back to Top View macca's Profile Search for other posts by macca
 
panky
Guru
Guru
Avatar

Joined: 02 October 2012
Location: Australia
Online Status: Offline
Posts: 521
Posted: 07 June 2018 at 9:19am | IP Logged Quote panky

John,
Anywhere near Mount Barker? Have a brother there who is an MM wizard (bit shy, not on the backshed yet)
panky

__________________
DonTSM1,Duinomite,CGCMM1,CGCMM2,2xDimitech,3xWWuMites,MicksMuP,Grogster1A,4xPeterMuM+,Zonker DIP-600,3xCGuKits,CGuBoard2,SnadPic100,SCBP64 & Exp100,PMMZ144,PMMZ100 .. and loving it![:D
Back to Top View panky's Profile Search for other posts by panky
 
macca
Newbie
Newbie


Joined: 21 February 2017
Location: Australia
Online Status: Offline
Posts: 32
Posted: 07 June 2018 at 12:20pm | IP Logged Quote macca

No I live in Merredin on the Great Eastern Highway about 265K from Perth. I also was a bit shy and finally made the jump to join the backshed. Great sources of information and the people are friendly and very helpful.
Best regards
John
Back to Top View macca's Profile Search for other posts by macca
 
macca
Newbie
Newbie


Joined: 21 February 2017
Location: Australia
Online Status: Offline
Posts: 32
Posted: 13 June 2018 at 12:37am | IP Logged Quote macca

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??
[CODE][/CODE]
'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
Back to Top View macca's Profile Search for other posts by macca
 
panky
Guru
Guru
Avatar

Joined: 02 October 2012
Location: Australia
Online Status: Offline
Posts: 521
Posted: 13 June 2018 at 12:49pm | IP Logged Quote panky

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



__________________
DonTSM1,Duinomite,CGCMM1,CGCMM2,2xDimitech,3xWWuMites,MicksMuP,Grogster1A,4xPeterMuM+,Zonker DIP-600,3xCGuKits,CGuBoard2,SnadPic100,SCBP64 & Exp100,PMMZ144,PMMZ100 .. and loving it![:D
Back to Top View panky's Profile Search for other posts by panky
 


If you wish to post a reply to this topic you must first login
If you are not already registered you must first register

  Search the forums using Google.
In the news...
 
Post ReplyPost New Topic
Printable version Printable version
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum

Powered by Web Wiz Forums version 7.8
Copyright ©2001-2004 Web Wiz Guide

This page was generated in 0.2188 seconds.
Privacy Policy     Process times : 0.11, 0, 0, 0.11