Substack Use

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
WaltBrown
Posts: 466
Joined: Mon May 11, 2009 9:12 pm

Substack Use

Post by WaltBrown » Wed Apr 28, 2010 6:45 pm

Hi! I apologize, I thought I had seen the answer to this somewhere but now can't find it.

Can a substack be opened in a field or other object on the main stack window, so it acts like any other card object?

Thanks,
Walt Brown
Walt Brown
Omnis traductor traditor

Curry
Posts: 111
Joined: Mon Oct 15, 2007 11:34 pm
Contact:

Re: Substack Use

Post by Curry » Wed Apr 28, 2010 6:54 pm

You can use a group to handle a set of controls easily on a card.
Best wishes,

Curry Kenworthy

LiveCode Development, Training & Consulting
http://livecodeconsulting.com/

WordLib: Conquer MS Word & OpenOffice
SpreadLib: "Excel-lent" spreadsheet import/export
http://livecodeaddons.com/

WaltBrown
Posts: 466
Joined: Mon May 11, 2009 9:12 pm

Re: Substack Use

Post by WaltBrown » Wed Apr 28, 2010 7:42 pm

Thanks Curry, that's not quite what I want to do. I'll explain a bit better.

I have a number of stacks that each handle a specific set of operations and data. They are all substacks to my main stack, which basically has two big "fields" on it. I want the two big "fields" to each contain a selected substack. So far I am having to open each substack as required, calculate it's relative position to the main stack on any geometry change, and otherwise have to tediously keep it on top of the main stack whenever a control on the main or other substack is clicked.

Or, do you mean there is a way to call a substack a group? Is that the process, create a group and name it the substack? I vaguely remember this but cannot find the solution.

Thanks,
Walt
Walt Brown
Omnis traductor traditor

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

Re: Substack Use

Post by mwieder » Wed Apr 28, 2010 8:10 pm

Well, personally I wouldn't do things this way, I'd be more inclined to use Curry's approach (group a set of controls on the main stack and then have the substacks update the information on the main stack), but...

if I'm understanding what you're trying to do and the actual sizes of the two fields don't change, how about just setting the rect of the substack to the rect of the field before showing it? Things start looking a bit wonky when you move the main stack since there's a lag before the substacks move, but that might solve the immediate problem for you.

If the actual dimensions of the fields that the substacks take the place of change then you're in a whole different ballpark and you'll have some serious resizing issues to deal with, which is probably what you're dealing with now.

Curry
Posts: 111
Joined: Mon Oct 15, 2007 11:34 pm
Contact:

Re: Substack Use

Post by Curry » Wed Apr 28, 2010 8:17 pm

You can position stacks as you have been doing (and make them floating windows to keep them on top), but I bet there's a simpler way. (Might be possible with Revbrowser and Revlets, but that's not simpler either!) Here are a couple of suggestions:

You can show stack data in a field or datagrid to show the output of each stack. You can even show a snapshot of a stack with an image, button, or field.

But in most cases you could reorganize and simplify your project by making one stack and putting all your scripts in the stack or card script. Then copy and paste the controls or fields that you have on each substack on one side of your card. (Save and make a copy of the whole project BEFORE you do any of this!!!)

You could group them (or not) or use a rectangle to make a nice border for them. Make it look like you want--it doesn't require substacks to separate the different features. Groups can also scroll if needed.
Best wishes,

Curry Kenworthy

LiveCode Development, Training & Consulting
http://livecodeconsulting.com/

WordLib: Conquer MS Word & OpenOffice
SpreadLib: "Excel-lent" spreadsheet import/export
http://livecodeaddons.com/

Curry
Posts: 111
Joined: Mon Oct 15, 2007 11:34 pm
Contact:

Re: Substack Use

Post by Curry » Wed Apr 28, 2010 8:40 pm

If you can't get it working, email and I'll be glad to help.
Best wishes,

Curry Kenworthy

LiveCode Development, Training & Consulting
http://livecodeconsulting.com/

WordLib: Conquer MS Word & OpenOffice
SpreadLib: "Excel-lent" spreadsheet import/export
http://livecodeaddons.com/

WaltBrown
Posts: 466
Joined: Mon May 11, 2009 9:12 pm

Re: Substack Use

Post by WaltBrown » Thu Apr 29, 2010 12:07 am

Thanks. I think I may end up doing it that way - keep all UI and controls on the main stack in groups.

My thinking was have each substack host it's own unique UI elements and versions of commonly named (in the main stack) functions, then I can use them in different app versions, and make changes to substacks without disturbing the main stack. The data portion of the substacks will eventually get converted to MySQL tables once the app is done. I'll experiment a bit more with the "popup" mechanism until I run out of patience. Hmmm, maybe I can copy a group from the substack to the main stack on load?

Mark was right, I was having fun with automating resizing, but I got that part done and working (oddly enough) including changing geometry for object layout, which took a lot of experimentation.

Correct me if I am wrong, math cannot be done on rects, ie "put tOldRect * 0.8 into tSmallerRect" as opposed to "put item 1 of objectRect * 0.8 into item 1..."?

Thanks again,
Walt
Walt Brown
Omnis traductor traditor

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

Re: Substack Use

Post by mwieder » Thu Apr 29, 2010 12:32 am

Without testing that on my own over here for lack of time at the moment, I think that's correct: a rect is four integers separated by commas, so trying to multiply it as is won't work. Or I wouldn't expect it to. Also, a rect is specified by top, left, bottom, right, so I'm not sure what you're expecting to get as a result by multiplying all of those specifiers at once.

Post Reply