BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

RightToLeft menus

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (VCL Components Development)
View previous topic :: View next topic  
Author Message
chris
Guest





PostPosted: Fri Nov 07, 2003 10:01 am    Post subject: RightToLeft menus Reply with 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?

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





PostPosted: Fri Nov 07, 2003 2:29 pm    Post subject: Re: RightToLeft menus Reply with quote



"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
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (VCL Components Development) All times are GMT
Page 1 of 1

 
Jump to:  
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


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.