Discussion:
Internationalization - mirroring toolbars
(too old to reply)
crswesty
2007-06-19 09:07:03 UTC
Permalink
I'm posting this in the MFC newsgroup because the application I'm working
with is an MFC MDI one so apologies if it should be elsewhere.

When I set the WS_EX_LAYOUTRTL in the CMainFrame PreCreateWindow function
the window in mirrored as expected, as is the toolbar. I would like to stop
the bitmaps on the toolbar getting reflected and have found articles on the
MSDN site that talk about setting the LAYOUT_BITMAPORIENTATIONPRESERVED flag
on the current device context.

This may very well fix the problem but I don't know where I should be
setting this flag, I have tried to do this in the CMainFrame class in
OnCreate.

Can someone please advise on how to resolve this issue?
Tom Serface
2007-06-19 13:20:55 UTC
Permalink
I've never tried it, but it looks like you set this in a call to SetLayout()
as part of the CDC object of a CWnd. You could do this for the toolbar
window, for example, I'd think in the OnCreate() function in mainframe right
after the toolbar is created. You may have to redraw the toolbar window.

You could get the toolbar CDC using GetDC(), but I don't know if that works
for the whole toolbar or if the individual buttons have their own context.
Worth a try though.

Something like:

// Create toolbar then...
CDC *dc = m_MyToolbar.GetDC();
dc->SetLayout(LAYOUT_RTL | LAYOUT_BITMAPORIENTATIONPRESERVED);

Tom
Post by crswesty
I'm posting this in the MFC newsgroup because the application I'm working
with is an MFC MDI one so apologies if it should be elsewhere.
When I set the WS_EX_LAYOUTRTL in the CMainFrame PreCreateWindow function
the window in mirrored as expected, as is the toolbar. I would like to stop
the bitmaps on the toolbar getting reflected and have found articles on the
MSDN site that talk about setting the LAYOUT_BITMAPORIENTATIONPRESERVED flag
on the current device context.
This may very well fix the problem but I don't know where I should be
setting this flag, I have tried to do this in the CMainFrame class in
OnCreate.
Can someone please advise on how to resolve this issue?
crswesty
2007-06-20 14:49:00 UTC
Permalink
Thanks for yor response.

I tried doing what you suggested and called SetLayout on the CDC object of
the toolbar window in OnCreate without success. I also called

RepositionBars(AFX_IDW_CONTROLBAR_FIRST, AFX_IDW_CONTROLBAR_LAST,0);

To redraw the toolbar.

Not sure at all how to proceed
Post by Tom Serface
I've never tried it, but it looks like you set this in a call to SetLayout()
as part of the CDC object of a CWnd. You could do this for the toolbar
window, for example, I'd think in the OnCreate() function in mainframe right
after the toolbar is created. You may have to redraw the toolbar window.
You could get the toolbar CDC using GetDC(), but I don't know if that works
for the whole toolbar or if the individual buttons have their own context.
Worth a try though.
// Create toolbar then...
CDC *dc = m_MyToolbar.GetDC();
dc->SetLayout(LAYOUT_RTL | LAYOUT_BITMAPORIENTATIONPRESERVED);
Tom
Post by crswesty
I'm posting this in the MFC newsgroup because the application I'm working
with is an MFC MDI one so apologies if it should be elsewhere.
When I set the WS_EX_LAYOUTRTL in the CMainFrame PreCreateWindow function
the window in mirrored as expected, as is the toolbar. I would like to stop
the bitmaps on the toolbar getting reflected and have found articles on the
MSDN site that talk about setting the LAYOUT_BITMAPORIENTATIONPRESERVED flag
on the current device context.
This may very well fix the problem but I don't know where I should be
setting this flag, I have tried to do this in the CMainFrame class in
OnCreate.
Can someone please advise on how to resolve this issue?
Loading...