News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests

Main Menu

Change Window's layout direction

Started by Diamond Star, November 21, 2013, 09:26:12 AM

Previous topic - Next topic

Diamond Star

Hello !
I know that window's style cannot be changed at run time but only when it was being created with CreatWindowEx API.
I need to change window's direction to Right to Left mode for right-direction languages, like Arabic and Persia. So I wish in the next updates that Easy Code's author may add new property make that possible even at Designing mode
And if there is a way to do that at run time then please tell me how
and THANK YOU

dedndave

GetWindowLong, GetWindowLongPtr, GetClassLong, GetClassLongPtr to get style/extended style bits
SetWindowLong, SetWindowLongPtr, SetClassLong, SetClassLongPtr to set style/extended style bits

http://msdn.microsoft.com/en-us/library/windows/desktop/ms633591%28v=vs.85%29.aspx
http://msdn.microsoft.com/en-us/library/windows/desktop/ms633588%28v=vs.85%29.aspx

Diamond Star


jj2007


dedndave

looks like Greek to me
well, no, i actually know some Greek alphabet characters   :P

jj2007

The point is, if you use a RichEdit control, like qEditor does, right-to-left is automatically enabled...

rsala

Hi Diamond Star,

Sorry for the inconveniences.

I have never had the chance to test Right-To-Left mode, but according to Microsoft documentation it should work if the window (or control) has the WS_EX_RTLREADING style. In Easy Code that is acomplished by setting the "RightToLeft" property to TRUE for every window and child control in the project. Doesn't that work?

Regards.
EC coder

Diamond Star

Thank you all
my friend rsala your idea is not beneficial here
Because I want to reverse the window entirely like this:


But no problem, I think this can be done with SetWindowLongPtr API according to what I read and find in MSDN.

rsala

Ok, thank you very much for the info. I'll see what I can do for Easy Code to work.

Regards.
EC coder

rsala

Hi Diamond Star,

I'm going to test the layout direction and I'm afraid I'll need your help. Are you using Masm or GoAsm version?

Thanks in advance,

Ramon
EC coder

Diamond Star

I finally do it,I find the resolution with this Code:

                  ;Revrese Window layout to RTLLAYOUT******
    .ElseIf uMsg == WM_NCCREATE
Invoke SetWindowLong, hWnd, GWL_EXSTYLE, WS_EX_LAYOUTRTL
Invoke InvalidateRect, hWnd, NULL, TRUE
;End of Revrese Window layout to RTLLAYOUT******


Befor about three days I searched deeply in MSDN and find my request exactly
I find it in MSDN in a document about windows layout and mirroring, where they talk

exactly about what I need where the programmer may need to change window layout after

creating it for making multi-langusge applications and put an example.
I get that code from it and insert it in WM_NCCREATE message as they said earlier
in thee document ans it works good
Thiscode should be inserted in WM_NCCREATE  to redirect the window and all its child

controls ,but if it is inserted in other place then only the window will be affected

dedndave

rather than using InvalidateRect, you might want to use RedrawWindow, instead
include the RDW_FRAME, RDW_INVALIDATE, and RDW_UPDATENOW flags

http://msdn.microsoft.com/en-us/library/windows/desktop/dd162911%28v=vs.85%29.aspx



dedndave

it's typical microsoft documentation - lol

sorry - my previous post was mis-leading
i was thinking of RedrawWindow but i meant to refer to SetWindowPos
but, i remembered that RedrawWindow had specific flags pertaining to redrawing the nonclient area (ie frame)

http://msdn.microsoft.com/en-us/library/windows/desktop/ms633545%28v=vs.85%29.aspx

QuoteIf you have changed certain window data using SetWindowLong, you must call SetWindowPos for the changes to take effect. Use the following combination for uFlags: SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_FRAMECHANGED.

Diamond Star

Thank You !
But I used only the code I put Previously and it works perfectly
and every thing goes well
SetWindowLong and InvalidateRect is enough and hit the target I wanted
the window redirected with all its child controls

Thanks for every one help in this topic