To get the topmost stack I have to use topStack...

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

Mag
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 802
Joined: Fri Nov 16, 2012 10:51 pm

To get the topmost stack I have to use topStack...

Post by Mag »

...to get the current card I have to use...
Klaus
Posts: 14324
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: To get the topmost stack I have to use topStack...

Post by Klaus »

Monsieur? :shock:
Mag
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 802
Joined: Fri Nov 16, 2012 10:51 pm

Re: To get the topmost stack I have to use topStack...

Post by Mag »

:D :lol: :roll: :shock:

Maybe

Code: Select all

the current card name -- pseusocode
Klaus
Posts: 14324
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: To get the topmost stack I have to use topStack...

Post by Klaus »

Maybe this:
...
put the short name of this cd of the defaultstack into tCurrentCard
...
?
Mag
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 802
Joined: Fri Nov 16, 2012 10:51 pm

Re: To get the topmost stack I have to use topStack...

Post by Mag »

Hi Klaus, thanks. The fact is that the code is on a card that is not in foreground :mrgreen:
Klaus
Posts: 14324
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: To get the topmost stack I have to use topStack...

Post by Klaus »

Mag wrote:Hi Klaus, thanks. The fact is that the code is on a card that is not in foreground :mrgreen:
The code? Soory, no idea what you try to achieve?
Mag
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 802
Joined: Fri Nov 16, 2012 10:51 pm

Re: To get the topmost stack I have to use topStack...

Post by Mag »

Hi Klaus,

I have a handler in a card where there is the need to know what is the current card displayed. And, no... the card displayed is not the one that contains the running code... :roll:
Klaus
Posts: 14324
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: To get the topmost stack I have to use topStack...

Post by Klaus »

Hm, if:
...
put the short name of this cd of the defaultstack into tCurrentCard
...
is not what you need, then I have still no idea!?
Mag
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 802
Joined: Fri Nov 16, 2012 10:51 pm

Re: To get the topmost stack I have to use topStack...

Post by Mag »

Hi Klaus, isn't "this card" used to refer to the card where the code is running? Actually I need to know the name of the card which is the current frontmost card. :oops: :cry:
Klaus
Posts: 14324
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: To get the topmost stack I have to use topStack...

Post by Klaus »

Mag wrote:Hi Klaus, isn't "this card" used to refer to the card where the code is running? Actually I need to know the name of the card which is the current frontmost card. :oops: :cry:
Ah, I think I get it...

But how do you call that namely script and what is in it?
Means, please post the code.
Mag
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 802
Joined: Fri Nov 16, 2012 10:51 pm

Re: To get the topmost stack I have to use topStack...

Post by Mag »

Hi Klaus, the code is called by a menu item, that menus are located in a different card. The code is simple, a thing like this one:
copy word -3 to -1 of field "output"
Klaus
Posts: 14324
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: To get the topmost stack I have to use topStack...

Post by Klaus »

Sorry, still no way!?

How can you select a menu item on card X, but exspect card Y to be the current card? :shock:
Mag
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 802
Joined: Fri Nov 16, 2012 10:51 pm

Re: To get the topmost stack I have to use topStack...

Post by Mag »

Because the menu is a pulldown menubar menu on OS X! :mrgreen:
Klaus
Posts: 14324
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: To get the topmost stack I have to use topStack...

Post by Klaus »

OK last try! :D

Does this do what you want:

Code: Select all

on menupick xyz
  ...
  set the defaultstack to the topstack

  ## COPY will only copy SELECTED text!
  set the clipboarddata["text"] to (word -3 to -1 of field "output")
...
?
Mag
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 802
Joined: Fri Nov 16, 2012 10:51 pm

Re: To get the topmost stack I have to use topStack...

Post by Mag »

Thank you Klaus! I almost feel sorry that we have found a solution, it was fun! :D :lol: :mrgreen: :wink: :P
Post Reply