controlIDs|Names of group

Moderators: heatherlaine, Klaus, FourthWorld, kevinmiller, LCMark

malte
Posts: 1098
Joined: Thu Feb 23, 2006 8:34 pm
Location: Ostenfeld germany
Contact:

Re: controlIDs|Names of group

Post by malte » Sat Nov 02, 2013 7:50 pm

Hi all,

dumb question: Should there be empty lines in the controlIDs of this cd?

Best,

Malte

mwieder
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2676
Joined: Mon Jan 22, 2007 7:36 am
Location: Berkeley, CA, US
Contact:

Re: controlIDs|Names of group

Post by mwieder » Sat Nov 02, 2013 8:24 pm

possibly dumber question: are you saying you *want* empty lines or that you currently see empty lines?

monte
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 1559
Joined: Fri Jan 13, 2012 1:47 am
Contact:

Re: controlIDs|Names of group

Post by monte » Sat Nov 02, 2013 10:07 pm

There shouldn't be no... There could be in controlNames in 6.5+ because the short name now returns empty instead of the abbrev id if the name is empty.
LiveCode User Group on Facebook : http://FaceBook.com/groups/LiveCodeUsers/

malte
Posts: 1098
Joined: Thu Feb 23, 2006 8:34 pm
Location: Ostenfeld germany
Contact:

Re: controlIDs|Names of group

Post by malte » Sat Nov 02, 2013 11:14 pm

Right. I was looking at controlIDs for sure which came up with empty lines, while I was trying to speed up revGeometry. Should I file this as a bug along with a stack?

monte
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 1559
Joined: Fri Jan 13, 2012 1:47 am
Contact:

Re: controlIDs|Names of group

Post by monte » Sat Nov 02, 2013 11:17 pm

Ooo.... I see one... weird, trying to work out how it's possible
LiveCode User Group on Facebook : http://FaceBook.com/groups/LiveCodeUsers/

monte
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 1559
Joined: Fri Jan 13, 2012 1:47 am
Contact:

Re: controlIDs|Names of group

Post by monte » Sat Nov 02, 2013 11:22 pm

Found it... not handling empty groups, I'll submit a pull request in a sec
LiveCode User Group on Facebook : http://FaceBook.com/groups/LiveCodeUsers/

monte
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 1559
Joined: Fri Jan 13, 2012 1:47 am
Contact:

Re: controlIDs|Names of group

Post by monte » Sat Nov 02, 2013 11:34 pm

OK, done: https://github.com/runrev/livecode/pull/348

Hopefully it will make 6.5 and maybe 6.1.3???
LiveCode User Group on Facebook : http://FaceBook.com/groups/LiveCodeUsers/

malte
Posts: 1098
Joined: Thu Feb 23, 2006 8:34 pm
Location: Ostenfeld germany
Contact:

Re: controlIDs|Names of group

Post by malte » Sun Nov 03, 2013 8:29 am

You're a star. Tis about time that all the contributors put the whiskey delivery add in their signatures. :-D

LCMark
Livecode Staff Member
Livecode Staff Member
Posts: 996
Joined: Thu Apr 11, 2013 11:27 am

Re: controlIDs|Names of group

Post by LCMark » Sun Nov 03, 2013 2:47 pm

There shouldn't be no... There could be in controlNames in 6.5+ because the short name now returns empty instead of the abbrev id if the name is empty.
No longer in 6.5-rc-1 - I reverted that 'fix' (bug 10981) as it was the wrong way to fix the problem (which has been around for an age) - see bug 11352.
Hopefully it will make 6.5 and maybe 6.1.3???
Thanks @monte - shouldn't be a problem :)

monte
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 1559
Joined: Fri Jan 13, 2012 1:47 am
Contact:

Re: controlIDs|Names of group

Post by monte » Mon Nov 04, 2013 12:55 am

Hold your whiskey @malte... it was my bug in the first place... a little embarrassing as it's now the second time on the one feature I've been caught out by empty groups... early on they crashed the engine!

@runrevmark
I have had occasion to wish that something like this didn't throw an execution error:

Code: Select all

put the long id of this cd into tCard
put the abbrev id of me into tAbbrevID
get the htmlText of tAbbrevID of tCard
The only workaround I've found is:

Code: Select all

put tAbbrevID && "of" && tCard into tObjectRef
get the htmlText of tObjectRef
Any chance that while your meddling to allow control "control id 1002" to work that you might allow that to work too?

The particular use case I can think of at the moment is in lcVCS where I need to iterate over all the cards a shared object is on to get the unshared properties.
LiveCode User Group on Facebook : http://FaceBook.com/groups/LiveCodeUsers/

LCMark
Livecode Staff Member
Livecode Staff Member
Posts: 996
Joined: Thu Apr 11, 2013 11:27 am

Re: controlIDs|Names of group

Post by LCMark » Mon Nov 04, 2013 10:46 am

@monte: You wouldn't be able to quite do that, but you would be able to do:

Code: Select all

put the long id of this cd into tCard
put the abbrev id of me into tAbbrevID
get the htmlText of [b]card[/b] tAbbrevID of tCard
The thing that came out of that incorrect bug fix was two-fold:

Firstly that if the short name can return '<type> id <id>', then you should be able to reference it in chunks:

Code: Select all

put the htmlText of card (the short name of card 1) -- assume card 1's short name returns 'card id 1002'
This throws an error at the moment as 'card id ...' isn't considered a 'name' of an object (unlike card "...", or ...).

The second is that there is no general way to resolve a long id of an object as an object reference, which is a problem when you want to perform a 'string' operation on an object:

Code: Select all

put the long id of field 1 into tFieldObj
put word 1 of the text of tFieldObj -- works as the property access makes it clear you want to interpret tFieldObj as an object
put word 1 of tFieldObj -- gives you 'field', as this is a string operation
This would be solved by making it so that if you have a control chunk in isolation, then it will resolve a full object reference; but if it is part of a sequence of chunks, it must only be something the engine considers to be a name of the object.

Code: Select all

put the long id of field 1 into tFieldObj
put word 1 of field tFieldObj -- works
put word 1 of field tFieldObj of card 2 -- throws an error as 'tFieldObj' already contains a card reference
The particular use case I can think of at the moment is in lcVCS where I need to iterate over all the cards a shared object is on to get the unshared properties.
Hmmm - I think it would be more efficient to use a hard coded chunk for this:

Code: Select all

  repeat for each line tCardId in tCardIdsControlIdIsOn
    get the <prop> of control id tControlId of card id tCardId
    ...
  end repeat

monte
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 1559
Joined: Fri Jan 13, 2012 1:47 am
Contact:

Re: controlIDs|Names of group

Post by monte » Mon Nov 04, 2013 11:35 am

runrevmark wrote:@monte: You wouldn't be able to quite do that, but you would be able to do:

Code: Select all

put the long id of this cd into tCard
put the abbrev id of me into tAbbrevID
get the htmlText of [b]card[/b] tAbbrevID of tCard
OK...
runrevmark wrote: Hmmm - I think it would be more efficient to use a hard coded chunk for this:

Code: Select all

  repeat for each line tCardId in tCardIdsControlIdIsOn
    get the <prop> of control id tControlId of card id tCardId
    ...
  end repeat
In this particular instance I have the card long id and the control id. I'm actually putting together a long id then using that because I can't:

Code: Select all

get the <prop> of control id tControlId of tCardRef
LiveCode User Group on Facebook : http://FaceBook.com/groups/LiveCodeUsers/

LCMark
Livecode Staff Member
Livecode Staff Member
Posts: 996
Joined: Thu Apr 11, 2013 11:27 am

Re: controlIDs|Names of group

Post by LCMark » Mon Nov 04, 2013 12:43 pm

@monte:
What breaks with:

Code: Select all

get the <prop> of control id tControlId of tCardRef
Here - as long as tControlId is a number and tCardRef is a long id, the engine should resolve tCardRef as a long id (of a card), which it should then search for a control id tControlId in...

monte
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 1559
Joined: Fri Jan 13, 2012 1:47 am
Contact:

Re: controlIDs|Names of group

Post by monte » Mon Nov 04, 2013 8:29 pm

Woops... nothing... it must have been that I had <abbrevid> of <long card id> that was failing... I'll change to this ;-)
LiveCode User Group on Facebook : http://FaceBook.com/groups/LiveCodeUsers/

monte
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 1559
Joined: Fri Jan 13, 2012 1:47 am
Contact:

Re: controlIDs|Names of group

Post by monte » Wed Nov 06, 2013 1:16 am

Would anyone else like child<any object type>IDs & <any object type>IDs ? I think it would be quite helpful...
LiveCode User Group on Facebook : http://FaceBook.com/groups/LiveCodeUsers/

Post Reply

Return to “Engine Contributors”