setting layers in groups

Anything beyond the basics in using the LiveCode language. Share your handlers, functions and magic here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
adventuresofgreg
Posts: 349
Joined: Tue Oct 28, 2008 1:23 am
Contact:

setting layers in groups

Post by adventuresofgreg » Mon Aug 30, 2010 4:15 am

I have a group of charts (images) and the group has a vertical scroll bar. Part of my script relayers the images (I have a stack of charts and rather than show one and hide dozens, I would just like to relayer (set the layer of the visible image to top). However, this script moves the image OUT of the group. How do I set the layer of images and graphics in a group and leave them in the group?

Thanks
Greg

Janschenkel
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 977
Joined: Sat Apr 08, 2006 7:47 am
Contact:

Re: setting layers in groups

Post by Janschenkel » Mon Aug 30, 2010 6:17 am

Before you can change the layers of controls that are in a group, you have to set the relayerGroupedControls to true. And then you have to calculate the new layer by taking the layer of the group control itself, as well as the number of controls in the group. It's very fiddly business, so make sure to take a backup copy of your stack before you experiment.

Jan Schenkel.
Quartam Reports & PDF Library for LiveCode
www.quartam.com

adventuresofgreg
Posts: 349
Joined: Tue Oct 28, 2008 1:23 am
Contact:

Re: setting layers in groups

Post by adventuresofgreg » Mon Aug 30, 2010 1:57 pm

Thanks - I can see how that could get messy. The reason I'm doing it is so I can scroll to view more charts than would fit in my stack window. The alternative would be to add a scroll bar to the stack window, but I don't think that is possible - right? Any ideas?

Thanks,
Greg

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Re: setting layers in groups

Post by Mark » Mon Aug 30, 2010 7:03 pm

Hi greg,

I don't see how a scroll bar solves your layering problem, but you can set the rect of a group to the rect of a card and add scrollbars to the group. Just use the property inspector to turn on the vScrollbar and hScrollbar properties.

Best regards,

Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

mwieder
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3581
Joined: Mon Jan 22, 2007 7:36 am
Contact:

Re: setting layers in groups

Post by mwieder » Mon Aug 30, 2010 10:20 pm

Why don't you want to "show one and hide dozens"? It's fast. And probably the easiest way to deal with your situation.

Code: Select all

on ShowChart pWhichChart
  local tNum

  lock screen
  put the number of controls of group "whatever" into tNum
  repeat with x=1 to tNum
    hide control x of group "whatever"
  end repeat
  show image pWhichChart
  unlock screen
end ShowChart

Post Reply