Substacks on top

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: Klaus, FourthWorld, heatherlaine, kevinmiller, robinmiller

Post Reply
odysseus
Posts: 41
Joined: Tue Aug 25, 2020 2:15 pm

Substacks on top

Post by odysseus » Tue Oct 06, 2020 11:32 pm

I am converting a large program from SumTotal Toolbook to Livecode. A lot of things are similar, but one major difference is the handling of windows within windows. Toolbook had a rather neat feature called ‘viewers’ which could be opened to show different pages from the current book or other books, and and remained visible until closed. Livecode has substacks which can be opened on top of the mainstack but unfortunately disappear when the mainstack is clicked. The ‘always on top’ setting is useless as it hides message boxes and everything else. This is a major headache unless someone has a solution as I made extensive use of viewers in Toolbook.

bangkok
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 927
Joined: Fri Aug 15, 2008 7:15 am

Re: Substacks on top

Post by bangkok » Wed Oct 07, 2020 12:06 am

you should try "as modal"

Code: Select all

go stack "myStack" as modal

http://lessons.livecode.com/m/4071/l/11 ... dal-dialog

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 8301
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: Substacks on top

Post by FourthWorld » Wed Oct 07, 2020 1:48 am

Welcome aboard, Odysseus.

I had some very good times with Toolbook, and used Viewers extensively. And with the built-in syntax for making system calls, I even made some with custom shapes. Nice program. If it was multi-platform I'd probably still be using it.

In LC we don't have Viewers yet (on the to-do list for down the road), but the closest approximation isn't too bad if you don't mind a little script.

I could explain it, but it's easier to provide an example...
FauxViewer Base.zip
(885 Bytes) Downloaded 31 times
It uses a borderless palette style to simulate the Viewer, with a moveStack handler in the base stack so that moving the base stack moves the palette window along with it.

It's not bad, but sometimes you may see a bit of a lag between dragging actions and the placement of the "FauxViewer".

In most cases I find it's easier to use groups instead.

May I ask what you're building that makes a Viewer a better fit than a group?
Richard Gaskin
Community volunteer LiveCode Community Liaison

LiveCode development, training, and consulting services: Fourth World Systems: http://FourthWorld.com
LiveCode User Group on Facebook : http://FaceBook.com/groups/LiveCodeUsers/

odysseus
Posts: 41
Joined: Tue Aug 25, 2020 2:15 pm

Re: Substacks on top

Post by odysseus » Wed Oct 07, 2020 12:50 pm

Thanks for the suggestion, I will try that. The program is a Fire Alarm monitoring system for Shopping Centres/Hospitals/Factory Complexes etc, polling up to 64 panels via TCP/IP or RS485. It's sold all over the world, and I have about 10 different language files for it. The operator can call up individual panel facias on the screen, which mirror the actual panels live, and can also view site drawings with live detectors, break glasses etc. I keep variable information in separate books/stacks from the core program, sometimes for convenience and sometimes because it is essential. Sure in some instances I can show and hide groups on the stack, but the major problem is the site drawings, as I give the user the ability to add pages and place drawings into the 'data' book/stack, and place device icons in the appropriate places. In Toolbook I then called up the correct page from the data book into a viewer, and the user could click on a device to examine its details and disable it if necessary. I have the panels working successfully in Livecode, albeit with the panel fixed on top or disappearing when the main stack is clicked (surely that's an easy fix for you :-), but I am worried about the drawings side of it.

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 8301
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: Substacks on top

Post by FourthWorld » Wed Oct 07, 2020 5:25 pm

Set the style property of your "viewer" stack to palette to keep it in front. Clicks in it will lose focus for the main stack behind it, but at least clicking the main stack won't submarine your "viewer".
Richard Gaskin
Community volunteer LiveCode Community Liaison

LiveCode development, training, and consulting services: Fourth World Systems: http://FourthWorld.com
LiveCode User Group on Facebook : http://FaceBook.com/groups/LiveCodeUsers/

odysseus
Posts: 41
Joined: Tue Aug 25, 2020 2:15 pm

Re: Substacks on top

Post by odysseus » Thu Oct 08, 2020 2:25 pm

I realised from your example program that I could use palette. I thought before that I wouldn’t be able to change things on the card in script, but it turns out you can.

odysseus
Posts: 41
Joined: Tue Aug 25, 2020 2:15 pm

Re: Substacks on top

Post by odysseus » Fri Oct 16, 2020 12:26 pm

So here’s the dilemma. If I make the substack toplevel, it disappears when I click the main stack, and if I make it palette, it disappears when I click outside the livecode area, which I need to do to copy items from the desktop. Livecode really needs a proper viewer system so we can have a window within the main stack showing other cards in the stack or cards from other stacks.

Klaus
Posts: 12125
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: Substacks on top

Post by Klaus » Fri Oct 16, 2020 12:42 pm

Hi odysseus,
odysseus wrote:
Fri Oct 16, 2020 12:26 pm
So here’s the dilemma. If I make the substack toplevel, it disappears when I click the main stack, and if I make it palette, it disappears when I click outside the livecode area, which I need to do to copy items from the desktop.
in that case don't use palette but use -> systemwindow

Code: Select all

set the systemwindow of stack "your viewer stack here..." to TRUE
This way the stack will always be on top, no matter what application is currently active!
odysseus wrote:
Fri Oct 16, 2020 12:26 pm
Livecode really needs a proper viewer system so we can have a window within the main stack showing other cards in the stack or cards from other stacks.
Yes, that would be a great addition.
If I remember correctly Richard (FrouthWorld) already made an enhancement request for this many, many years ago...

Best

Klaus

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5264
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: Substacks on top

Post by richmond62 » Fri Oct 16, 2020 1:23 pm

Richmond's Fantasy Time.

Imagine a stack called "See Me" and a substack called "See You" . . .

Now put a button on a card (called "c3") of the mainstack with this code:

[pseudoCode}

Code: Select all

on mouseUp
   palette "See You"
   show card "c3" of stack "See Me" in stack "See You"
end mouseUp
I believe that would be a useful addition to LiveCode.

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5264
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: Substacks on top

Post by richmond62 » Fri Oct 16, 2020 1:34 pm

One can, of course have this sort of script in a button on one's main stack:

Code: Select all

on mouseUp
   import snapshot from card "c1"
   set the name of the last image to "XXX"
   cut image "XXX"
   open stack "See You"
end mouseUp
and this in one's substack:

Code: Select all

on openStack
   paste
   palette this stack
end openStack

on closeStack
   delete image "XXX"
end closeStack

BUT
that palette command doesn't seem to work.
-
Screen Shot 2020-10-16 at 3.34.41 PM.png

Post Reply

Return to “Getting Started with LiveCode - Experienced Developers”