Home General
New Blog Posts: Merging Reports - Part 1 and Part 2

Hide Most Recently Used File List

edited May 2004 in General
In order to hide the most recently file used list in the designer, I use the
following code:

ppDesigner1.Menu.Items[0].Items[22].Visible := False;
ppDesigner1.Menu.Items[0].Items[23].Visible := False;
ppDesigner1.Menu.Items[0].Items[24].Visible := False;
ppDesigner1.Menu.Items[0].Items[25].Visible := False;
ppDesigner1.Menu.Items[0].Items[26].Visible := False;

However for some users I get a list out of bounds error. I guess that this
is because on some computers there may not be any previous values to put in
the array??

I tried to put in an if statement before trying to assign to the property:

if ppDesigner1.Menu.Items[0].Items.Count >= 21 then

but it won't compile because the final Items apparently does not have a
count property.

How can I solve this problem?

Thanks,

Al Willis

Comments

  • edited May 2004
    Hi Al,

    You can find the number of subitems inside a main menu item by using the
    TMenuItem.Count property. For instance...

    if ppDesigner1.Menu.Items[0].Count >= 21 then ...


    --
    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
This discussion has been closed.