 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
chris Guest
|
Posted: Fri Nov 07, 2003 10:01 am Post subject: RightToLeft menus |
|
|
BCB6
non-oriental windows
My question is quite simple: how to make the menu right aligned and
displayed from right to left when BiDiMode is set to RightToLeft, even in
non-oriental version of windows?
I know that in MFC the following code works (assuming mnuHandle and bdMode
are global vars for the example purpose):
void SetMenuDirection(void)
{
MENUITEMINFO mii;
char szBuffer [80];
//get current menu alignment
mii.cbSize = sizeof (MENUITEMINFO);
mii.fMask = MIIM_TYPE;
mii.dwTypeData= szBuffer;
mii.cch = sizeof (szBuffer);
GetMenuItemInfo(mnuHandle, 0, true, &mii);
mii.fMask = MIIM_TYPE;
if (bdMode == bdLeftToRight)
mii.fType = mii.fType & ~MFT_RIGHTJUSTIFY & ~MFT_RIGHTORDER;
else /* various bdRightToLeft */
mii.fType = mii.fType | MFT_RIGHTJUSTIFY | MFT_RIGHTORDER;
//update menu alignment
SetMenuItemInfo(mnuHandle, 0, true, &mii);
}
The "only" question is: where to put this code in BCB6?
The solution I think as the best is to write a TMyMainMenu VCL component
derived from TMainMenu, and to call SetDirection somewhere in the code.
I 've unsuccessfully tried to overload the following:
adjustBiDiBehavior
DoBiDiModeChanged
MenuChanged
IsRightToLeft
does anyone can help?
--
chris
|
|
| Back to top |
|
 |
chris Guest
|
Posted: Fri Nov 07, 2003 2:29 pm Post subject: Re: RightToLeft menus |
|
|
"chris" <blin_c (AT) epita (DOT) fr> a écrit dans le message de news:
3fab6caf$1 (AT) newsgroups (DOT) borland.com...
| Quote: | BCB6
non-oriental windows
My question is quite simple: how to make the menu right aligned and
displayed from right to left when BiDiMode is set to RightToLeft, even in
non-oriental version of windows?
[...] |
Well I am answering to myself: maybe it can help someone.
Well the solution is to derive a component from TMainMenu, then make the
SetMenuDirection a private method and overload the DoChange to make a call
to SetMenuDirection.
I have mixed this with a TAlignment property so it is changeable at runtime.
SetMenuDirection must be:
void SetMenuDirection(void)
{
MENUITEMINFO mii;
char szBuffer [80];
//get current menu alignment
mii.cbSize = sizeof (MENUITEMINFO);
mii.fMask = MIIM_TYPE;
mii.dwTypeData= szBuffer;
mii.cch = sizeof (szBuffer);
GetMenuItemInfo(mnuHandle, 0, true, &mii);
//update menu alignment
mii.fMask = MIIM_TYPE;
if (bdMode == bdLeftToRight)
mii.fType = mii.fType & ~MFT_RIGHTJUSTIFY & ~MFT_RIGHTORDER;
else /* various bdRightToLeft */
mii.fType = mii.fType | MFT_RIGHTJUSTIFY | MFT_RIGHTORDER;
SetMenuItemInfo(mnuHandle, 0, true, &mii);
//redraw the menu bar
TForm* parent = dynamic_cast<TForm*>(Owner);
if (parent) DrawMenuBar(parent->Handle);
}
regards,
chris
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|