Author Topic: Change Window's layout direction  (Read 7427 times)

Diamond Star

  • Regular Member
  • *
  • Posts: 12
Change Window's layout direction
« on: November 21, 2013, 09:26:12 AM »
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

  • Member
  • *****
  • Posts: 8801
  • Still using Abacus 2.0
    • DednDave
Re: Change Window's layout direction
« Reply #1 on: November 21, 2013, 09:41:35 AM »
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

  • Regular Member
  • *
  • Posts: 12
Re: Change Window's layout direction
« Reply #2 on: November 21, 2013, 09:57:09 AM »
Thank you
I will see it and try it

jj2007

  • Member
  • *****
  • Posts: 8600
  • Assembler is fun ;-)
    • MasmBasic
Re: Change Window's layout direction
« Reply #3 on: November 21, 2013, 11:53:09 AM »
Try \Masm32\qEditor.exe ;)

dedndave

  • Member
  • *****
  • Posts: 8801
  • Still using Abacus 2.0
    • DednDave
Re: Change Window's layout direction
« Reply #4 on: November 21, 2013, 10:53:03 PM »
looks like Greek to me
well, no, i actually know some Greek alphabet characters   :P

jj2007

  • Member
  • *****
  • Posts: 8600
  • Assembler is fun ;-)
    • MasmBasic
Re: Change Window's layout direction
« Reply #5 on: November 22, 2013, 12:09:51 AM »
The point is, if you use a RichEdit control, like qEditor does, right-to-left is automatically enabled...

rsala

  • Moderator
  • Member
  • *****
  • Posts: 271
    • Easy Code
Re: Change Window's layout direction
« Reply #6 on: November 23, 2013, 09:54:20 PM »
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

  • Regular Member
  • *
  • Posts: 12
Re: Change Window's layout direction
« Reply #7 on: December 05, 2013, 10:17:47 AM »
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

  • Moderator
  • Member
  • *****
  • Posts: 271
    • Easy Code
Re: Change Window's layout direction
« Reply #8 on: December 07, 2013, 09:20:16 PM »
Ok, thank you very much for the info. I'll see what I can do for Easy Code to work.

Regards.
EC coder

rsala

  • Moderator
  • Member
  • *****
  • Posts: 271
    • Easy Code
Re: Change Window's layout direction
« Reply #9 on: December 08, 2013, 10:08:36 AM »
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

  • Regular Member
  • *
  • Posts: 12
Re: Change Window's layout direction
« Reply #10 on: December 12, 2013, 10:48:12 AM »
I finally do it,I find the resolution with this Code:
Code: [Select]
                  ;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

  • Member
  • *****
  • Posts: 8801
  • Still using Abacus 2.0
    • DednDave
Re: Change Window's layout direction
« Reply #11 on: December 12, 2013, 11:16:50 AM »
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

  • Member
  • *****
  • Posts: 8801
  • Still using Abacus 2.0
    • DednDave
Re: Change Window's layout direction
« Reply #12 on: December 13, 2013, 04:39:16 AM »
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

Quote
If 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

  • Regular Member
  • *
  • Posts: 12
Re: Change Window's layout direction
« Reply #13 on: December 15, 2013, 08:58:21 AM »
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