Home
JAQForum Ver 20.06
Log In or Join  
Active Topics
Local Time 17:03 14 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 : MM+ End Sub

     Page 2 of 2    
Author Message
TassyJim

Guru

Joined: 07/08/2011
Location: Australia
Posts: 5922
Posted: 09:22pm 22 Aug 2015
Copy link to clipboard 
Print this post

Paul,
In your code your interrupt is branching to a label instead of a subroutine.
It is difficult to give the 'best' solution because is depends a lot on what else you are doing.

Here I simple switch between 2 screens One with a button and one blank.
I don't bother testing to see which button was pressed and pressing the blank screen still triggers the interrupt.

GUI INTERRUPT CHOOSE

START:
ScreenOn

DO
IF chosen = 1 THEN ' we have triggered the touch
SELECT CASE activeScreen
CASE 1 ' main screen
ScreenOff
CASE 0 ' blank screen
ScreenOn
END SELECT
chosen = 0 ' we only want to respond to the touch once
ENDIF

LOOP

SUB ScreenOn
activeScreen = 1 ' record which screen is active
GUI BUTTON #1, "SELECT",50,100,185,40,RGB(Black),RGB(Green)
END SUB

SUB ScreenOff
activeScreen = 0
GUI DELETE #1
CLS
END SUB

SUB CHOOSE
chosen = 1 ' all we do in the subroutine is set a flag
END SUB


Jim

VK7JH
MMedit   MMBasic Help
 
palcal

Guru

Joined: 12/10/2011
Location: Australia
Posts: 1805
Posted: 09:48pm 22 Aug 2015
Copy link to clipboard 
Print this post

Thanks Jim that works but I have to touch the blank screen (with no button)
to return to the main screen. I want to return after after a pause of so many seconds.
But leave it with me to fiddle with I will learn more working it out myself. If I fail I will post back.
Thanks Paul.
"It is better to be ignorant and ask a stupid question than to be plain Stupid and not ask at all"
 
TassyJim

Guru

Joined: 07/08/2011
Location: Australia
Posts: 5922
Posted: 10:11pm 22 Aug 2015
Copy link to clipboard 
Print this post

A hint:
After calling screenOff in the main loop
do your pause 2000 then call ScreenOn

That way you return to the main screen after the delay or sooner if you tap the blank screen.

Jim
VK7JH
MMedit   MMBasic Help
 
palcal

Guru

Joined: 12/10/2011
Location: Australia
Posts: 1805
Posted: 12:02am 23 Aug 2015
Copy link to clipboard 
Print this post

Thanks Jim I already have it working as I want, I have edited the code in my project and it all works great.
Thanks for your help.
Paul.
"It is better to be ignorant and ask a stupid question than to be plain Stupid and not ask at all"
 
palcal

Guru

Joined: 12/10/2011
Location: Australia
Posts: 1805
Posted: 05:38pm 23 Aug 2015
Copy link to clipboard 
Print this post

re GUI BUTTON
Well I thought all was OK but on doing some more tests this morning things went rather awry. Everything worked OK for a few touches then funny things started happening.
Sometimes the TIME would not be displayed the location instead of reading MYSTIC SANDS would read ELLOW, when I touched the buttons the text in the button would disappear and be replaced with random text. When I checked the value of the variables eg. The location MYSTIC SANDS which is set at the start of the program and never changes I found the value had somehow changed to ELLOW.
So all I did was get rid of the GUI BUTTONS and replace them with RBOX with text inside it. NOW ALL IS PERFECT.
That is the way it is staying, I will have a look at GUI BUTTON again someday but for now I have had enough.
Paul.

Edit. It occurred to me that since the problem did not occur until the Buttons had been touched a couple of times, has it got something to do with the chip running out of memory. Whatever happened it was rather catastrophic.Edited by palcal 2015-08-25
"It is better to be ignorant and ask a stupid question than to be plain Stupid and not ask at all"
 
     Page 2 of 2    
Print this page


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

© JAQ Software 2024