Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Own parent

Participant ,
Feb 14, 2009 Feb 14, 2009
We all know that the InDesign application object is its own parent, but can anyone identify another object that can be its own parent?

I stumbled on this by accident the other day.

Just to be clear, I'm not talking about an object of a similar kind being the parent, for example, a rectangle can contain some other rectangle, I'm talking about an object which is its own parent.

Hint: even though what I've said is true, if you happen to pass one of these objects to the findPage/findWhere functions we've been playing with lately, you'll not be dumped into an endless loop. [Huh! How is that possible?]

Dave
TOPICS
Scripting
655
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Feb 14, 2009 Feb 14, 2009
Hmm.

That's a really good riddle!

The only object I could think of that fits the clue is Character. Sure
enough Character is listed in the OMV under the possible parents of a
Character. Under what situation that can happen? I've no idea... =-O

--
Harbs
http://www.in-tools.com
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Feb 14, 2009 Feb 14, 2009
You're on the right track, but it's not character (nor any text object). The parent of a character is always the story (or XMLStory).

Dave
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Feb 14, 2009 Feb 14, 2009
Okay. So when is a Cell its own parent?

--
Harbs
http://www.in-tools.com
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Feb 14, 2009 Feb 14, 2009
What do you know, I've just found two other related objects that have the same characteristic. They can be their own parent -- by which I mean, if you ask for:

myObj.parent

the object you get is myObj. Even to the extent that:

myObj.parent == myObj

returns true.

Dave
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Feb 14, 2009 Feb 14, 2009
That's it.

myCell = myTable.cells[0];
myOtherCellRef = myCell.cells[0];
myOtherCellRef == myCell; returns true

but

myOtherCellRef.parent == myCell; also returns true

same thing happens with rows (and I assume columns).

I suspect that it has something to do with the fact that you can reference sets of cells or it could just be an accidental thing.

myCell = myTable.cells[0].cells[0].cells[0].cells[0];

also works and gives you the same cell and if you work your way up the parental chain it takes you four steps to get to the table.

Dave
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Feb 15, 2009 Feb 15, 2009
LATEST
Very interesting!

The same basic concept applies to text objects. A
Character.characters[0].characters[0], etc. will always be the same
object. It only works down the parent chain. If you work up the chain,
the immediate parent will be the story.

I think the fact that it works down the chain is probably a feature
(i.e. if you do a search you can refer to characters[0] no matter what
the search returns -- even a Character). The fact that cells work up the
chain is probably a bug...

--
Harbs
http://www.in-tools.com
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines