Message Path and Groups Oddity

Ender Nafi Elekcioglu endernafi at gmail.com
Sun Oct 20 02:04:58 CEST 2013


Jacque hi,

Setting the blendlevel is in fact a nice trick, too.
But as you said, it's not suitable for my needs.
As it turns out, setting the rect is a little bit costly; it scrambles locs of the objects within the group.
Then I have to re-positioning all of them.
Now, I'm just setting the layer; it works great.
on mouseDown set the layer of frontGroup to bottom
on mouseUp set the layer of frontGroup to top

~~~

Jacque: "The only reason I can think of that you'd want mouse handlers at the 
stack level is if you plan to have many objects using the same handlers."

No, it's not the only reason.
I'm very new to programming and to LiveCode.
So, I don't have many habits or routines that you guys have.
Using only cards and stacks for scripting is one of them.
I don't find convenient to put scripts into tens -if not hundreds- of objects.
I inspect the stacks of experienced LiveCoders and they seem to me too complicated.
Nearly every button, scrollbar, field, graphic, etc. have 10 or 20 lines of script.
I spend so much time just to figure out which does what.

Putting all the relevant script into cards
and the common functions into stack is a cleaner way to me.
One look and it's all there.

Clearly I'm wrong, 'cause it seems that my way is not the way intended in LiveCode by design.
There are interruptions in the message path like the problem we're discussing in this thread.

~~~

Jacque: "...if you plan to have many objects using the same handlers.
In that case I'd assign behaviors rather than use a stack script."

I have no idea how to use *behavior*.
I know the commands, of course, set the behavior of thisGroup to the long id of behaviorButton.
But how should I use that, what benefit will it provide me, I don't know.
Is there any showcases that you could advise me to inspect?
I'd be glad.
DataGrid's use this functionality, but still I've no idea how to implement the behaviors into my projects. 


--- to be continued
thanks to the size limit of the use-livecode'lists :)


On October 19, 2013 at 9:21:14 PM, J. Landman Gay (jacque at hyperactivesw.com) wrote:

Thanks for the nice words, guy. I'm always glad when I can reduce the  
amount of screaming going on in someone's head.  

One trick I sometimes use when I want an object to be hidden but still  
enabled is to set its blendlevel to 99. That makes it almost impossible  
to see, but still allows clicks and messages. But if you want the  
messages to go back to the stack, that won't work.  

The only reason I can think of that you'd want mouse handlers at the  
stack level is if you plan to have many objects using the same handlers.  
In that case I'd assign behaviors rather than use a stack script. It  
would be more efficient and would also be more selective, so that clicks  
on the card or other unrelated objects wouldn't be intercepted wrongly.  

If you can tell us why you need the messages to go to the stack level,  
maybe we can figure out a better way.  

--  
Jacqueline Landman Gay | jacque at hyperactivesw.com  
HyperActive Software | http://www.hyperactivesw.com  

_______________________________________________  
use-livecode mailing list  
use-livecode at lists.runrev.com  
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:  
http://lists.runrev.com/mailman/listinfo/use-livecode  


More information about the use-livecode mailing list