|
Forum Index : Microcontroller and PC projects : GUI AREA overlaying DISPLAYBOX
| Author | Message | ||||
| panky Guru Joined: 02/10/2012 Location: AustraliaPosts: 1116 |
I have been trying to create some Display Boxes with text but have them respond to touch (yes, I know a basic Display Box does NOT respond to touch), so I created an area using GUI AREA that overlays the same area as the DisplayBox so I could catch the touch. The area defined by the DisplayBox however seems to blank out any touch within that area. I made the AREA command slightly larger than the DisplayBox to test - if you touch just outside the DisplayBox it works but inside the area defined for DisplayBox ,nothing. Can anyone advise if this is a bug or just a limitation of the GUI commands? Tested on a MM+ with ILI LCD and an MM Extreme with SSD display, both running 5.04.05. Test program below Const DBox1 = 1 Const DBox2 = 2 Const LED1 = 21 Const LED2 = 22 Const AREA1 = 31 Const AREA2 = 32 ' Initialise pwm 2,1000,50 gui interrupt TouchDown cls rgb(60,60,30) font 2,2 gui Displaybox DBox1,10,10,100,50,rgb(green),rgb(120,120,100) gui Displaybox DBox2,10,80,100,50,rgb(blue),rgb(120,120,100) gui area AREA1,0,0,120,70 gui area AREA2,0,70,120,70 gui led LED1,"",160,35,20,rgb(RED) gui led LED2,"",160,105,20,rgb(RED) 'Main program loop ctrlval(LED1) = 1 ctrlval(LED2) = 0 ctrlval(DBox1) = "DB 1" ctrlval(DBox2) = "DB 2" do pause 2000 loop ' Interrupt service routines ' Touch Down sub TouchDown select case Touch(REF) case AREA1 ctrlval(LED1) = 1 ctrlval(LED2) = 0 case AREA2 ctrlval(LED2) = 1 ctrlval(LED1) = 0 end select end sub panky ... almost all of the Maximites, the MicromMites, the MM Extremes, the ArmMites, the PicoMite and loving it! |
||||
| panky Guru Joined: 02/10/2012 Location: AustraliaPosts: 1116 |
Further to my previous post, I can confirm that the GUI AREA is NOT masked by the GUI LED command - that is, even though the GUI LED is not touch sensitive, you can make it so with the GUI AREA command to cover the same area as the LED. To my mind, there is an inconsistancy there which appears to be a bug. panky ... almost all of the Maximites, the MicromMites, the MM Extremes, the ArmMites, the PicoMite and loving it! |
||||
| Geoffg Guru Joined: 06/06/2011 Location: AustraliaPosts: 3308 |
Interesting problem. When the screen is touched MMBasic will check the list of controls to determine if the touch is within the bounds of a control and, if it is, deals with it appropriately - which in the case of a DISPLAYBOX is to ignore the touch. Once a control has been found the scan is terminated. The scan is made starting with control number 1 and increments upwards. So, if you made the control number of the AREA control less than the number for the DISPLAYBOX, the AREA control will be found first and that is what will respond to the touch. I will update the documentation accordingly. Geoff Geoff Graham - http://geoffg.net |
||||
| panky Guru Joined: 02/10/2012 Location: AustraliaPosts: 1116 |
Thanks Geoff, understood. panky ... almost all of the Maximites, the MicromMites, the MM Extremes, the ArmMites, the PicoMite and loving it! |
||||
| Azure Guru Joined: 09/11/2017 Location: AustraliaPosts: 446 |
Is it just me or is this forum page corrupted somehow? Starts off normally but then at the first signature block it loses the layout info and everything after that is on the page background. *edit: actually it might be something in the end of the embedded code/image. |
||||
| CaptainBoing Guru Joined: 07/09/2016 Location: United KingdomPosts: 2171 |
no and yes |
||||
Grogster![]() Admin Group Joined: 31/12/2012 Location: New ZealandPosts: 9750 |
Yes, it is all wonky. Smoke makes things work. When the smoke gets out, it stops! |
||||
| Gizmo Admin Group Joined: 05/06/2004 Location: AustraliaPosts: 5157 |
Fixed it, thanks for heads up Azure. Panky's code confused the forum display subroutines. There was a bunch of forum formatting tags mixed in there, a QUOTE tag caused the problem. No one's fault. Glenn The best time to plant a tree was twenty years ago, the second best time is right now. JAQ |
||||
| panky Guru Joined: 02/10/2012 Location: AustraliaPosts: 1116 |
Glenn, I think what I did wrong was take some MMEdit 'Formatted for TBS' code and pasted it in between Code delimiters - I re-read Jim's post and he says, and I quote - Apologies, panky ... almost all of the Maximites, the MicromMites, the MM Extremes, the ArmMites, the PicoMite and loving it! |
||||
| The Back Shed's forum code is written, and hosted, in Australia. | © JAQ Software 2025 |