Jump to content

LTR input in RTL gui


Mateo
 Share

Recommended Posts

  • Moderators

Mateo,

I did this a while ago:

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

  • Moderators

Mateo,

Quote

 isn't there something that works better?

Not exactly fulsome in your thanks, are you?

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

19 hours ago, Mateo said:

I have a GUI set to RTL, and I want to create a certain input that will be ltr.

A simple way to do it :

#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>

$hGui = GUICreate("", 260, 100, -1, -1, -1, BitOr($WS_EX_LAYOUTRTL, $WS_EX_NOINHERITLAYOUT))

GUICtrlCreateLabel("Username", 15, 15, 80, 20, $SS_RIGHT)

$id_Username = GUICtrlCreateInput("", 80, 10, 100, 20) ; LTR
; $id_Username = GUICtrlCreateInput("", 80, 10, 100, 20, BitOr($ES_RIGHT, $ES_AUTOHSCROLL)) ; RTL

$id_OK = GUICtrlCreateButton("OK", 190, 10, 60, 50)

GUISetState()

While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE, $id_OK
            GUIDelete($hGui)
            ExitLoop
    EndSwitch
WEnd

Edit: added syntax for both kind of Input controls (LTR or RTL), also added $SS_RIGHT for the label control.

Edited by pixelsearch
Link to comment
Share on other sites

  • Moderators

pixelsearch,

Excellent work!

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

Tests show that OP will have a little problem, because probably all his Input controls are already RTL and he wants to add now an LTR input control.

So changing the extended style of his RTL GUI from $WS_EX_LAYOUTRTL to BitOr($WS_EX_LAYOUTRTL, $WS_EX_NOINHERITLAYOUT) will solve his LTR issue... but will create some issues in his RTL Input and RTL Label controls which are already designed.

Though I indicated a possible syntax to use them in the precedent script ($SS_RIGHT for labels,  BitOr($ES_RIGHT, $ES_AUTOHSCROLL) for RTL input controls), little issues may still be annoying (bad cursor position while filling RTL input controls, Del and Backspace keys will be a bit hard to handle)

If there is only one LTR input control and many RTL input controls in his RTL Gui, then the following script may be more useful, because OP will be allowed to fill his LTR input control (please note the position of the cursor while it is filled and the "difficulty" to use Del & Backspace keys) but at least, he won't find any problem in all his RTL input controls (you can check that in the following script by switching the commented line of the $id_Username control)

#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>

$hGui = GUICreate("", 260, 100, -1, -1, -1, $WS_EX_LAYOUTRTL)

GUICtrlCreateLabel("Username", 15, 15, 80, 20)

$id_Username = GUICtrlCreateInput("", 80, 10, 100, 20, BitOr($ES_RIGHT, $ES_AUTOHSCROLL)) ; LTR
; $id_Username = GUICtrlCreateInput("", 80, 10, 100, 20) ; RTL

$id_OK = GUICtrlCreateButton("OK", 190, 10, 60, 50)

GUISetState()

While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE, $id_OK
            GUIDelete($hGui)
            ExitLoop
    EndSwitch
WEnd

It should have been great to use the code of the 1st script for the LTR input control and the code of this 2nd script for all the RTL input controls !

Good luck Mateo

Edited by pixelsearch
typo
Link to comment
Share on other sites

@Mateo : you're welcome.

@Melba23 : if both precedent scripts aren't enough, here is a 3rd script, which follows your idea to place the LTR input control inside a child window (i.e. the link you provided to Mateo). I succeeded doing it in a simple way, by creating a $WS_CHILD window (and not a $WS_EX_MDICHILD which would steal the focus unless we register etc...)

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

$hGui = GUICreate("", 300, 100, -1, -1, -1, $WS_EX_LAYOUTRTL)

$id_OK = GUICtrlCreateButton("OK", 220, 10, 60, 50)

GUICtrlCreateLabel("Username (RTL)", 10, 15, 85, 20)
$id_Username = GUICtrlCreateInput("", 100, 10, 100, 20) ; RTL

GUICtrlCreateLabel("Location (LTR)", 10, 45, 85, 20)

$hGui2 = GUICreate("", 100, 20, 100, 40, $WS_CHILD, BitOr($WS_EX_NOINHERITLAYOUT, $WS_EX_CONTROLPARENT), $hGui)
$id_Location = GUICtrlCreateInput("", 0, 0, 100, 20) ; LTR

GUISetState(@SW_SHOW, $hGui)
GUISetState(@SW_SHOW, $hGui2)

While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE, $id_OK
            GUIDelete($hGui)
            GUIDelete($hGui2)
            ExitLoop
    EndSwitch
WEnd

In this 3rd script, $WS_EX_CONTROLPARENT is applied to the $WS_CHILD window, which allows to Tab through all Controls (Parent & Child) fluently. The fact that the Child window has exactly the same size as its inner Input control prevents the "AutoIt feature" to drag the child window here & there.

Please note how the cursor is now "well-placed" when we fill any of the Input Controls (RTL or LTR). Also the Del & BackSpace keys behave normally while we fill any of the Input Controls (which wasn't the case in the 2 precedent scripts)

So, bye-bye $SS_RIGHT, $ES_RIGHT and all the #Include gang... while $WS_EX_NOINHERITLAYOUT is still here :)

Edited by pixelsearch
typo
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...