Oddity in 'currentCard' function?

Mark Waddingham mark at livecode.com
Thu Oct 26 04:44:55 EDT 2023


On 2023-10-25 13:57, Paul Dupuis via use-livecode wrote:
> On 10/25/2023 12:34 AM, Mark Waddingham via use-livecode wrote:
>> 
>> If you want to do stuff with the current card of a stack, then don't 
>> use the currentCard property - 'this card of stack ...' *is* a chunk 
>> reference and thus it doesn't care whether the card has a name or not.
>> 
> 
> Okay, I get that <object> id <number> is a legacy return value when 
> there is no name.
> 
> I'd just like to confirm that:
> 
> this card of stack "X"
> and
> the currentCard of stack "X"
> 
> refer to the same card, even if in different ways (actual object 
> reference vs short name)?

Yes - 'the currentCard of stack "X"' is equivalent to 'the short name of 
this card of stack X'.

The currentCard property was added a very long time ago to be used by a 
project which never saw the light of day (I'm not sure I remember what 
it was now!)...

There was (apparently!) a need at that time to be able to switch cards 
in a stack *without* the stack coming to front (which is what happens 
when you use the only alternative 'go card ... of stack').

It was added as a property as that was the quickest/fastest way to do 
so, for something which I don't remember being entirely convinced by at 
the time - it wasn't documented for a long time, but then I think 
someone asked about it and it had been there long enough and it doesn't 
do any harm really so it was documented.

Basically, its main use was for changing card (i.e. as a settable 
property); rather than finding out what card was current (since that was 
already catered for via interrogating 'this card of this stack').

With hindsight, if the ability to switch cards without bringing the 
stack to front is indeed useful then it should probably be provided via 
a new command, or an augmentation of the 'go' command (like we have go 
visible / go invisible).

Warmest Regards,

Mark.

-- 
Mark Waddingham ~ mark at livecode.com ~ http://www.livecode.com/
LiveCode: Build Amazing Things



More information about the use-livecode mailing list