I'm just starting out with LiveCode, so I'm trying to get to know the basics. Here is a very basic question (if you don't mind).
If I have a stack with more than one card in it, is there a way of showing the name of the current card in the title bar of the stack. As I have it, only the name of the stack shows in the title bar, so I have to look at the Card Inspector or the Project Browser to find the name of the topmost card (i.e. the one which I am working on). It would make things a lot easier if the name of the card were shown in the title bar next to the name of the stack.
Thanks in advance
Bruce
Show card title in title bar of stack
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
Re: Show card title in title bar of stack
Hi Bruce,
welcome to the forum!
Put this into your stack script:
If one or more of your cards already have a "preopencard" script, then add this line at the end of these handlers:
Best
Klaus
welcome to the forum!
Put this into your stack script:
Code: Select all
on preopencard
set the title of this stack to the short name of this cd
end preopencard
Code: Select all
on preopencard
## Do your thing here...
## and here...
pass preopencard
end preopencard
Klaus
Re: Show card title in title bar of stack
It sounds to me like you are looking to show both the stack name and card name, something like this:
My Stack Program - Card Name
There are a number of ways to accomplish it, depending on how you setup the main stack. Using Klaus's code, for instance, you could do ~
Code: Select all
on preopencard
# if the stack has no label, and is using a name only...
set the title of this stack to the short name of this stack && "-" && the short name of this cd
# if your stack has a label set...
set the title of this stack to the label of this stack && "-" && the short name of this cd
# if you want the stack title to be a string of your choosing aside from the name or label...
set the title of this stack to "My new made up title -" && the short name of this cd
end preopencard
-
- VIP Livecode Opensource Backer
- Posts: 9648
- Joined: Wed May 06, 2009 2:28 pm
- Location: New York, NY
Re: Show card title in title bar of stack
HI.
What Klaus said.
And it will become important later to know that the "name" of a control, like a button or field, is different than its 'label". "Title", for a stack, is similar to the "label" of a control.
This is common practice, not to change the names of controls (and stacks) for reference, but to use their "labels" (or "titles", for stacks) for display to the user. Labels change with the needs of the UI. Names generally are held constant.
Craig Newman
What Klaus said.
And it will become important later to know that the "name" of a control, like a button or field, is different than its 'label". "Title", for a stack, is similar to the "label" of a control.
This is common practice, not to change the names of controls (and stacks) for reference, but to use their "labels" (or "titles", for stacks) for display to the user. Labels change with the needs of the UI. Names generally are held constant.
Craig Newman
Re: Show card title in title bar of stack
Thank you, Klaus, bogs and Craig for those very helpful suggestions. That solves my problem!
Regards
Bruce
Regards
Bruce