Thanks Helmut
>How can I hide a main menu item, the visible property does not seem to work
>with that one.
Works for me. What version of Delphi are you using?
---
Yorai Aminov (TeamB)
http://ourworld.compuserve.com/homepages/yaminov
(TeamB cannot answer questions received via email.
To contact me for any other reason remove nospam from my address)
I take it you want to hide the entire menu??
I'd take a look at RemoveComponent and InsertComponent.
You'll need to assign your main menu component to something else in your
FormCreate for example:
SaveMainMenu := MainMenu1;
The reason for this is that as soon as you use RemoveComponent, your form no
longer knows anything about MainMenu1 (and Delphi sets the variable for
MainMenu1 to nil)..
To remove the main menu from the form (ugly since its going to scroll
everything up):
RemoveComponent(SaveMainMenu);
To show the main menu:
InsertComponent(SaveMainMenu)
I've no idea whether this confuses the hell out of the the VCL when it tries to
tidy up the VCL controls when closing. Use at your own risk. Someone else might
have better ideas though.
Graeme
http://www.gajits.com
Helmut Leitner wrote:
> How can I hide a main menu item, the visible property does not seem to work
> with that one.
>
> Thanks Helmut
Regards Helmut
Yorai Aminov (TeamB) <yam...@nospam.trendline.co.il> wrote in message
news:37c456af...@forums.inprise.com...
> On Wed, 25 Aug 1999 07:44:25 +0800, "Helmut Leitner"
> <ct...@ctr.com.au> wrote:
>
> >How can I hide a main menu item, the visible property does not seem to
work
> >with that one.
>
Yes forgot to mention that I want to hide/show a main menu item at
runtime. e.g hide the Tools menu with all associated menu items.
Regards Helmut
Graeme Chandler (Melbourne) <gra...@gajits.com> wrote in message
news:37C34991...@gajits.com...
> Hi Helmut
>
> I take it you want to hide the entire menu??
>
> I'd take a look at RemoveComponent and InsertComponent.
>
> You'll need to assign your main menu component to something else in your
> FormCreate for example:
>
> SaveMainMenu := MainMenu1;
>
> The reason for this is that as soon as you use RemoveComponent, your form
no
> longer knows anything about MainMenu1 (and Delphi sets the variable for
> MainMenu1 to nil)..
>
> To remove the main menu from the form (ugly since its going to scroll
> everything up):
>
> RemoveComponent(SaveMainMenu);
>
> To show the main menu:
>
> InsertComponent(SaveMainMenu)
>
> I've no idea whether this confuses the hell out of the the VCL when it
tries to
> tidy up the VCL controls when closing. Use at your own risk. Someone else
might
> have better ideas though.
>
> Graeme
> http://www.gajits.com
>
> Helmut Leitner wrote:
>
> > How can I hide a main menu item, the visible property does not seem to
work
> > with that one.
> >
> > Thanks Helmut
>
>Sorry forgot to mention that I am trying to change the visible property at
>run time
>I am using version 4.03 and have never been able to hide or disable main
>menu items at run time.
Works just fine for me. I created the following menu structure in a
new Delphi project:
File Edit Window
New Cut Tile
Open Copy Cascade
Paste
I then dropped a button on the form and put the following code in its
OnClick event handler:
Edit1.Visible := not Edit1.Visible;
Clicking the button at runtime toggles the visibility of the Edit menu
as expected.
-Steve
>Sorry forgot to mention that I am trying to change the visible property at
>run time
>I am using version 4.03 and have never been able to hide or disable main
>menu items at run time.
I can't reproduce this. I've set a main menu item's Visible property
at run time and it works just fine. I've tested with Delphi 3, 4, and
5.
Regards Helmut
Yorai Aminov (TeamB) <yam...@nospam.trendline.co.il> wrote in message
news:37c5546c...@forums.inprise.com...
>
Andrey.
Helmut Leitner <hlei...@ctr.com.au> wrote in message
news:7q4jmn$pj...@forums.borland.com...