Board index » cppbuilder » Menu Item Caption

Menu Item Caption


2007-08-13 07:48:30 AM
cppbuilder4
When I create menu items at runtime, CBuilder include an ampersand (&) on
the Caption property. How can I avoid CBuilder adds the accelerator
character.
 
 

Re:Menu Item Caption

"LMario" < XXXX@XXXXX.COM >wrote:
Quote

When I create menu items at runtime, CBuilder include an
ampersand (&) on the Caption property.
What version of BCB?
Quote
How can I avoid CBuilder adds the accelerator character.
I would expect irespective of the version that if you
explicitly set the Caption that you would have to explicitly
include the ampersand.
Please show your actual code.
~ JD
 

Re:Menu Item Caption

BDS 2006 (CBuilder)
"JD" < XXXX@XXXXX.COM >wrote in message
Quote

"LMario" < XXXX@XXXXX.COM >wrote:
>
>When I create menu items at runtime, CBuilder include an
>ampersand (&) on the Caption property.

What version of BCB?

>How can I avoid CBuilder adds the accelerator character.

I would expect irespective of the version that if you
explicitly set the Caption that you would have to explicitly
include the ampersand.

Please show your actual code.

~ JD

 

{smallsort}

Re:Menu Item Caption

The code is:
TMenuItem *nuevoElemMenu = new TMenuItem(RestaurarRespaldo1);
nuevoElemMenu->Caption = sr.Name;
nuevoElemMenu->OnClick = restaurarBDExecute;
RestaurarRespaldo1->Add(nuevoElemMenu);
"JD" < XXXX@XXXXX.COM >wrote in message
Quote

"LMario" < XXXX@XXXXX.COM >wrote:
>
>When I create menu items at runtime, CBuilder include an
>ampersand (&) on the Caption property.

What version of BCB?

>How can I avoid CBuilder adds the accelerator character.

I would expect irespective of the version that if you
explicitly set the Caption that you would have to explicitly
include the ampersand.

Please show your actual code.

~ JD

 

Re:Menu Item Caption

"LMario" < XXXX@XXXXX.COM >wrote:
Quote

Again ... Please trim your posts. There is no need to clutter
this server (and many others that archive this server) with
stuff (expicative omitted).
Quote
The code is:

[...] nuevoElemMenu->Caption = sr.Name;
My best guess is that sr.Name is the guilty party. I am
assuming that it's being saved in such a way that the
Ampersand is included in the string. If that's the case,
then you must strip it our befo4re it's saved or before
you assign it to the Caption.
~ JD
 

Re:Menu Item Caption

"LMario" < XXXX@XXXXX.COM >wrote in message
Quote
When I create menu items at runtime, CBuilder include an
ampersand (&) on the Caption property. How can I avoid
CBuilder adds the accelerator character.
Set the AutoHotkeys property of each item to maManual. Or leave them set to
maParent (the default) and then set the TMainMenu's AutoHotKeys property to
mManual instead.
Gambit
 

Re:Menu Item Caption

"JD" < XXXX@XXXXX.COM >wrote in message
Quote
My best guess is that sr.Name is the guilty party.
I suggest you read up on the AutoHotKeys property.
Gambit
 

Re:Menu Item Caption

"Remy Lebeau \(TeamB\)" < XXXX@XXXXX.COM >wrote:
Quote

>My best guess is that sr.Name is the guilty party.

I suggest you read up on the AutoHotKeys property.
Until now I was ignorant of that property.
I've use dynamic allocation of TMenuItem's extensively and
never encountered this problem (I assume because of the
defaults) so what could the OP be doing to create such a
situation?
~ JD
 

Re:Menu Item Caption

"JD" < XXXX@XXXXX.COM >wrote in message
Quote
I've use dynamic allocation of TMenuItem's extensively and
never encountered this problem (I assume because of the
defaults) so what could the OP be doing to create such a
situation?
Obviously, he's not using the default values.
Gambit
 

Re:Menu Item Caption

"Remy Lebeau \(TeamB\)" < XXXX@XXXXX.COM >wrote:
Quote

Obviously, he's not using the default values.
LOL ... Dah!!
What I don't get is what he might be doing to change the
defaults and I'm very interested in that (as long as it
wasn't an errant click).
~ JD
 

Re:Menu Item Caption

I changed my code to:
TMenuItem *nuevoElemMenu = new TMenuItem(RestaurarRespaldo1);
nuevoElemMenu->Caption = sr.Name;
nuevoElemMenu->AutoHotkeys = maManual;
nuevoElemMenu->OnClick = restaurarBDExecute;
RestaurarRespaldo1->Add(nuevoElemMenu);
and nothing changes. CBuilder continues adding the ampersand.
However, I leave the AutoHotkeys property of the menu items I created
dynamically to the default and set the TMainMenu's AutoHotKeys property to
maManual and the ampersand go away.
Thanks.