Funky card or not card or is everything now a stack? Cards misbehaving

Hi all,
using browser version of LCC on Safari/Sequoia.

As a recent post stated, importing old projects recognises cards in the project browser, but “layouts” seem to equate to stacks.

To test this, I created a button on a layout to create a new card.
This creates a new card (which is only apparent because the button disappears).
However this new card does not appear in the project browser (as opposed to importing Classic stacks).

The only way to navigate is using the messageBox.

Cards and stacks are an essential part of LiveCode as they were in HC and MC, and they are loved for a reason. They just work.

I am hoping the intent is to bring in card management properly but if they don’t show in the project browser that will be a problem…

Stam

1 Like

Yes, please bring back cards. Or make layouts cards and the app itself the stack.

With the current layout (stack) model, I have questions on how to implement global variables, constants and hierarchical functions and custom command handlers. It doesn’t make sense to me to have multiple stacks as the only method of building a multi-screen app.

I suppose the work around is to create your app structure in Livecode Classic (e.g. a stack and multiple cards) then import it to Livecode Create. Seems a bit clunky though.

It’s weird because cards actually do exist in LCC.
You can make new cards, navigate them and delete them in script. And they behave like cards.

They just don’t show up in the project browser… I wonder if that’s a bug?

Interesting. I’ll give that a try.

Hi Stam,

Thanks for the post! With Create we’re moving away from Stacks and Cards and replacing them with layouts. We will still support projects with multiple cards within a stack and are still discussing how this will be implemented within the project browser etc.

We may change it so that in the project browser a stack with multiple cards appears as a stack rather than a layout. In future it likely won’t be possible to create cards in script on a layout too. This is all still in discussion though so keep an eye out for future updates!

Thank you for taking the time to help us improve LiveCode Create!

Thanks Adam,

Losing the separation of stack/card would be very disappointing.
What I and I’m sure many other are really asking for is the ability to have multiple layouts in 1 window (in LC terms multiple cards in 1 stack).
What you are saying is that this will no longer be possible.

It raises the question: Which exact niche is Create intended to fill long term?

Is it intended to gradually replace all of the existing and become the sole IDE in the future?
Or will LiveCode Classic continue to be developed indefinitely, alongside this low-code IDE?
The very naming of it to “Classic” suggests this will not be developed further but perhaps there are plans to launch a 3rd IDE.

If Classic will persist in some form then great, we as developers can continue to make use of the great namespacing, logic separation/MVC style development it permits and all the benefits the stack/card structure affords.

If it is to be that LC Create replaces everything in the long term and Classic will eventually go away with no direct replacement, then I already lament the loss of this rare facility and would feel disheartened about embracing this platform.

Beyond the technical issues and complexity the stack/card paradigm creates for implementation I wonder if there are other reasons as well, such as wanting to get an away from being seen as HyperCard’s descendent?

If that is the case then why not simply rename these for example card = layout and stack = window. It’s a great thing to have this ability not only for layout but for coding purposes as well. FileMaker Pro thrives on multiple layouts per window. The equivalent in XOJO (adding a Page Panel control) is a real pain because it doesn’t natively cater for multiple layouts per window. Namespacing with multiple panels is a nightmare.

If Create is to be the long term destination for LiveCode and Classic is the temporising measure its name suggests it is, then flattening everything to 1 card = 1 stack = 1 layout seems unwise. But maintaining 2 (or maybe 3) separate IDEs long term also seems unwise…

Thank you for letting us know this is still under discussion, but as this is truly a key feature of LiveCode it would be great if we could hear more about this and what the officially planned direction of travel is…

Many thanks
Stam

1 Like

We have no plans to remove cards and stacks from the Create platform (ever) and they will always continue to work. You can continue to use them if you prefer. I will talk to the team about including some better ways to ensure they remain easy to manipulate in the IDE.

For new users we are not encouraging them as a concept. It was not an easy decision however here are some of the reasons for it:

  • Today’s audience is universally familiar with the concept of a “layout”. So to have cards and stacks we have to introduce another, unfamiliar metaphor.
  • The term “card” is now used in the Material theme to mean something entirely different to our much older use of the term. Cards – Material Design 3 Material is a major design standard today (which we are implementing in the platform) and for better or worse, new users are far more likely to be familiar with this use of “card” than of our decades old meaning for it.
  • The metaphor is of far less use today than it was when cards and stacks were (primarily) used to store multiple records in a data store. Create has data binding to external data sources and navigating between cards has no relationship to data storage.
  • You can do everything you can with cards and stacks with layouts. Navigation can work in exactly the same way - at present you can use “go in window”, in the future we will tweak the syntax so it performs just like navigating between cards does now by default. So nothing is going to be lost here.
  • Internally implementing layouts (internally as individual stack files within a project) has advantages when it comes to doing clever things with data transfer. We can be much more granular with what we serve up in lower bandwidth environments.
  • With the introduction of the project concept (which is managed by the IDE) we have a natural and easy to explain home for libraries and other things that need to set more broadly accessible in the message path.
1 Like

Thanks Kevin,

I imagined the reasons were as you say, which is why I was wondering if it would be perhaps useful to change the concept “stack “ to “window”.
A window can then have multiple ”layouts” (ie cards).

I think that would be an easily digestible nomenclature for new users, and not incompatible with concepts from other languages. While maintaining the goodness of LiveCode.

Maybe I’m older now and don’t represent the new users but when I think I need something equivalent to what a stack is, I’m thinking “window” not “layout”.

I think the current term “layout” is misleading actually. The implication mentally is that “this is one entity with many layouts”.

But the current definition of “layout” in LCC is basically a window that can have different window properties (eg rect, colours etc). It would be great if that particular window could have its own collection of layouts. If needed. It just use the window as is if there is no need for layouts.

But that is my personal view and maybe I’m out of touch. But as far as I know, the concept of “window” is probably a more representative translation for LC “stack”?
Otherwise it messages “windows in LCC are called layouts” which is probably stranger to new users of LCC?

If you take a look at other web based low code tools (Microsoft PowerApps for example), they do have similar concepts. PowerApps uses the term “screen” for “layout” rather than “window” and it allows you to build a GUI with drag ‘n drop components similar to Create. Interestingly PowerApps also has an “App” level container for want of a better word, where you can establish app properties, constants, variables, dynamic collections etc. All the screens created in PowerApps are children of the App level container, so in one way this is similar to Livecode Classics Stack and Card structure. I’m sure other low code/no code platforms use their own terminology too which would indicate there’s no hard and fast rule on what names to use.

Personally I prefer using the term “layout” for each of the screen views you create in an LC Create app - it makes sense to my brain. However I must admit to being somewhat confused that a layout is the equivalent of a stack and not a card. It appears that Livecode have some good reasons for this change of tack… maybe Kevin or the team could share some more details with us so we understand why and how best to take advantage of using the “stack” approach to building multi-layout apps in Create?

Al.

Hi all,

thank you for the infos about crads/stacks/layouts!

I will only get my license at the end of november, so I am reading here to mentally prepare for the change. :smiley:
However I am having a hard time to wrap my head around the “layout approach”.
After 25 years of working with MC, RunRev, Rev and LC it is hard to NOT think in cards/stacks.
I was thinking “layouts” could be some sort of GROUP, but seems like this is wrong!?

Question, how do you navigate (?) to a layout or just put it onto the screen:
GO TO layout “xyz”
show layout “xyz”
or what?

Thank you for any insight!

Best

Klaus

Noone?
Come on, please! :slight_smile:

Been unable to find almost any time to code at all in recent months. But I’m pretty sure that navigating layouts is the same as navigating stacks and you can probably refer to layouts with the “stack” keyword, although I’m unable to check…

I must say the various core concept changes and not-here-yet features make me feel a tad apprehensive. Switching away from the card/stack concept is, well, bold! Some of the reasons given seem like the result of some serious thinking. But not everything.

To me, the primary definition of a layout is an arrangement of elements. This is the logical equivalent of a card, which historically has been… an arrangement of elements. (Reading between the lines, those elements could include what Google’s Material Design refers to as cards, and may be like next-generation groups?)

I’ll mull over the rest.

k

Let me first try to answer a couple of concerns raised here and in other posts.

We aren’t taking anything away - stacks/cards will still work the same in Create as they do in Classic - we just have some more work to do to make them be accessible properly (i.e. if you open a stack, then you get a stack node and card nodes underneath in the project browser - just like you get in the project browser in classic). If you want to still use that model then you can - the Create model is built on what LiveCode already has - the widgets are not tied to the layout concept, nor are any of the libraries.

Currently, it is true that a layout is implemented as a stack with a single card as if the card is the primary object - this is not yet an engine enforced thing but it will be - including ‘layout’ being a chunk you will be able to use in syntax. Right now if you want to display a layout in script, rather than using an action, you’d use ‘go to stack in window (the short name of this stack’, but at some point this will become ‘go to layout ’, or ‘go to layout as modal’, or ‘go to layout in a new window’. [ Internally, a layout will still be a stack with a card, its just the engine will hide the bits which shouldn’t be user accessible - and in the interim if you create a layout which is not by definition a layout when that engine change comes, it will just revert to appearing as a stack, so you won’t lose anything ].

In terms of application logic, globals, constants. Globals are as they are now - all of this is still running in one engine instance, so globals are shared amongst all scripts which reference them. Constants are only script-local so that’s not different. Code which is to be shared amongst multiple layouts should go in a library. Further, there will be a ‘top-level’ ‘application script’ at some point - I mention this because I believe J9V6 had an unfortunate encounter with ’systemAppearanceChanged’ recently - that is an application level message which gets sent to the ‘current card of the default stack’ - at the time the event is generated by the OS - this means to handle it reliably you have to do so in a backscript or front script… Said application script will be a place for that, and the other half-dozen such things which currently exist.

Now for new concepts…Perhaps the best way to think of the new concepts (ignoring implementation details) is to deconstruct the current model LiveCode has.

Currently, you’ll probably start by creating a stack - you’ll probably create multiple cards, one for each ‘screen’ which is displayed to the user. You’ll probably put your application logic in the stack script, to be shared with all the cards (screens).

Your app grows, you need a dialog to popup - obviously you can’t use a card in the main stack of your app as only a single card can be open at one time in a given stack, so you create another stack for that dialog. Of course you need to share the application logic (currently in the main stack script) so you probably make the dialog a substack (being careful to ensure that the substack’s script has the main event handlers in it so they don’t end up triggering those in the main stack script).

All well and good - you now have a few screens, the dialog you want and it works as you need. You can easily use the standalone builder to deploy your app - it’s all a single stackfile, you pretty much just target the platforms you want, set a few settings and deploy it. It works.

So now your app needs more stuff - so you add more cards and dialogs - the main stack script grows and grows to contain all your app logic which is shared by all the cards and dialogs.

At some point you realise you actually need one of the screens (cards) in your main stack to sometimes be a modal dialog, so you refactor that as a sub-stack, and then have to go back and modify code which displays it as not a modal dialog to use ‘go stack in window’. This then breaks your app as you main stack when showing that screen (not as modal) - but you can’t figure out why so you give up on that (‘shared code’) approach and just copy the card - so you then have two copies - one in a sub-stack which you use as the modal, and one in the main stack which you use when its not modal. (We’ll ignore the fact that subsequently you spend an inordinate amount of time making sure those two things are in sync…)

After a while you probably start to find this slightly unmanageable - the whole tree is under one node in the project browser - the main stack script has 1000’s of lines in it - you find yourself constants unfurling and furling up the branches int he project browser, and scrolling up and down in the script editor.

At a certain point you decide you really need to do something about this. So what you probably do is separate out all the substack dialogs as separate stacks, and refactor the main stack script as several library stacks.

You do this in the IDE and it all works fine - your stacks are all in the same folder on your computer, the engine’s method of finding stacks by name when they are not in memory means you don’t have to change any code.

Pleased with your nice cleanly refactored app which you are much happier with in terms of ease of working on it - you try to deploy. The standalone does not work even on the platform you are working on.

You then realise you have to either tell the standalone builder about all the stacks which comprise your project, or use the stackfiles property - you use the stackfiles property and you get a nicely deploying app again - on you Mac or Windows machine at least.

You try a Linux standalone - and it breaks. You scratch your head - and then you’ve made an error in the filename in the stackfiles property - you’ve used all lowercase when the file on disk is actually mixed case… Doh - Linux filesystems are case-sensitive. You fix that and things run again - yay!

This entire process is not straight-forward - it tends to be learnt organically through trial and error - its easy to forget (after working with a tool over many years) how much knowledge you have accumulated to use it, and how you’ve learned how to do things to not cause issues in the future (indeed, I strongly suspect every person who has contributed to this thread so far structures their apps differently!).

I chose the above example because it highlights several issues which the current LC model has - in particular, the rigidity of the card/stack model in terms of its relationship to displaying screens to the user (which is, at the end of the day, the primary need of any app which presents a user interface), and the lack of any prescribed project structure.

So how do we solve this in Create? Quite simply - we take the critical abstractions that the above really needs clearly exposed - projects, layouts and libraries. Note that I don’t include windows in this - windows are purely a means of displaying a layout - nothing more. What they are, and how they behave is defined by the environment the app is running in - sure apps need to be able to tweak that display sometimes, but most of the time you’ll either want to show a given screen to the user or popup one up modally (or, if in multi-window environments, show a screen in a separate window).

In this mind-frame a project is the collection of all the things needed to run your app - the screens (layouts), the libraries, the images, the settings needed to deploy to each platform, the themes etc. - all known about by the environment so you don’t have to worry about fettling with things.

We have a layout which is a collection of controls which are to be displayed together and presented to the user to interact with. On desktop, Layouts could be displayed in a top-level window, they could be in a modal dialog, they might temporarily be displayed inside an existing window on desktop - it doesn’t really matter - as they are not specifically tied to a ‘stack’ (the current thing which represents a window) they can be any of these things at the time they need to be.

We have a library which is basically just a collection of handlers which is accessible to all parts of the project.

With this model, the above rather protracted ‘learning’ process becomes this:

You start a project in create.

You create a layout and very quickly have something you can test/run and display the first screen.

You add more, having a modal dialog is the same as having any other screen - you create a layout and use a different action to show it as modal.

You don’t have to refactor your shared application logic at any point, because it was obvious that you should put that in a library at the start (it was obvious because clearly a layout is a top-level thing and the code there should be specific to a layout so you are led directly to looking for something which has greater scope - i.e. a library).

When you realise that you have a layout which needs to sometimes be modal and sometimes be part of the main window your app displays - it doesn’t matter. It’s just a change to the action which displays it.

At any point you want to test your app, you pretty much can just deploy it and test - the project you’ve created knows everything about your app so you aren’t going to forget anything.

Of course, the above is the goal and is not necessarily where we are in the Create journey right now - as it stands, we are still working on the deployment side and we are still working on the library side.

I’ll be completely honest - that was incredibly difficult to follow.
The bits I did manage to skim I would not necessarily agree with.

There are many possible issues that are solved with the card-substack-stack-library paradigm.
It was impossible to follow your arguments against this I’m afraid. If you mean that dialogs and libraries are all external files, and if I understood correctly that this is a source of issues, the simple answer is to use substacks - then everything is inside one file. The argument for using individual library files is that these are then re-usable code for other projects - but there is nothing to stop you from using a substack as a library otherwise, if the issue is multiple files/naming conventions for each OS, etc.

But let me pick a simple example for “layouts” as they are currently and which really doesn’t work as it stands:
if I create “layouts” for an app where a stack is imitating the functionality of a card (i.e. I want to have several screens of the same app that share properties like location/dimensions) - and have several such “layouts” which would be equivalent to cards in a stack in current livecode - how do I practically resize all stacks, sorry, “layouts” when the user resizes one of these?

The other obvious fail with standalone stacks pretending to be “layouts” is that the message hierarchy is lost - for example many objects with same functionality are placed on cards in the stack or substacks, but the functionality can be put into the mainstack’s script, so regardless of the card the same code is executed - there is code only in one script. I use this simple approach for example when using a spinner widget to show when updating a cloud database from anywhere in the app and then hide it. The controlling code is all in the mainstack instead of each individual control or card.

With the current layouts this automatic code execution flow would be lost and I’d need to duplicate code in multiple scripts for each “layout”, and have to update all of these individually when I refactor code.

Of course I may be missing obvious answers that Create solves these issues with. If there is an “app container” level object that simulates the mainstack functionality a lot of this could be solved there… or perhaps an well entrenched publish/subscribe model that would be inherent to Create projects.
Please do correct me if I missed the obvious…

If not, I would argue that Create, not LiveCode, would gradually become unmanageable…

1 Like