on openCard, is there a bug?
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
-
- Posts: 46
- Joined: Mon Aug 26, 2013 6:49 pm
on openCard, is there a bug?
Hello,
I have a Stack with 3 Cards.
Card 1 with a Button “Go Next” + script
Card 2 with a Button “Go First” + script
Card 3 with a Button “Go First” + script
Card 2 with Card script:
On openCard
go next
End openCard
This Card 2 script is always executed when the card is opened, both in Run mode and Edit mode.
It should not in Edit mode, isn’t it?
The only way to open card 2 is to double click on Script lines in the Project Browser so the code window of card 2 opens and then comment out the script.
I use LC 9.6.4 Indy
Is this a bug?
thanks
Joop
I have a Stack with 3 Cards.
Card 1 with a Button “Go Next” + script
Card 2 with a Button “Go First” + script
Card 3 with a Button “Go First” + script
Card 2 with Card script:
On openCard
go next
End openCard
This Card 2 script is always executed when the card is opened, both in Run mode and Edit mode.
It should not in Edit mode, isn’t it?
The only way to open card 2 is to double click on Script lines in the Project Browser so the code window of card 2 opens and then comment out the script.
I use LC 9.6.4 Indy
Is this a bug?
thanks
Joop
Re: on openCard, is there a bug?
Dag Joop,
I don't think this is a bug, but a feature! I recently had to learn this for "mouseenter"
which is also sent with the pointer tool!
The message "opencard" is being triggered and sent and that is desired behavior.
I once created a small palette for e.g. to navigate through my stack(s).
I used this script for the "Next" button:
So you could just use the message box:
Groetjes
Klaus
I don't think this is a bug, but a feature! I recently had to learn this for "mouseenter"
which is also sent with the pointer tool!
The message "opencard" is being triggered and sent and that is desired behavior.
I once created a small palette for e.g. to navigate through my stack(s).
I used this script for the "Next" button:
Code: Select all
on mouseup
if the ALTkey = "down" then
lock messages
end if
go next cd
end mouseup
Code: Select all
lock messages;go cd 2
Klaus
Re: on openCard, is there a bug?
Trap the currentCard like so
You fill in the actual name between <>
Using the number of the currentCard instead of short name of 'currentCard'
OpenStack, openCard, resizeStack...get sent to everything all at once. I've had so many nightmares with that. But exiting at the top of the handler if the message is not intended for that object seems to be the workable solution.
I'm not sure if using 'private' will control who gets the message and who doesn't
Let's test
uh, I don't know what 'private' is doing.
doesn't do anything at all card after card
sending openCard through the message box does what is intended.
You fill in the actual name between <>
Code: Select all
on openCard
if the currentCard of this stack is not <"the short name of the target card"> then exit openCard
end openCard
Code: Select all
on openCard
if the number of the currentCard of this stack is not 2 then exit openCard
end openCard
I'm not sure if using 'private' will control who gets the message and who doesn't
Let's test
uh, I don't know what 'private' is doing.
Code: Select all
private on openCard
put the number of the currentCard of this stack into fld 1
end openCard
sending openCard through the message box does what is intended.
Re: on openCard, is there a bug?
I think that is intended as it not a bug.
If you want to be able to navigate in edit mode without triggering the 'go next' statement, then you can add a conditional:
Code: Select all
on openCard
if the tool is "browse tool" then go next
end openCard
S.
--- edited to correct the typo of the forgotten 'if' (thanks Jacque!)
Last edited by stam on Fri Nov 05, 2021 8:10 pm, edited 1 time in total.
-
- VIP Livecode Opensource Backer
- Posts: 7237
- Joined: Sat Apr 08, 2006 8:31 pm
- Location: Minneapolis MN
- Contact:
Re: on openCard, is there a bug?
Stam's solution is what I do, though the second line is missing the "if". It's a typo.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com
-
- Posts: 46
- Joined: Mon Aug 26, 2013 6:49 pm
Re: on openCard, is there a bug?
Hi,
Thank you all for your responses.
It's completely clear to me.
However, I still don't understand the purpose of the “open card” message in Edit mode.
If you go to the card to edit the card in edit mode, that's not very handy in my opinion.
But your responses helped me a lot.
thanks,
joop
p.s.
Dag Klaus
The salutation and conclusion of your response was perfectly Dutch.
Groetjes,
j.
Thank you all for your responses.
It's completely clear to me.
However, I still don't understand the purpose of the “open card” message in Edit mode.
If you go to the card to edit the card in edit mode, that's not very handy in my opinion.
But your responses helped me a lot.
thanks,
joop
p.s.
Dag Klaus
The salutation and conclusion of your response was perfectly Dutch.
Groetjes,
j.
Re: on openCard, is there a bug?
openCard and preOpenCard are often used for initialisation of layout and data when entering a card. In these cases, it's good that it works in edit mode, otherwise you'd have to enter browse mode, navigate to the card (or run pre/openCard from the msg box) and then enter edit mode - tedious.Joop Sleijster wrote: ↑Sat Nov 06, 2021 9:33 pmHowever, I still don't understand the purpose of the “open card” message in Edit mode.
For example i have a stack where a styled field top left informs the user which section (card) they're on. I've named the cards to reflect this name and have a background group containing this field, so it exists on all new cards i create. I just set the text of the field to be the short name of the card when navigating to said card and it's all automatic even in edit mode, which is useful...
Re: on openCard, is there a bug?
Dag Joop.
Tot ziens!
Dat weet ik heel goed, ik spreek een beetje nederlands.Joop Sleijster wrote: ↑Sat Nov 06, 2021 9:33 pm...
p.s.
Dag Klaus
The salutation and conclusion of your response was perfectly Dutch.
Groetjes,
j.
Tot ziens!