Advice on selecting an area of the window.
Posted: Tue Oct 29, 2019 8:45 pm
Hi all. I'm currently working on a "seating chart" program, and I need to be able to select a bunch of seats at a time. What I have so far is:
The seats are drawn on the window, at predetermined locations.
A left click or right click event on the window returns the x and y values for the mouse.
I then loop through the seats and if the mouse x/y fall within the boundaries of the seat location, the seat is selected (left click) or deselected (right click)
I would like to be able to click and drag a selection box over the seats, and use the coords of the box to select or deselect all seats inside the box.
I'm thinking I'll need to draw all the seats and then draw a semi-transparent box over them, in a loop. I can test to see if the user has chosen "single seat" or "multi seat" selection mode. If in multi seat mode, a left button down would return the mouse x1,y1, and the selection box would be drawn from there to the mouse, until a left button up is detected, at which point I'll have an x2,y2 to check all the seats inside the selection area.
So far I haven't been able to do this, but I'll keep plugging away at it.
I would be grateful for any advice on this type of thing, as I am new to the event driven looping in PB.
Rich
The seats are drawn on the window, at predetermined locations.
A left click or right click event on the window returns the x and y values for the mouse.
I then loop through the seats and if the mouse x/y fall within the boundaries of the seat location, the seat is selected (left click) or deselected (right click)
I would like to be able to click and drag a selection box over the seats, and use the coords of the box to select or deselect all seats inside the box.
I'm thinking I'll need to draw all the seats and then draw a semi-transparent box over them, in a loop. I can test to see if the user has chosen "single seat" or "multi seat" selection mode. If in multi seat mode, a left button down would return the mouse x1,y1, and the selection box would be drawn from there to the mouse, until a left button up is detected, at which point I'll have an x2,y2 to check all the seats inside the selection area.
So far I haven't been able to do this, but I'll keep plugging away at it.
I would be grateful for any advice on this type of thing, as I am new to the event driven looping in PB.
Rich