Sign in to follow this  
Followers 0
EKY32

InputBox RTL Prompt Text

5 posts in this topic

Hello, is it possible to get the prompt text direction RTL in the InputBox?

Thank you.


[font="'trebuchet ms', helvetica, sans-serif;"]Please mark the answer of your question if you found it.[/font]

Share this post


Link to post
Share on other sites



Try $WS_EX_LAYOUTRTL extended style for the input control.

 

Br,

UEZ


Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Share this post


Link to post
Share on other sites

Hello, sorry UEZ, I mean the Input Box not the input control.

InputBox("Question", "This text should be RTL", "Planet Earth")

[font="'trebuchet ms', helvetica, sans-serif;"]Please mark the answer of your question if you found it.[/font]

Share this post


Link to post
Share on other sites

#include <WinAPI.au3>
#include <Constants.au3>
#include <WindowsConstants.au3>

Opt("MustDeclareVars", 1)
Global $hHookInputBox

InputBox("Standard InputBox", "Please enter some text")
_InputBox("RTL InputBox", "Please enter some text")

Func _InputBox($title, $prompt, $default = Default, $passwordchar = Default, $width = Default, $height = Default, $left = Default, $top = Default, $timeout = Default, $hwnd = Default)
    Local $hProcInputBox = DllCallbackRegister("CbtHookProcInputBox", "int", "int;int;int")
    Local $TIDInputBox = _WinAPI_GetCurrentThreadId()
    $hHookInputBox = _WinAPI_SetWindowsHookEx($WH_CBT, DllCallbackGetPtr($hProcInputBox), 0, $TIDInputBox)
    Local $iRet = InputBox($title, $prompt, $default, $passwordchar, $width, $height, $left, $top, $timeout, $hwnd)
    Local $ierror = @error
    _WinAPI_UnhookWindowsHookEx($hHookInputBox)
    DllCallbackFree($hProcInputBox)
    Return SetError($ierror, "", $iRet)
EndFunc   ;==>_InputBox

Func CbtHookProcInputBox($nCode, $wParam, $lParam, $hHookInputBox)
    Local $RET = 0, $idText, $idInput
    If $nCode < 0 Then
        $RET = _WinAPI_CallNextHookEx($hHookInputBox, $nCode, $wParam, $lParam)
        Return $RET
    EndIf
    Switch $nCode
        Case 5 ;5=HCBT_ACTIVATE
            $idText = _WinAPI_GetDlgItem($wParam, 1002)
            $idInput = _WinAPI_GetDlgItem($wParam, 1001)
            _WinAPI_SetWindowLong($wParam, $GWL_EXSTYLE, BitOR(_WinAPI_GetWindowLong($wParam, $GWL_EXSTYLE), $WS_EX_LAYOUTRTL))
            _WinAPI_SetWindowLong($idText, $GWL_EXSTYLE, BitOR(_WinAPI_GetWindowLong($idText, $GWL_EXSTYLE), $WS_EX_LAYOUTRTL))
            _WinAPI_SetWindowLong($idInput, $GWL_EXSTYLE, BitOR(_WinAPI_GetWindowLong($idInput, $GWL_EXSTYLE), $WS_EX_LAYOUTRTL))
    EndSwitch
    Return
EndFunc   ;==>CbtHookProcInputBox

1 person likes this

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

You are amazing people!


[font="'trebuchet ms', helvetica, sans-serif;"]Please mark the answer of your question if you found it.[/font]

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