Board index » cppbuilder » disable MainMune item

disable MainMune item


2003-10-30 10:18:23 PM
cppbuilder68
Hi,
how do I disble one Entry in TMainMenu?
Hi have File
New
Open
Save
Close
in a Menu and want to disable the Save Entry, how do I do this?
Thank you very much!
 
 

Re:disable MainMune item

TMenuItem* item = MainMenu->Items->Find("Save");
if (item)
item->Enabled = false;
 

Re:disable MainMune item

Ron Eggler wrote:
Quote
Hi,

how do I disble one Entry in TMainMenu?
Hi have File
New
Open
Save
Close
in a Menu and want to disable the Save Entry, how do I do this?
Thank you very much!
Save1->Enabled=false;
Save1 is the name of the Save menu item. It may differ from the default
if you changed it.
k
 

{smallsort}

Re:disable MainMune item

This doesn't work... :(
PaoloItaly wrote:
Quote
TMenuItem* item = MainMenu->Items->Find("Save");
if (item)
item->Enabled = false;
 

Re:disable MainMune item

"Ron Eggler" < XXXX@XXXXX.COM >wrote:
Quote
This doesn't work... :(
Perhaps you needed to include an ampersand?
TMenuItem* item = MainMenu->Items->Find("&Save");
~ JD
Quote

--
grEEz roN
www.rideon.ch

PaoloItaly wrote:
>TMenuItem* item = MainMenu->Items->Find("Save");
>if (item)
>item->Enabled = false;


 

Re:disable MainMune item

no, now I have:
TMenuItem* item = MainMenu1->Items->Find("Initialisieren");
if (item)
item->Enabled = false;
and it still doesn't work, it's not disabled... :(
and i used the de{*word*81} to check if item really has a value but it
doesn't.... :( that means, the if is false....means it would go to the
else...
JD wrote:
Quote
"Ron Eggler" < XXXX@XXXXX.COM >wrote:
>This doesn't work... :(

Perhaps you needed to include an ampersand?

TMenuItem* item = MainMenu->Items->Find("&Save");

~ JD

>
>--
>grEEz roN
>www.rideon.ch
>
>PaoloItaly wrote:
>>TMenuItem* item = MainMenu->Items->Find("Save");
>>if (item)
>>item->Enabled = false;
 

Re:disable MainMune item

"Ron Eggler" < XXXX@XXXXX.COM >wrote in message news:bntcim$12e4tb$ XXXX@XXXXX.COM ...
What is the name of your menu item?
Not the caption, but the name.
You can just do this:
Save1->Enabled = false;
if the menu item name is Save1.
Todd
 

Re:disable MainMune item

"PaoloItaly" < XXXX@XXXXX.COM >wrote in message
Quote
TMenuItem* item = MainMenu->Items->Find("Save");
That will not work. Since "Save" is a child of "File", you need to get the
TMenuItem* pointer of "File" first before you can then get the pointer for
"Save", ie:
TMenuItem * = MainMenu->Items->Find("File");
if( item )
{
item = item->Find("Save");
if( item )
item->Enabled = false;
}
Or, if the menu items were created at design-time, then just use the Save
pointer directly, ie:
Save1->Enabled = false;
Gambit
 

Re:disable MainMune item

I did this way:
MainMenu1->Items->Items[0]->Items[3]->Enabled = false;
works perfect.
Remy Lebeau (TeamB) wrote:
Quote
"PaoloItaly" < XXXX@XXXXX.COM >wrote in message
news: XXXX@XXXXX.COM ...
>TMenuItem* item = MainMenu->Items->Find("Save");

That will not work. Since "Save" is a child of "File", you need to
get the TMenuItem* pointer of "File" first before you can then get
the pointer for "Save", ie:

TMenuItem * = MainMenu->Items->Find("File");
if( item )
{
item = item->Find("Save");
if( item )
item->Enabled = false;
}

Or, if the menu items were created at design-time, then just use the
Save pointer directly, ie:

Save1->Enabled = false;


Gambit