Syntax problem[solved]

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
Jean-Paul
Posts: 13
Joined: Wed Jun 05, 2024 5:19 pm
Contact:

Syntax problem[solved]

Post by Jean-Paul » Fri Jun 07, 2024 9:42 am

Hi to all,

Code: Select all

close card "xxx" of stack "zzz"
Why this doesn't work ?
What is the exact syntax please ?

Note: I don't want to close the stack "zzz" but only the card "xxx" which is in it.

Thanks,
Regards, J-P.
Last edited by Jean-Paul on Sat Jun 08, 2024 8:54 am, edited 1 time in total.

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 10096
Joined: Fri Feb 19, 2010 10:17 am

Re: Syntax problem

Post by richmond62 » Fri Jun 07, 2024 9:54 am

I do not think this is possible.

What you could do is make that card invisible:

Code: Select all

set the visible of card "xxx" to false

Jean-Paul
Posts: 13
Joined: Wed Jun 05, 2024 5:19 pm
Contact:

Re: Syntax problem

Post by Jean-Paul » Fri Jun 07, 2024 10:12 am

Thanks richmond62 but I made a try of this syntax already and it didn't work either :-(

Regards, J-P.

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 10096
Joined: Fri Feb 19, 2010 10:17 am

Re: Syntax problem

Post by richmond62 » Fri Jun 07, 2024 10:35 am

Yup: that was me being foolish:

viewtopic.php?t=26938
-
SShot 2024-06-07 at 12.38.18.png

SWEdeAndy
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 324
Joined: Sat Aug 16, 2008 9:48 am
Contact:

Re: Syntax problem

Post by SWEdeAndy » Fri Jun 07, 2024 12:01 pm

Jean-Paul wrote:
Fri Jun 07, 2024 9:42 am
Note: I don't want to close the stack "zzz" but only the card "xxx" which is in it.
Hi Jean-Paul,

That's not really how cards work. "Closing" a card is not an action in itself, but an effect of either closing the stack or moving to another card. When you do so, a closeCard message is sent to the card, and if no closeCard handler is present in the card script, the message gets passed on to the stack script.

If a stack has only one card, then it doesn't make sense to "close" just the card or make that card invisible.
(From the "visible" entry in the Dictionary: "You can set the visible property of a card, but doing so has no effect. Cards cannot be made invisible.")

What is it you actually want to achieve?
Andreas Bergendal
Independent app and system developer
Free LC dev tools: https://github.com/wheninspace
(WIS_WebDeployHelper, WIS_ScriptDependencies, WIS_BrowserAnimation)
WhenInSpace: https://wheninspace.com

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 10096
Joined: Fri Feb 19, 2010 10:17 am

Re: Syntax problem

Post by richmond62 » Fri Jun 07, 2024 1:13 pm

Hazarding a guess I would suppose the OP wants to 'hide' cards from end-users.

i.e. make certain card inaccessible to end users.

Obviously a button with this sort of code:

Code: Select all

on mouseUp
go next
end mouseUp
will not cut the mustard.

Probably the best thing is, for any cards the OP wants make inaccessible to the end-user, is to set their mark to true so that they can be bypassed.

Here's a 3 card stack I whipped up where you can 'hide' the middle card:
-
Card Hider.livecode.zip
Stack.
(1.02 KiB) Downloaded 126 times
-
SShot 2024-06-07 at 15.15.02.png
-
The cards are named, sequentially, 'K1', 'K2', and 'K3'.

The button on card 'K1' called "GO NEXT CARD" contains this code:

Code: Select all

on mouseUp
   go card "K2"
   if the mark of card "K2" is true then
      go card "K3"
   end if
end mouseUp
There is a button on card "K1" to unmark card "K2", and a button on card "K2" to mark card "K2".

Jean-Paul
Posts: 13
Joined: Wed Jun 05, 2024 5:19 pm
Contact:

Re: Syntax problem

Post by Jean-Paul » Fri Jun 07, 2024 1:55 pm

Hi to all and thanks for your answers.

The deal is really simple.

I've plenty of cards which share the same stack "zzz".

The first card "xxx" deal with all the user preferences, init and so one...
This card should not be seen. It's a small card large as 320x200px
When the init are done, the card "xxx" go to card "yyy", close itself then unlock the screen

Code: Select all

on openCard -- it's the card "xxx"
lockScreen
-- init all preferences
go to card "yyy" of this stack
-- close, hide, burn yourself and by by!
unlock screen
I let you guess the line which makes problem ;-)

Regards, J-P.

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10317
Joined: Wed May 06, 2009 2:28 pm

Re: Syntax problem

Post by dunbarx » Fri Jun 07, 2024 2:45 pm

Hi.

Glad you have a solution.

The core issue is just what SWEdeAndy said, and this goes back to Hypercard in 1987 where a stack is a collection of one or more cards with a "rolodex" paradigm. The relationship between cards and the stack is different than, say, a card and its controls. Bottom line, you cannot hide or show a card ; a card does not even have the "visible" property. And so a one-card stack is even more tied down that way.

A stack does have that property, though, and you can show and hide the stack, and with a single card stack, that is what you originally wanted to do with the card.

Hope this hurts.

Craig

SWEdeAndy
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 324
Joined: Sat Aug 16, 2008 9:48 am
Contact:

Re: Syntax problem

Post by SWEdeAndy » Fri Jun 07, 2024 3:05 pm

dunbarx wrote:
Fri Jun 07, 2024 2:45 pm
Hope this hurts.
Right... :lol: :lol: :lol:
Andreas Bergendal
Independent app and system developer
Free LC dev tools: https://github.com/wheninspace
(WIS_WebDeployHelper, WIS_ScriptDependencies, WIS_BrowserAnimation)
WhenInSpace: https://wheninspace.com

SWEdeAndy
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 324
Joined: Sat Aug 16, 2008 9:48 am
Contact:

Re: Syntax problem

Post by SWEdeAndy » Fri Jun 07, 2024 3:10 pm

Jean-Paul wrote:
Fri Jun 07, 2024 1:55 pm
I let you guess the line which makes problem ;-)
Possibly "lockScreen" that should be "lock screen". Not sure if it makes a difference, but it kind of should...

Anyway, by going to card "yyy" you have already closed card "xxx". So I don't really see the problem...?
Andreas Bergendal
Independent app and system developer
Free LC dev tools: https://github.com/wheninspace
(WIS_WebDeployHelper, WIS_ScriptDependencies, WIS_BrowserAnimation)
WhenInSpace: https://wheninspace.com

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10317
Joined: Wed May 06, 2009 2:28 pm

Re: Syntax problem

Post by dunbarx » Fri Jun 07, 2024 5:09 pm

by going to card "yyy" you have already closed card "xxx".
This is a good way to "hide" a card. Go somewhere else.

Craig

Jean-Paul
Posts: 13
Joined: Wed Jun 05, 2024 5:19 pm
Contact:

Re: Syntax problem

Post by Jean-Paul » Sat Jun 08, 2024 8:09 am

Hi to all,

My apologies for this question which I realize is very irrelevant.
So it’s true that it hurts :-)

Have a nice week-end, J-P.

Post Reply