Is a selection rectangle possible?

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10043
Joined: Sat Apr 08, 2006 7:05 am
Contact:

Re: Is a selection rectangle possible?

Post by FourthWorld » Thu Nov 17, 2022 9:15 pm

M-A Kuttner wrote:
Thu Nov 17, 2022 9:12 pm
Thanks guys! The project is that I have a large field of small rectangle graphics butted up against one another, and I want to select any subset of them within the larger field so as to access the names of each. However, I don't want to reposition any of them.
To make sure I understand, where you wrote "large field of small rectangle graphics", did you mean "large group of rectange graphics", or are these images displayed in a field object?
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

M-A Kuttner
Posts: 50
Joined: Mon Apr 03, 2017 3:55 pm

Re: Is a selection rectangle possible?

Post by M-A Kuttner » Thu Nov 17, 2022 9:21 pm

Sorry. I refer to it as a field to the users. It is indeed a large group (but not a Group) of graphics, each of which is sequentially numbered according to column and row.
Hypertalk developer on and off since the days of SuperCard. Currently using LC to do rapid prototyping for a new kids' toy.

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10305
Joined: Wed May 06, 2009 2:28 pm

Re: Is a selection rectangle possible?

Post by dunbarx » Thu Nov 17, 2022 9:24 pm

@Richard.

Yes, I used the actual pointer tool, and I wished I did not have to. I also think there should be a better way.

@ M-A Kuttner

If you have a bunch of controls scattered around, and I hear they are closely spaced, how are you going to set the bounds of your selection rectangle? Normally you would need to drag the pointer tool, right?

But if you want to do this from "above", how do you know? Can you click, perhaps with the optionKey, at the upperLeft and lowerRight corners and use those locs to set the react? That would work, and be far easier that typing in four integer items. It would be, as I mentioned to Richard above, a better way, and you do not have to change tools.

Craig

M-A Kuttner
Posts: 50
Joined: Mon Apr 03, 2017 3:55 pm

Re: Is a selection rectangle possible?

Post by M-A Kuttner » Thu Nov 17, 2022 9:26 pm

Yeah, that's how I'm doing it right now, and that does work. I was just wondering if there was a way to make that a more intuitive experience to the users (who are users of graphics applications).
Hypertalk developer on and off since the days of SuperCard. Currently using LC to do rapid prototyping for a new kids' toy.

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10305
Joined: Wed May 06, 2009 2:28 pm

Re: Is a selection rectangle possible?

Post by dunbarx » Thu Nov 17, 2022 9:26 pm

each of which is sequentially numbered according to column and row.
It always takes a while for everyone to get what is going on. This is normal.

Are these controls arranged in a grid? In that case, click on the upperLeft and lowerRight ones with, say, the optionKey, and you are done.

Craig

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10305
Joined: Wed May 06, 2009 2:28 pm

Re: Is a selection rectangle possible?

Post by dunbarx » Thu Nov 17, 2022 9:28 pm

Hmmm.

Are these graphics all the same size?

Craig

M-A Kuttner
Posts: 50
Joined: Mon Apr 03, 2017 3:55 pm

Re: Is a selection rectangle possible?

Post by M-A Kuttner » Thu Nov 17, 2022 9:28 pm

For context, here's what I'm talking about:
image (12).png
Hypertalk developer on and off since the days of SuperCard. Currently using LC to do rapid prototyping for a new kids' toy.

M-A Kuttner
Posts: 50
Joined: Mon Apr 03, 2017 3:55 pm

Re: Is a selection rectangle possible?

Post by M-A Kuttner » Thu Nov 17, 2022 9:40 pm

The rectangles in the black area are all 8 x 20. There are somewhere north of 4,000 of them.
Hypertalk developer on and off since the days of SuperCard. Currently using LC to do rapid prototyping for a new kids' toy.

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10305
Joined: Wed May 06, 2009 2:28 pm

Re: Is a selection rectangle possible?

Post by dunbarx » Thu Nov 17, 2022 10:02 pm

Whew.

Quite a few more than I thought. So how are you with clicking on the upperLeftMost and lowerRightMost rectangle, and nailing all the ones in between? I assume that one of the control keys should be held down when you do this to distinguish that process from any "normal" one.

Are you OK with writing the handler to do that, assuming that is how you want to do the selecting?

On another note, that is a handsome, if rather busy card you have there.

Craig

M-A Kuttner
Posts: 50
Joined: Mon Apr 03, 2017 3:55 pm

Re: Is a selection rectangle possible?

Post by M-A Kuttner » Thu Nov 17, 2022 10:12 pm

Haha - thank you Craig. It's turned into a much bigger beast than I was expecting when I started it a year ago. :) Luckily it's an internal tool, so I don't have to worry about releasing it (and supporting it) to the general populace...

The handler already works. My question was more out of curiosity than necessity. What happens is that you select either the 4th or 5th tool down in the tool palette in the upper left, for copy or paste respectively. As you suggested, the user clicks the upper left and then the lower right rectangles that they want bounded, and the foregroundColor of each of those rectangles highlights in neon pink. Then the user clicks on the rectangle where they want to paste that block and voila!
Last edited by M-A Kuttner on Thu Nov 17, 2022 10:14 pm, edited 1 time in total.
Hypertalk developer on and off since the days of SuperCard. Currently using LC to do rapid prototyping for a new kids' toy.

M-A Kuttner
Posts: 50
Joined: Mon Apr 03, 2017 3:55 pm

Re: Is a selection rectangle possible?

Post by M-A Kuttner » Thu Nov 17, 2022 10:13 pm

In case it's not obvious, it's essentially a timeline based animation tool.
Hypertalk developer on and off since the days of SuperCard. Currently using LC to do rapid prototyping for a new kids' toy.

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10043
Joined: Sat Apr 08, 2006 7:05 am
Contact:

Re: Is a selection rectangle possible?

Post by FourthWorld » Thu Nov 17, 2022 10:13 pm

M-A Kuttner wrote:
Thu Nov 17, 2022 9:40 pm
The rectangles in the black area are all 8 x 20. There are somewhere north of 4,000 of them.
Nice UI. Is this for a lightboard?

I'm assuming that the rect objects here change color when "selected", yes? That is, what you're after is effectively a form of "painting" by dragging across the rects, applying the currently selected color to their backColor, is that correct?

If so, I don't think you need object selection per se at all. I would imagine tracking a mouseMove handler that set the color of the mouseControl would suffice, no?
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

M-A Kuttner
Posts: 50
Joined: Mon Apr 03, 2017 3:55 pm

Re: Is a selection rectangle possible?

Post by M-A Kuttner » Thu Nov 17, 2022 10:25 pm

Thanks Richard. Yes, exactly. Each of the vertical pixel assignments (P01, P02, etc) corresponds to an LED in a light ring on the toy I'm helping with. The horizontal is 5 seconds, broken into 24 frames per second. You can select one or more of the "P" labels on the left to activate the corresponding lights and then either colour individual frames or do colour inbetweening over a range of frames to make some pretty nice animated arrangements that then play out on the ring. Here's a more detailed view of it in its full form:
image (13).png
And yes, this changes each rectangle's backcolor. The selection thing, as per my other message above, was more a nice-to-have that I was curious about rather than a needed feature.
Hypertalk developer on and off since the days of SuperCard. Currently using LC to do rapid prototyping for a new kids' toy.

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10043
Joined: Sat Apr 08, 2006 7:05 am
Contact:

Re: Is a selection rectangle possible?

Post by FourthWorld » Thu Nov 17, 2022 10:40 pm

M-A Kuttner wrote:
Thu Nov 17, 2022 10:25 pm
The selection thing, as per my other message above, was more a nice-to-have that I was curious about rather than a needed feature.
I think mouseMove checking the mouseControl should cover what you need there. If you run into snags let me know.

The UI is cool enough that I would also like to suggest you consider writing a guest blog entry for LC. You can contact Heather at support AT livecode.com. They welcome guess blogs, and every backlink to you helps.

If nothing else, I'd get more backstory on this, and it's cool enough I'm eager to learn more. :)
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

M-A Kuttner
Posts: 50
Joined: Mon Apr 03, 2017 3:55 pm

Re: Is a selection rectangle possible?

Post by M-A Kuttner » Thu Nov 17, 2022 10:49 pm

Thanks again. I'd be happy to share. Just need to clear it with the crew here first.

That said, I'd be pretty embarrassed to show you the code. I'm not a programmer by training, and at the start I was getting back to a hypertalk-like language after many years away. Especially in the older features, it's a spaghetti factory in there. :oops:

But that said, almost everything does work, so the end result is what we needed. And the other guys who we asked about writing something told us they'd need a 10 Million dollar LED order in order to customize their software for us. So LiveCode really ended up fitting the bill for what we needed.

Also, a big thanks to everyone in the forums. This has to be one of the friendliest and most helpful places on the internet.
Hypertalk developer on and off since the days of SuperCard. Currently using LC to do rapid prototyping for a new kids' toy.

Post Reply