Sign in to follow this  
Followers 0
Anas

Left to Right Input with $WS_EX_LAYOUTRTL

6 posts in this topic

Hello,

 

Is it possible to left-aligns the text in an input that is a part of a GUI created with $WS_EX_LAYOUTRTL?

#include <GUIConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

#region - GUI Create
GUICreate('', 250, 100 -1, -1, -1, -1, $WS_EX_LAYOUTRTL)
GUICtrlCreateInput('', 5, 5) ; Make it display Left to Right
GUISetState()
#endregion

#region - GUI SelectLoop
While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            Exit
    EndSelect
WEnd
#endregion

Share this post


Link to post
Share on other sites



#include <GUIConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>
#include <EditConstants.au3>
#include <WinAPI.au3>


#region - GUI Create
GUICreate('', 250, 100 -1, -1, -1, -1, $WS_EX_LAYOUTRTL)
GUICtrlCreateInput('', 5, 5) ; Make it display Left to Right

Global $hInput = GUICtrlGetHandle(-1)
Global $InputStyle = _WinAPI_GetWindowLong($hInput, $GWL_STYLE)
Global $InputExStyle = _WinAPI_GetWindowLong($hInput, $GWL_EXSTYLE)

_WinAPI_SetWindowLong($hInput, $GWL_STYLE, BitXOR($InputStyle, $ES_RIGHT))
_WinAPI_SetWindowLong($hInput, $GWL_EXSTYLE, BitXOR($InputExStyle, 0x7000))


GUISetState()
#endregion

#region - GUI SelectLoop
While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            Exit
    EndSelect
WEnd
#endregion


Programming today is a race between software engineers striving to
build bigger and better idiot-proof programs, and the Universe
trying to produce bigger and better idiots.
So far, the Universe is winning.

Share this post


Link to post
Share on other sites

@funkey, where did you get the magic number 0x7000?


Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Share this post


Link to post
Share on other sites

@funkey, Thanks for the solution.

@funkey, where did you get the magic number 0x7000?

 

Also, why setting the required values at creation doesn't work?

This works:

GUICtrlCreateInput('test', 5, 5, 200, 50)
GUICtrlSetStyle(-1, 1342374016, 512)

This doesn't:

GUICtrlCreateInput('test', 5, 5, 200, 50, 1342374016, 512)

Share this post


Link to post
Share on other sites

Hi , i have a RTL form and when i added this line to my code , all of checkboxes becomes wrong or change ...

here is the image of wrong and true ...

tXlyd.png

GQ4vU.png

so , what can i do?!

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

@Anas : yes strange, the style does not applies direclty when creating the control, but need a GUICtrlSetStyle... I'm interested to understand why to.
 
Also, 2 other methods :

GUICreate('', 250, 100 -1, -1, -1, -1, $WS_EX_LAYOUTRTL)
GUICtrlCreateInput('test', 5, 5)
GUICtrlSetStyle(-1, $WS_VISIBLE + $WS_CHILD, $WS_EX_CLIENTEDGE)
#include <GUIConstants.au3>
#include <WinAPI.au3>


$hGui = GUICreate('', 250, 100)

GUICtrlCreateInput('test', 5, 5)

$iExStyle = _WinAPI_GetWindowLong($hGui, $GWL_EXSTYLE)
_WinAPI_SetWindowLong($hGui, $GWL_EXSTYLE, BitOR($iExStyle, $WS_EX_LAYOUTRTL)) ; sets the extended style after all controls are created

GUISetState()

While GUIGetMsg() <> $GUI_EVENT_CLOSE
    Sleep(10)
WEnd
Edited by jguinch

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0