Jump to content


Photo

Items[x].Items[x-1].Items[x-2]. ... .Items[x-n]?


  • Please log in to reply
4 replies to this topic

#1 Markus

Markus
  • Members
  • 54 posts

Posted 24 May 2006 - 07:20 PM

Howdy,

I'm wondering what you would expect from this line

CODE
Items[n].Items


Normally, I'd say you want to access all items that are n-th item's childs. But this is not how NextInspector treats items.

Some examples:

CODE
if Items[0].Items[2] = Items[1].Items[2] then
  ShowMessage('Say what?');


CODE
ShowMessage(IntToStr(Items.Count));  // obviously returns count of _all_ items (correct)
ShowMessage(IntToStr(Items[0].Items.Count));  // returns count of _all_ items
ShowMessage(IntToStr(Items[1].Items.Count));  // returns count of _all_ items
ShowMessage(IntToStr(Items[2].Items.Count));  // returns count of _all_ items


Is this (mis)behaviour by design?

Cheers,
Markus
It compiles, ship it!

#2 Boki (Berg)

Boki (Berg)

    Boki (Berg)

  • Forum Admin
  • PipPipPipPipPip
  • 8,289 posts
  • Gender:Male

Posted 24 May 2006 - 07:23 PM

Hello Markus,

You are probably using version 4. To obtain count of Child-Items inside Item, use Count property. To access to single item inside item with using relative index use Item.Item[x]

more details:
http://www.bergsoft....es&page=proprun

regards
boki@bergsoft.net | LinkedIn Profile
--
BergSoft Home Page: www.bergsoft.net
Users Section: users.bergsoft.net
Articles and Tutorials: help.bergsoft.net (Developers Network)
--
BergSoft Facebook page
--
Send us applications made with our components and we will submit them on: www.bergsoft.net/apps.htm. Link to this page will be also set on home page too.

#3 Markus

Markus
  • Members
  • 54 posts

Posted 24 May 2006 - 07:42 PM

Hi Boki,

I just wanted to add attention to this misleading behavior. Do you plan to keep it this way?

Cheers,
Markus
It compiles, ship it!

#4 Boki (Berg)

Boki (Berg)

    Boki (Berg)

  • Forum Admin
  • PipPipPipPipPip
  • 8,289 posts
  • Gender:Male

Posted 24 May 2006 - 08:03 PM

Hello,

Items property point to the all Items, not to child-items. Maybe I can made this property protected, but this will not be changed.
boki@bergsoft.net | LinkedIn Profile
--
BergSoft Home Page: www.bergsoft.net
Users Section: users.bergsoft.net
Articles and Tutorials: help.bergsoft.net (Developers Network)
--
BergSoft Facebook page
--
Send us applications made with our components and we will submit them on: www.bergsoft.net/apps.htm. Link to this page will be also set on home page too.

#5 Markus

Markus
  • Members
  • 54 posts

Posted 24 May 2006 - 09:15 PM

QUOTE (Boki (Berg) @ May 24 2006, 09:03 PM) <{POST_SNAPBACK}>
Hello,


Hello,

QUOTE (Boki (Berg) @ May 24 2006, 09:03 PM) <{POST_SNAPBACK}>
Items property point to the all Items, not to child-items. Maybe I can made this property protected, but this will not be changed.


I'm not talking about the items property in general and I'm not saying that Items[n].Items necessarily have to point to n-th item's childs if there are other properties for that. I'm talking about cascaded items properties that make no sense; they're redundant and misleading.

Anyway, just wanted to give suggestions from a customer's point of view.
It compiles, ship it!




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users