Posts: 597
Threads: 110
Joined: Apr 2022
Reputation:
34
(08-07-2023, 10:03 PM)justsomeguy Wrote: Quote:This is only problematic if a zone has sub-zones.
Sub zones aren't really a problem.
Code: (Select All) _DEST hiddenScreen
finalColor = _RGBA32(zone, subzone, subsubzone,subsubsubzone)
LINE(10, 10)-(30 ,20), finalcolor, BF
Code: (Select All) DO WHILE _MOUSEINPUT ' Check the mouse status
mx = _MOUSEX
my = _MOUSEY
LOOP
_SOURCE hiddenScreen
pt = POINT(mx,my)
zone = _red(pt)
subzone = _green(pt)
subsubzone = _blue(pt)
subsubsubzone = _alpha(pt)
_SOURCE 0
Oh yeah, rbga components. I was just thinking "a color".
That's brilliant!
Posts: 3,965
Threads: 176
Joined: Apr 2022
Reputation:
219
08-07-2023, 11:37 PM
(This post was last modified: 08-07-2023, 11:37 PM by bplus.)
(08-07-2023, 09:22 PM)justsomeguy Wrote: Perhaps it would be better to demonstrate.
This is a GUI demo program I was writing for a bigger project. I utilize the technique I talked about earlier.
You can currently resize and move windows. You double-click to add windows and close them.
Sorry, its messy, I never intended to share it until was in a better state.
Hey, really nice start on GUI! I am curious about XML stuff but this is wrong thread to ask.
b = b + ...
Posts: 476
Threads: 25
Joined: Nov 2022
Reputation:
45
(08-07-2023, 07:55 PM)justsomeguy Wrote: A method that I've used, which is relatively simple to implement, is use screen masking.
You draw your menu or whatever on the first screen like normal.
Then you create an image the same size as your target screen. This will be the hidden overlay.
Code: (Select All) hiddenScreen = _NEWIMAGE(_WIDTH(0), _HEIGHT(0), 32)
On the second screen (the hidden screen) you mask off the areas that you want the mouse to be sensitive to, and you assign specific colors to those areas.
Code: (Select All) myButton_1 = 1 ' Assign Numbers to masked off areas (colors)
myButton_2 = 2
_DEST hiddenScreen
LINE(10, 10) - (30 ,20), myButton_1, BF
LINE(50, 10) - (80 ,20), myButton_2, BF
_DEST 0
And when you want check your mouse.
Code: (Select All) DO WHILE _MOUSEINPUT ' Check the mouse status
mx = _MOUSEX
my = _MOUSEY
LOOP
_SOURCE hiddenScreen
buttonTouched = POINT(mx ,my)
_SOURCE 0
I find this easier than making a large number of conditionals for my mouse position.
(Forgive me, I haven't tested this code, but it conveys the general idea.) Clever!
Sort of like an HTML Image map. (Map element). That's a good easy way to separate things too. If mouse is over hidden part will POINT() return 0 or ?
Really smart!
Posts: 476
Threads: 25
Joined: Nov 2022
Reputation:
45
(08-07-2023, 02:36 PM)bplus Wrote: Yeah this is essential functionality, it is core of my GUI stuff and just about any game I've done.
SdlBasic called these MouseZones and had a function for IDing which you were in.
My goodness another basic! This one uses SDL nice! Does it work on Linux?
Posts: 476
Threads: 25
Joined: Nov 2022
Reputation:
45
(08-07-2023, 03:29 PM)TerryRitchie Wrote: (08-07-2023, 02:32 PM)grymmjack Wrote: (08-07-2023, 08:36 AM)TerryRitchie Wrote: Here's a quick and dirty demo I wrote as another possibility of defining screen areas to interact with the mouse. Your version of quick and dirty is of great quality! Is it OK to use this in our own projects?
This is an awesome example, thank you for sharing it!
Screenshot for others:
Thank you. Any and all code I post is freely available to everyone to modify and use for their needs. Hack away Awesome thank you. Your code is easy to understand and follow. I never finished studying the tutorials you made. Now I know I should. Also, have you done any more?
Thanks @TerryRitchie !
Posts: 476
Threads: 25
Joined: Nov 2022
Reputation:
45
08-08-2023, 12:17 AM
(08-07-2023, 09:37 PM)CharlieJV Wrote: (08-07-2023, 03:34 PM)TerryRitchie Wrote: (08-07-2023, 02:36 PM)bplus Wrote: Yeah this is essential functionality, it is core of my GUI stuff and just about any game I've done.
SdlBasic called these MouseZones and had a function for IDing which you were in. . Need to test the daylights out of it first, but _mouseZone(x,y,w,h), w and h being optional, as in _mouseZone(x,y) meaning 1 pixel wide and 1 pixel tall, later tonight in a new version of BAM.
No pressure ?
ARG! Screenshot did not capture the mouse pointer. This is why the internet is great. Look at all the good stuff happening. You guys are the best.
This is the spirit of community I remember from the old days.
Sorry, I am just moved inside to see this good work and altruism and so on. Hope for the world, a light on the hill. Etc.
A virtuous nerd fam.
Posts: 597
Threads: 110
Joined: Apr 2022
Reputation:
34
08-08-2023, 01:53 AM
(This post was last modified: 08-08-2023, 01:54 AM by CharlieJV.)
(08-07-2023, 09:37 PM)CharlieJV Wrote: Need to test the daylights out of it first, but _mouseZone(x,y,w,h), w and h being optional, as in _mouseZone(x,y) meaning 1 pixel wide and 1 pixel tall, later tonight in a new version of BAM.
Done: https://basicanywheremachine-news.blogsp...ction.html
Posts: 1,272
Threads: 119
Joined: Apr 2022
Reputation:
100
08-08-2023, 02:45 AM
(This post was last modified: 08-08-2023, 02:48 AM by TerryRitchie.)
I updated my previous code to be more in line to what @Bplus pointed out that SDLBasic used.
@grymmjack you may find this updated version better suited for your needs. Much cleaner and simpler to use.
There's a few more commands available documented within the subroutines and functions as to their use.
This version is much cleaner than the quick and dirty I posted yesterday.
Code: (Select All) OPTION _EXPLICIT
CONST FALSE = 0, TRUE = NOT FALSE ' truth detectors
CONST SWIDTH = 800, SHEIGHT = 600 ' main screen dimensions
TYPE TYPE_POINT ' POINT PROPERTIES
x AS INTEGER ' x coordinate
y AS INTEGER ' y coordinate
END TYPE
TYPE TYPE_AREA ' AREA PROPERTIES
min AS TYPE_POINT ' upper left coordinate
max AS TYPE_POINT ' lower right coordinate
END TYPE
TYPE TYPE_ZONE ' ZONE PROPERTIES
Area AS TYPE_AREA ' area within zone
Active AS INTEGER ' this zone is available to mouse (t/f)
END TYPE
TYPE TYPE_MOUSE ' MOUSE PROPERTIES
x AS INTEGER ' x location
y AS INTEGER ' y location
ZoneTrap AS INTEGER ' zone area mouse trapped in (0 for none)
Hovering AS INTEGER ' zone area mouse is hovering over (0 for none)
Area AS TYPE_AREA ' trapped mouse area
END TYPE
REDIM Zone(0) AS TYPE_ZONE ' zone area array
DIM Mouse AS TYPE_MOUSE ' mouse properties
DIM MouseIMG AS LONG ' mouse pointer image
DIM Cursor AS STRING ' pointer creation variables
DIM CursorPos AS INTEGER
DIM x AS INTEGER
DIM y AS INTEGER
DIM Zone1 AS INTEGER ' defined mouse zones
DIM Zone2 AS INTEGER
DIM Zone3 AS INTEGER
DIM Zone4 AS INTEGER
DIM Zone5 AS INTEGER
'+------------------------+
'| Create a mouse pointer |
'+------------------------+
Cursor = Cursor + "0 " ' quick and dirty mouse cursor
Cursor = Cursor + "00 "
Cursor = Cursor + "010 "
Cursor = Cursor + "0110 "
Cursor = Cursor + "01110 "
Cursor = Cursor + "011110 "
Cursor = Cursor + "0111110 "
Cursor = Cursor + "01111110 "
Cursor = Cursor + "011111110 "
Cursor = Cursor + "0111111110 "
Cursor = Cursor + "01111111110 "
Cursor = Cursor + "011111111110"
Cursor = Cursor + "011111100000"
Cursor = Cursor + "01110110 "
Cursor = Cursor + "0110 0110 "
Cursor = Cursor + "010 0110 "
Cursor = Cursor + "00 0110 "
Cursor = Cursor + " 0110 "
Cursor = Cursor + " 0110 "
Cursor = Cursor + " 0110 "
Cursor = Cursor + " 00 "
MouseIMG = _NEWIMAGE(12, 21, 32) ' mouse icon image holder
_DEST MouseIMG ' draw on icon image
CursorPos = 0
FOR y = 0 TO 20
FOR x = 0 TO 11
CursorPos = CursorPos + 1
SELECT CASE MID$(Cursor, CursorPos, 1)
CASE "0"
PSET (x, y), _RGB32(0, 0, 0)
CASE "1"
PSET (x, y), _RGB32(255, 255, 255)
END SELECT
NEXT x
NEXT y
_DEST 0
'+-------------------+
'| Define zone areas |
'+-------------------+
Zone1 = DefineMouseZone(10, 10, 80, 80, TRUE) ' (x1, y1, width, height, Active)
Zone2 = DefineMouseZone(100, 10, 80, 80, TRUE)
Zone3 = DefineMouseZone(10, 100, 170, 80, TRUE)
Zone4 = DefineMouseZone(190, 10, 170, 170, TRUE)
Zone5 = DefineMouseZone(10, 190, 350, 350, TRUE)
SCREEN _NEWIMAGE(800, 600, 32)
_TITLE "MouseZone"
_MOUSEHIDE
'HideZone Zone3 ' hide zone 3 from the mouse
DO
_LIMIT 30
CLS
'+---------------------------------------+
'| Supply the user with some information |
'+---------------------------------------+
LOCATE 2, 50: PRINT "Move mouse to select zone area."
LOCATE 4, 50: PRINT "Left mouse button to trap mouse pointer."
LOCATE 6, 50: PRINT "Right mouse button to release mouse pointer."
LOCATE 8, 50: PRINT "ESC to exit."
LOCATE 10, 50:
IF MouseHovering(0) THEN ' check all zones for a hovering mouse
PRINT "Currently hovering zone area"; MouseHovering(0) ' print returned zone handle value
ELSE
PRINT "Mouse not currently hovering over a zone."
END IF
LOCATE 12, 50
IF MouseTrapped(0) THEN ' check all zones for a trapped mouse
PRINT "Currently trapped in zone"; MouseTrapped(0) ' print returned zone handle value
ELSE
PRINT "Mouse not currently trapped."
END IF
LOCATE 14, 50: PRINT "This zone is defined as ";
IF MouseZone(Zone1) THEN PRINT CHR$(34); "Zone1"; CHR$(34) ' check each individual zone for mouse interaction
IF MouseZone(Zone2) THEN PRINT CHR$(34); "Zone2"; CHR$(34)
IF MouseZone(Zone3) THEN PRINT CHR$(34); "Zone3"; CHR$(34)
IF MouseZone(Zone4) THEN PRINT CHR$(34); "Zone4"; CHR$(34)
IF MouseZone(Zone5) THEN PRINT CHR$(34); "Zone5"; CHR$(34)
'+-----------------------------------------+
'| Draw border(s) around chosen zone areas |
'+-----------------------------------------+
DrawBorder 0 ' draw borders around all zones (optional)
'+--------------------------------+
'| Update all defined mouse zones |
'+--------------------------------+
UpdateMouseZone ' manage any mouse trapping that is occurring
_DISPLAY ' update screen with changes
LOOP UNTIL _KEYDOWN(27) ' leave when ESC pressed
SYSTEM ' return to OS
'---------------------------------------------------------------------------------------------------------------------------------
SUB HideZone (z AS INTEGER)
'+-----------------------------+
'| Hides a zone from the mouse |
'| |
'| z - the zone handle to hide |
'+-----------------------------+
SHARED Zone() AS TYPE_ZONE ' need access to mouse zones
Zone(z).Active = 0 ' hide zone from mouse
END SUB
'---------------------------------------------------------------------------------------------------------------------------------
SUB ShowZone (z AS INTEGER)
'+------------------------------------+
'| Reveals a hidden zone to the mouse |
'| |
'| z - the zone handle to reveal |
'+------------------------------------+
SHARED Zone() AS TYPE_ZONE ' need access to mouse zones
Zone(z).Active = -1 ' allow mouse to see zone
END SUB
'---------------------------------------------------------------------------------------------------------------------------------
SUB DrawBorder (z AS INTEGER)
'+-------------------------------------------------------------------+
'| Draws a border around a zone area depecting the current state: |
'| Bright white - mouse is trapped in this zone |
'| White - mouse is hovering over this zone |
'| Gray - mouse has no interation with this zone |
'| |
'| z - The zone to draw a border around |
'| Supply the value of 0 to have borders drawn around all zones |
'+-------------------------------------------------------------------+
SHARED Zone() AS TYPE_ZONE ' need access to mouse zones
SHARED Mouse AS TYPE_MOUSE ' need access to mouse properties
STATIC Colour(2) AS _UNSIGNED LONG ' border colors
DIM c AS INTEGER ' zone counter (start of count)
DIM Finish AS INTEGER ' end of zone counter
DIM Border AS INTEGER ' border color
IF UBOUND(Zone) = 0 OR z > UBOUND(Zone) THEN EXIT SUB ' leave if no defined zone areas
IF NOT Colour(0) THEN ' set border colors if not set yet
Colour(0) = _RGB32(127, 127, 127) ' not hovering (gray)
Colour(1) = _RGB32(192, 192, 192) ' hovering (white)
Colour(2) = _RGB32(255, 255, 255) ' trapped (bright white)
END IF
IF z = 0 THEN ' draw borders around all zones?
c = 0 ' yes, start at the beginning of zone array
Finish = UBOUND(Zone) ' finish at the end of the zone array
ELSE ' no, just a single zone
c = z - 1 ' start at the individual zone in array
Finish = z ' finish at the individual zone in array
END IF
DO ' cycle through chosen zone(s)
c = c + 1 ' increment zone counter
IF Zone(c).Active THEN ' is tis zone active?
Border = 0 ' yes, assume no interaction with zone
IF MouseHovering(c) THEN Border = 1 ' white border if mouse is hovering this zone
IF MouseTrapped(c) THEN Border = 2 ' bright white border if mouse is trapped in this zone
LINE (Zone(c).Area.min.x, Zone(c).Area.min.y)-(Zone(c).Area.max.x, Zone(c).Area.max.y), Colour(Border), B ' draw border
END IF
LOOP UNTIL c = Finish ' leave when zone(s) processed
END SUB
'---------------------------------------------------------------------------------------------------------------------------------
FUNCTION MouseHovering (z AS INTEGER)
'+--------------------------------------------------------------------------------------------------+
'| Report mouse hovering status over a zone(s) |
'| |
'| z - the zone's handle to check for a hovering mouse (>0) |
'| supplying a value of 0 will simply return the zone handle where the mouse is hovering (0) |
'| Returns -1 (TRUE) if the mouse is hovering on the requested zone (-1) |
'| Returns a zone handle value if the zone requested is 0 and the mouse is hovering somewhere (>=0) |
'| Returns 0 (FALSE) if the mouse is not hovering in either scenario (0) |
'+--------------------------------------------------------------------------------------------------+
SHARED Zone() AS TYPE_ZONE ' need access to mouse zones
SHARED Mouse AS TYPE_MOUSE ' need access to mouse properties
MouseHovering = 0 ' assume mouse is not hovering (0 FALSE return)
IF Mouse.Hovering THEN ' is the mouse hovering over a zone?
IF z > 0 THEN ' yes, was a zone requested? (>0)
IF z = Mouse.Hovering THEN ' yes, is mouse hovering over the zone requested?
MouseHovering = z ' yes, report that mouse is hovering over requested zone (-1 TRUE return)
END IF
ELSE ' no, a zone was not requested
MouseHovering = Mouse.Hovering ' report any zone handle the mouse may be hovering over (>=0 TRUE or FALSE return)
END IF
END IF
END FUNCTION
'---------------------------------------------------------------------------------------------------------------------------------
FUNCTION MouseZone (z AS INTEGER)
'+-------------------------------------------------------+
'| Report interaction status of mouse and zone area |
'| |
'| z - the zone's handle |
'| Returns -1 (TRUE) if interaction, 0 (FALSE) otherwise |
'+-------------------------------------------------------+
SHARED Zone() AS TYPE_ZONE ' need access to mouse zones
SHARED Mouse AS TYPE_MOUSE ' need access to mouse properties
DIM Trapped AS INTEGER ' mouse trapped status
IF NOT Zone(z).Active THEN EXIT FUNCTION ' leave is zone is inactive
MouseZone = 0 ' assume mouse not interacting with zone (0 FALSE return)
Trapped = MouseTrapped(0) ' record zone mouse may be trapped in
IF Trapped THEN ' is mouse trapped in a zone?
IF z = Trapped THEN ' yes, is it this zone?
MouseZone = -1 ' yes, report the only interaction that can happen (-1 TRUE return)
END IF
ELSE ' no, mouse if currently free
IF MouseHover(Zone(z).Area) THEN ' is mouse interacting with this zone?
MouseZone = -1 ' yes, report that mouse is in this zone (-1 TRUE return)
END IF
END IF
END FUNCTION
'---------------------------------------------------------------------------------------------------------------------------------
SUB TrapMouse (z AS INTEGER)
'+---------------------------------------------+
'| Trap mouse within a zone's area |
'| |
'| z - the handle of the zone to trap mouse in |
'+---------------------------------------------+
SHARED Zone() AS TYPE_ZONE ' need access to mouse zones
SHARED Mouse AS TYPE_MOUSE ' need access to mouse properties
IF NOT Zone(z).Active THEN EXIT SUB ' can't trap mouse in inactive zone
Mouse.Area = Zone(z).Area ' define trapped area
Mouse.ZoneTrap = z ' mouse trapped in this zone (>0)
END SUB
'---------------------------------------------------------------------------------------------------------------------------------
FUNCTION MouseTrapped (z AS INTEGER)
'+-------------------------------------------------------------------------------------------------+
'| Report mouse trapped status |
'| |
'| z - the zone's handle to check for a trapped mouse (>0) |
'| supplying a value of 0 will simply return the zone handle where the mouse is trapped (0) |
'| Returns -1 (TRUE) if the mouse is trapped in the requested zone (-1) |
'| Returns a zone handle value if the zone requested is 0 and the mouse is trapped somewhere (>=0) |
'| Returns 0 (FALSE) if the mouse is not trapped in either scenario (0) |
'+-------------------------------------------------------------------------------------------------+
SHARED Zone() AS TYPE_ZONE ' need access to mouse zones
SHARED Mouse AS TYPE_MOUSE ' need access to mouse properties
MouseTrapped = 0 ' assume mouse is not trapped (0 FALSE return)
IF Mouse.ZoneTrap THEN ' is the mouse trapped in a zone?
IF z > 0 THEN ' yes, was a zone requested? (>0)
IF z = Mouse.ZoneTrap THEN ' yes, is mouse trapped in zone requested?
MouseTrapped = -1 ' yes, report that mouse is trapped in requested zone (-1 TRUE return)
END IF
ELSE ' no, a zone was not requested (0)
MouseTrapped = Mouse.ZoneTrap ' report any zone handle the mouse may be trapped in (>=0 TRUE or FALSE return)
END IF
END IF
END FUNCTION
'---------------------------------------------------------------------------------------------------------------------------------
SUB UpdateMouseZone ()
SHARED Zone() AS TYPE_ZONE ' need access to mouse zones
SHARED Mouse AS TYPE_MOUSE ' need access to mouse properties
SHARED MouseIMG AS LONG ' image of mouse pointer
DIM z AS INTEGER ' zone counter
IF UBOUND(Zone) = 0 THEN EXIT SUB ' leave if no zones defined
WHILE _MOUSEINPUT: WEND ' get latest mouse update
Mouse.x = _MOUSEX ' record mouse pointer position
Mouse.y = _MOUSEY
IF Mouse.ZoneTrap THEN ' is mouse trapped in a zone? (>0)
IF Mouse.x < Mouse.Area.min.x THEN Mouse.x = Mouse.Area.min.x ' yes, confine mouse to zone area
IF Mouse.x > Mouse.Area.max.x THEN Mouse.x = Mouse.Area.max.x
IF Mouse.y < Mouse.Area.min.y THEN Mouse.y = Mouse.Area.min.y
IF Mouse.y > Mouse.Area.max.y THEN Mouse.y = Mouse.Area.max.y
_MOUSEMOVE Mouse.x, Mouse.y ' force mouse to any updated coordinates
IF _MOUSEBUTTON(2) THEN Mouse.ZoneTrap = 0 ' free mouse from trap if right mouse button pressed
ELSE ' no, mouse is free
Mouse.Hovering = 0 ' assume mouse is not hovering a zone
z = 0 ' reset zone counter
DO ' cycle through zones
z = z + 1 ' increment zone counter
IF MouseZone(z) THEN Mouse.Hovering = z ' if mouse interacting with zone then record it hovering
LOOP UNTIL z = UBOUND(Zone) ' leave when all zones checked
IF _MOUSEBUTTON(1) AND Mouse.Hovering THEN ' was left button clicked while hovering?
TrapMouse Mouse.Hovering ' yes, trap the mouse within this zone
END IF
END IF
_PUTIMAGE (Mouse.x, Mouse.y), MouseIMG ' draw mouse pointer
END SUB
'---------------------------------------------------------------------------------------------------------------------------------
FUNCTION DefineMouseZone (x1 AS INTEGER, y1 AS INTEGER, w AS INTEGER, h AS INTEGER, Active AS INTEGER)
'+--------------------------------------------+
'| Defines mouse zones within the main screen |
'+--------------------------------------------+
SHARED Zone() AS TYPE_ZONE ' need access to zone areas
REDIM _PRESERVE Zone(UBOUND(Zone) + 1) AS TYPE_ZONE ' increase array size
Zone(UBOUND(Zone)).Area.min.x = x1 ' set new zone area coordinates
Zone(UBOUND(Zone)).Area.max.x = x1 + w - 1
Zone(UBOUND(Zone)).Area.min.y = y1
Zone(UBOUND(Zone)).Area.max.y = y1 + h - 1
Zone(UBOUND(Zone)).Active = Active ' set active status
DefineMouseZone = UBOUND(Zone) ' return handle of zone area
END FUNCTION
'---------------------------------------------------------------------------------------------------------------------------------
FUNCTION MouseHover (Area AS TYPE_AREA)
'+--------------------------------------------------------------------------------+
'| Returns a value of 1 if the mouse is hovering over the given area, 0 otherwise |
'+--------------------------------------------------------------------------------+
MouseHover = 0 ' assume mouse not hovering over area
WHILE _MOUSEINPUT: WEND ' get latest mouse updates
IF _MOUSEX >= Area.min.x THEN ' is mouse pointer currently within area limits?
IF _MOUSEX <= Area.max.x THEN
IF _MOUSEY >= Area.min.y THEN
IF _MOUSEY <= Area.max.y THEN
MouseHover = 1 ' yes, report that mouse is hovering this area
END IF
END IF
END IF
END IF
END FUNCTION
New to QB64pe? Visit the QB64 tutorial to get started.
QB64 Tutorial
Posts: 652
Threads: 96
Joined: Apr 2022
Reputation:
22
(08-07-2023, 07:25 AM)SMcNeill Wrote: (08-07-2023, 01:52 AM)PhilOfPerth Wrote: How can I map several sections of the screen so that a (left) mouse click selects the one it's in, and allows actions based on this?
Easiest way is just to make an array to store your segment coordinates for the mouse.
Code: (Select All)
TYPE Box 'a type to hold the mouse section information
x AS INTEGER
y AS INTEGER
x2 AS INTEGER
y2 AS INTEGER
END TYPE
DIM MouseSection(9) AS Box 'our mouse sections
SCREEN _NEWIMAGE(640, 480, 32)
FOR x = 0 TO 2
FOR y = 0 TO 2
i = i + 1
MouseSection(i).x = x * 213
MouseSection(i).x2 = x * 213 + 213
MouseSection(i).y = y * 160
MouseSection(i).y2 = y * 160 + 160
NEXT
NEXT
'color the segments just to be pretty
FOR i = 1 TO 9
LINE (MouseSection(i).x, MouseSection(i).y)-(MouseSection(i).x2, MouseSection(i).y2), _RGB32(RND * 255, RND * 255, RND * 255), BF
NEXT
PCOPY 0, 1
DO
PCOPY 1, 0
WHILE _MOUSEINPUT: WEND
mx = _MOUSEX: my = _MOUSEY
IF _MOUSEBUTTON(1) THEN
FOR i = 0 TO 9 'check the 9 segments
IF mx >= MouseSection(i).x AND mx <= MouseSection(i).x2 THEN
IF my >= MouseSection(i).y AND my <= MouseSection(i).y2 THEN
LOCATE 1, 1: PRINT "Mouse last down in segment #"; i
EXIT FOR
END IF
END IF
NEXT
END IF
IF _MOUSEBUTTON(2) THEN SYSTEM
_LIMIT 30
_DISPLAY
LOOP
Posts: 652
Threads: 96
Joined: Apr 2022
Reputation:
22
@SMcNeill
Your method actually does all that I needed, and I appreciate your making it simple enough for me to understand. Thank you.
I don't need the colours, so Ill reduce the Line() dimensions one or two pixels, and remove the Fill.
I also need quite a few more cells, and that was easy to adjust too.
|