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.
Joined: 31/12/2012 Location: New ZealandPosts: 9084
Posted: 02:49am 01 Sep 2017
Copy link to clipboard
Print this post
It does.
These are normal results. Yours are really badly off. Smoke makes things work. When the smoke gets out, it stops!
lew247
Guru
Joined: 23/12/2015 Location: United KingdomPosts: 1676
Posted: 05:52am 01 Sep 2017
Copy link to clipboard
Print this post
The problem was the touchscreen Luckily I had a spare put away somewhere, found it and connected it and it works great The buzzer even beeps now when the screen it touched :)
Now is there any way to "draw" 2 arrows? 1 in red and 1 in blue? Red facing up and the blue facing down but I only want one displayed at any one time? Edited by lew247 2017-09-02
lew247
Guru
Joined: 23/12/2015 Location: United KingdomPosts: 1676
Posted: 06:14am 02 Sep 2017
Copy link to clipboard
Print this post
Can someone check this code and tell me if it "should" work please?
It draws the boxes properly and Touch "SHOULD" work in the boxes but its not maybe I've made a "stupid" mistake?
[code] rBOX 560 ,295,170,50,10,RGB(BLACK),RGB(131,178,37) 'displaybox "Tomorrow" rbox 560 ,355,170,50,10,RGB(BLACK),RGB(GREEN) 'displaybox "Day 2" rBOX 560 ,415,170,50,10,RGB(BLACK),RGB(BLUE) 'displaybox "Day 3" TEXT 640,320, "Tomorrow", CM, 3, 1, RGB(black),RGB(131,178,37) TEXT 640,380, "Day 2", CM, 3, 1, RGB(black),RGB(GREEN) TEXT 640,440, "Day 3", CM, 3, 1, RGB(black),RGB(BLUE)
' '***********************IF the Buttons are touched******************************** IF Touch(X)>560 AND Touch(X)<(730) AND Touch(Y)>295 AND Touch(Y)< (345) THEN print "Tomorrow Touched" 'If Touch pressed IF Touch(X)>560 AND Touch(X)<(730) AND Touch(Y)>355 AND Touch(Y)< (405) THEN print "Day 2 Touched" 'If Touch pressed IF Touch(X)>560 AND Touch(X)<(730) AND Touch(Y)>415 AND Touch(Y)< (465) THEN print "Day 3 Touched" 'If Touch pressed [/code]Edited by lew247 2017-09-03
Grogster
Admin Group
Joined: 31/12/2012 Location: New ZealandPosts: 9084
Posted: 02:36pm 02 Sep 2017
Copy link to clipboard
Print this post
Great you found the touchscreen was crook - something was not right there....
Why are you NOT using buttons and advanced GUI controls? IE: Why are you using touch co-ordinates instead of buttons, and basic drawing commands like TEXT instead of GUI CAPTION?
GUI BUTTON will automatically configure the touch co-ordinates for you. All you have to do, is define the button with the GUI BUTTON command.
As an example, take the following button:
This will draw a large-ish button down the bottom of a 7" LCD, then when you touch it, it will animate as being touched, and will make the 'Click' noise from the peizo if you have set up that side of things.
This will keep running, even at the command prompt, so if you type in the above at the command prompt and press ENTER(change BU_MR_ACK to a number), you should get a button on the screen, and when you touch it, it should 'Click' and look like it is depressed. Release it, and it should pop back up again.
To check this button, you use the TOUCH(REF) function inside a GUI INTERRUPT, such as this:
Then you catch that touch inside a loop.
I will try to find a little time tonight to take YOUR example, and just re-format it with touch buttons, captions, and an interrupt so you can see the whole picture if what I am writing here still has you scratching your head.
Don't worry if you ARE still scratching your head - GUI's are confusing for a start. Edited by Grogster 2017-09-04Smoke makes things work. When the smoke gets out, it stops!
lew247
Guru
Joined: 23/12/2015 Location: United KingdomPosts: 1676
Posted: 09:37pm 02 Sep 2017
Copy link to clipboard
Print this post
I did try GUI BUTTON but I couldn't get it to do what I wanted because I want it to jump to a sub when it is pressed but what I found is while it is pressed it kept going to that sub and nothing else until I touched the button again to release it
Unless you know a way to get it to only go to the sub once :)
Grogster
Admin Group
Joined: 31/12/2012 Location: New ZealandPosts: 9084
Posted: 10:26pm 02 Sep 2017
Copy link to clipboard
Print this post
You probably need some flags to tell the system what the state of the button is. I will rustle up some demo code in the next few hours and post it here.Smoke makes things work. When the smoke gets out, it stops!
KeepIS
Guru
Joined: 13/10/2014 Location: AustraliaPosts: 1401
Posted: 10:41pm 02 Sep 2017
Copy link to clipboard
Print this post
The two code examples I posted on Page 2 take care of that. Here it is again.
In this case you were using a switch, changing it to a button is correct way to go.
Select CASE Touch(REF) CASE GUI_TOMORROW TOMORROW CASE GUI_DAY2 DAY2 CASE GUI_DAY3 DAY3 END SELECT
END SUB
Or do it this way in the main loop.
DIM ThisControl as integer
Sub PenDown()
Select CASE Touch(REF) CASE GUI_TOMORROW ThisControl = 1 CASE GUI_DAY2 ThisControl = 2 CASE GUI_DAY3 ThisControl = 3 END SELECT
END SUB
DO IF ThisControl = 1 then TOMORROW IF ThisControl = 2 then DAY2 IF ThisControl = 3 then DAY3
ThisControl = 0
LOOP
Edited by KeepIS 2017-09-04It's all too hard. Mike.
Grogster
Admin Group
Joined: 31/12/2012 Location: New ZealandPosts: 9084
Posted: 12:01am 03 Sep 2017
Copy link to clipboard
Print this post
Completely agree with KeepIS above, so I won't bother to post any demo code.
TOMORROW, DAY2 and DAY3 are your subroutine names that you want to call.
Please do stick with it - GUI is confusing for a start, but hang in there, cos once you know how to do it, it is a fabulous feature to know how to use.Smoke makes things work. When the smoke gets out, it stops!
GoodToGo!
Senior Member
Joined: 23/04/2017 Location: AustraliaPosts: 188
Posted: 12:28pm 03 Sep 2017
Copy link to clipboard
Print this post
I might chime in here,
Both the Grog-man and KeepIS are right, but if I may, I'll just make a couple of additions to KeepIS' code to hopefully make it easier to understand:-
Select CASE Touch(REF) CASE GUI_TOMORROW 'is the TOMORROW button pressed? TOMORROW 'call sub TOMORROW CASE GUI_DAY2 'is the DAY2 button pressed? DAY2 'call sub DAY2 CASE GUI_DAY3 'is the DAY3 button pressed? DAY3 'call sub DAY3 CASE ELSE 'the "oops I didn't expect this" case EXIT SUB END SELECT
END SUB
Sub TOMORROW
'your code here
END SUB
Sub DAY2
'your code here
END SUB
Sub DAY3
'your code here
END SUB
Personally I think in this case GUI BUTTON's instead of SWITCH's are the way to go. The Button is a momentary type of control, whereas the switch is a click on/ click off job. It's definitely worth converting all of your controls to the GUI set of commands. They are a lot easier to work with.
Hope the above makes sense,
GTG! ...... Don't worry mate, it'll be GoodToGo!
lew247
Guru
Joined: 23/12/2015 Location: United KingdomPosts: 1676
Posted: 09:09pm 04 Sep 2017
Copy link to clipboard
Print this post
Thank you so much everyone I really couldn't get my head around how the gui interrupt worked and how touching the button worked thanks to everyone it's now really clear and really simple once you actually understand it
lew247
Guru
Joined: 23/12/2015 Location: United KingdomPosts: 1676
Posted: 06:56am 16 Sep 2017
Copy link to clipboard
Print this post
Is there a way to delete display boxes?
AN example is The main program draws display boxes in the top left quarter of the screen If I call a subroutine by touching a button Is there any way to delete those display boxes? There's a background picture so I ideally don't want to do a CLS
matherp Guru
Joined: 11/12/2012 Location: United KingdomPosts: 8608
Posted: 07:07am 16 Sep 2017
Copy link to clipboard
Print this post
MM+ manual
GUI HIDE
or
GUI DELETE
lew247
Guru
Joined: 23/12/2015 Location: United KingdomPosts: 1676
Posted: 07:48am 16 Sep 2017
Copy link to clipboard
Print this post
Thanks Peter, I do read the manuals but unfortunately I forgot things like GUI Hide after I started working out how GUI worked.
lew247
Guru
Joined: 23/12/2015 Location: United KingdomPosts: 1676
Posted: 08:00am 16 Sep 2017
Copy link to clipboard
Print this post
Just tried GUI HIDE and unfortunately it replaces the GUI button with a black box (current background colour) Edit: GUI DELETE does the same as GUI HIDE What I'd like to do is remove the button but leave the background picture there instead of a black box I presume this isn't possibleEdited by lew247 2017-09-17