mousemessages over group

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

Post Reply
MarcVanCauwenberghe
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 142
Joined: Thu Feb 21, 2013 8:47 am

mousemessages over group

Post by MarcVanCauwenberghe » Wed Apr 30, 2014 7:40 am

Hi,

I am drawing a line between 2 random groups on a stack.
mousedown will get me the first group, but releasing the mouse button will not give me the name of the second group.

mouseRelease will give me the first again.
mouseEnter will give me graphic that I am drawing with.
(for the moment I am only using the card script)
Any idea's?

Thanks,
best regards,
Marc

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4003
Joined: Sun Jan 07, 2007 9:12 pm
Location: Bochum, Germany

Re: mousemessages over group

Post by bn » Wed Apr 30, 2014 10:37 am

Marc,

you could use mouseControl.

The trick is to send from "mouseRelease" a message in time. Then you go up the owner of control until you hit the card, which is the last owner before stack. Once you hit the card as owner you know that the owner before card is either the control itself (if it is not grouped) or the group the control belongs to. Mind you a group can be grouped.

My little stack should get you started. It shows just the basics of what I describe.

Kind regards
Bernd
Attachments
GetMouseControl.livecode.zip
(1.43 KiB) Downloaded 205 times

jmburnod
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2718
Joined: Sat Dec 22, 2007 5:35 pm
Location: Genève
Contact:

Re: mousemessages over group

Post by jmburnod » Wed Apr 30, 2014 10:56 am

Hi Marc,

Bernd was faster than me (Salut Bernd)
Here is a little stack as example but i think Bernd's getmousecontrol in time way is better.
Kind regards
Jean-Marc
Attachments
TraceLineBetweenTwoGroups.livecode.zip
(1.57 KiB) Downloaded 206 times
https://alternatic.ch

MarcVanCauwenberghe
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 142
Joined: Thu Feb 21, 2013 8:47 am

Re: mousemessages over group

Post by MarcVanCauwenberghe » Wed Apr 30, 2014 11:57 am

@ Jean-Marc,
you are essentially using mouseloc and the rect of the groups that you keep in a list. That could work, I will have to keep a list of all groups in the stack as they are being created or deleted.

@Bernd,
Thanks haven't done something like that before. Are there any potential drawbacks to that method?
The trick is to send from "mouseRelease" a message in time
sounds to me that it will not work all the time.

Thanks again for the prompt replies.

Best regards,
Marc

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4003
Joined: Sun Jan 07, 2007 9:12 pm
Location: Bochum, Germany

Re: mousemessages over group

Post by bn » Wed Apr 30, 2014 12:11 pm

Marc,
The trick is to send from "mouseRelease" a message in time
sounds to me that it will not work all the time.
Trick refers to the fact, that if you don't send in time "mouseRelease" will give you the control where you started. By sending it in time it gets the current control the mouse is over.

I don't see any reason why it should not work all the time.

Of course you could use other ways to accomplish this, (Salut Jean-Marc). Use what you feel comfortable with.

Kind regards
Bernd

jmburnod
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2718
Joined: Sat Dec 22, 2007 5:35 pm
Location: Genève
Contact:

Re: mousemessages over group

Post by jmburnod » Wed Apr 30, 2014 12:22 pm

Bernd,
I don't see any reason why it should not work all the time
I think that happens because Marc use it to trace one line and getMouseControl() return
the name of this grc and we have to hide the grc before getMouseControl()
Kind regards
Jean-Marc
https://alternatic.ch

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4003
Joined: Sun Jan 07, 2007 9:12 pm
Location: Bochum, Germany

Re: mousemessages over group

Post by bn » Wed Apr 30, 2014 12:41 pm

Hi Jean-Marc,

I think I did not read carefully enough. If Marc is drawing into a graphic the mouseControl will probably be the graphic on mouseRelease. And the graphic will not be part of the group he is looking for.

I guess checking the rect of the groups is the way to go as you do it.

Kind regards
Bernd

[-hh]
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2262
Joined: Thu Feb 28, 2013 11:52 pm
Location: Göttingen, DE

Re: mousemessages over group

Post by [-hh] » Wed Apr 30, 2014 2:18 pm

..........
Last edited by [-hh] on Wed Aug 13, 2014 3:09 pm, edited 1 time in total.
shiftLock happens

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4003
Joined: Sun Jan 07, 2007 9:12 pm
Location: Bochum, Germany

Re: mousemessages over group

Post by bn » Wed Apr 30, 2014 9:05 pm

@Hermann,
thanks for reminding me of "controlAtLoc", I have not yet used it.
But actually in this case one has the same problem Jean-Marc pointed out: since apparently Marc wants to draw a line graphic mouseRelease will be on the graphic.

@Marc & Jean-Marc,
I took Jean-Marc's advice and hide the graphic within a screenLoc and then get the mouseControl. This works but does not mean this should be the way to solve the problem. I was just trying to adapt my solution. It was a nice exercise.

Kind regards

Bernd
Attachments
GetMouseControlAndDrawLine.livecode.zip
(1.77 KiB) Downloaded 198 times

[-hh]
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2262
Joined: Thu Feb 28, 2013 11:52 pm
Location: Göttingen, DE

Re: mousemessages over group

Post by [-hh] » Thu May 01, 2014 2:17 am

..........
Last edited by [-hh] on Wed Aug 13, 2014 3:08 pm, edited 1 time in total.
shiftLock happens

MarcVanCauwenberghe
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 142
Joined: Thu Feb 21, 2013 8:47 am

Re: mousemessages over group

Post by MarcVanCauwenberghe » Thu May 01, 2014 9:19 am

Thank you all,

this has been very educational.

The goal is to make a small data flow diagram utility. So I will be adding groups on the fly and drawing lines between them.
I am inclined to go with Jean-Marc solution because I will have to save all elements (locations) of the diagram anyway.


Any further tips/ hints/ solutions are always welcome.

Best regards,
Marc

[EDIT: actually I am still undecided which way to go...]

jmburnod
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2718
Joined: Sat Dec 22, 2007 5:35 pm
Location: Genève
Contact:

Re: mousemessages over group

Post by jmburnod » Thu May 01, 2014 12:17 pm

Hi Marc,
I remember "Connecting objects with movable lines" of Bernd
To get it:
open revonline
search "Bernd", go to page 2 and you can download it
Kind regards
Jean-Marc
https://alternatic.ch

[-hh]
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2262
Joined: Thu Feb 28, 2013 11:52 pm
Location: Göttingen, DE

Re: mousemessages over group

Post by [-hh] » Thu May 01, 2014 10:07 pm

..........
Last edited by [-hh] on Wed Aug 13, 2014 3:08 pm, edited 1 time in total.
shiftLock happens

MarcVanCauwenberghe
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 142
Joined: Thu Feb 21, 2013 8:47 am

Re: mousemessages over group

Post by MarcVanCauwenberghe » Fri May 02, 2014 3:57 pm

Ok,
Will do.

Best regards,
Marc

jmburnod
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2718
Joined: Sat Dec 22, 2007 5:35 pm
Location: Genève
Contact:

Re: mousemessages over group

Post by jmburnod » Fri May 02, 2014 7:36 pm

Hi Hermann,
I tried several times to "push" Bernd to make a collection of his stacks with short descriptions/tags. RevOnline is a good place for this, sadly currently not (yet) working a it should. Perhaps you can ask him too? And what about your collection? :-)
8)

I regularly try to convince Bern'd to give up his enthusiasm for the beaches of the Ruhr unsuccessfully.
However, I agree that users should use more RevOnLine
As soon as I finished the windows version EcrireEnPictos I will use my considerable influence on Bernd and I will update a few stacks for revonline

I take this message to thank you for your help. I think I will need your light for RaspberryPi projects.
Kind regards
Jean-Marc
https://alternatic.ch

Post Reply

Return to “Getting Started with LiveCode - Complete Beginners”