[ANN] HOOT: Hacked Object Oriented Transcript

Dick Kriesel dick.kriesel at mail.com
Mon Feb 27 17:06:23 EST 2006


On 2/27/06 11:30 AM, "Scott Rossi" <scott at tactilemedia.com> wrote:

>> control id pID of this stack
> 
> Actually, that's not what I meant.  Using the long name or ID provides a
> "full" path to an object (including the card the object sits on, group its
> in, etc).  I haven't used your notation above but using a "simple" object
> reference (that excludes the card reference for example) may be what causes
> the engine barf and lose track of things.

As I discussed with Mark, the problem with storing long ids is that they can
be brittle.  A stored long id becomes invalid when a developer moves a
control to a different group.

As Scott points out, the problem with storing short ids is that they can be
ambiguous.  A stored short id isn't sufficient to set or get a property of a
control that appears on more than one card.

A rugged id would avoid the brittleness and the ambiguity.

...
set the uPropertyThatRefersToARevObject of the target \
    to the uRuggedID of tRevObject
...

getProp uRuggedID
  put the long id of the target into tLongID
  if word 1 of tLongID is not "stack" then
    -- note: stacks do not have rugged ids
    put word 1 to 3 of tLongID into tRuggedID
    put offset(" of card id " & quote,tLongID) into tOffset
    if tOffset > 0 then
      put char tOffset to offset(space,tLongID,tOffset) - 1 \
          of tLongID after tRuggedID
    end if
  end if
  return tRuggedID
end uRuggedID

Comments?

-- Dick





More information about the use-livecode mailing list