Jump to content

input field with $ES_AUTOHSCROLL start at the left side


colombeen
 Share

Go to solution Solved by Melba23,

Recommended Posts

Hi guys

I was looking for a solution to my small problem. I have an interface that has readonly input fields with $ES_AUTOHSCROLL enabled, but when the text is longer then the input field it automatically places the text more to the left.

the input fields are provided with text, so for readability it would be better if the text would start at the left and not at the right.

example :

when you have a piece of text like : "my test text for the input field" and you can only see like 10 chars it shows this :

"e input field"

I want to see : "my test text f" so that you can scroll to the right.

anyone who has had this problem and knows how to fix this?

if I leave out the autohscroll it starts like i want it at the left but then you can't see the text that is hidden past the visible space of the input (because the readonly forces it to not be able to scroll).

Edited by colombeen
Link to comment
Share on other sites

  • Moderators

colombeen,

Like this perhaps? :huh:

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

$hGUI = GUICreate("Test", 500, 500)

$cInput = GUICtrlCreateInput("my test text for the input field", 10, 10, 100, 20, BitOr($ES_AUTOHSCROLL, $ES_READONLY))

GUISetState()

ControlSend($hGUI, "", $cInput, "{HOME}")

While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
    EndSwitch
WEnd
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

Try using $ES_HSCROLL

Melba's got you covered ;)

Edited by MikahS

Snips & Scripts


My Snips: graphCPUTemp ~ getENVvars
My Scripts: Short-Order Encrypter - message and file encryption V1.6.1 ~ AuPad - Notepad written entirely in AutoIt V1.9.4

Feel free to use any of my code for your own use.                                                                                                                                                           Forum FAQ

 

Link to comment
Share on other sites

  • Moderators

colombeen,

this doesn't look very practical

Really? Just put the ControlIDs of the 20+ inputs into an array and a simple loop will quickly send the command to each one in turn. :)

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

I'll try it. just hope this doesn't slow the whole thing down too much.

I don't think your code completely works. in your example it works because you only have the input field but in my example it doesn't work.

my guess is because you need to set focus first on every field?

Edited by colombeen
Link to comment
Share on other sites

Post your script, Melba is just stabbing at it right now and I'm sure he can help better by seeing what exactly you are trying to accomplish :)

Snips & Scripts


My Snips: graphCPUTemp ~ getENVvars
My Scripts: Short-Order Encrypter - message and file encryption V1.6.1 ~ AuPad - Notepad written entirely in AutoIt V1.9.4

Feel free to use any of my code for your own use.                                                                                                                                                           Forum FAQ

 

Link to comment
Share on other sites

This is the interface that I have :

#NoTrayIcon
#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Icon=icon.ico
#AutoIt3Wrapper_Outfile=DigiAD.exe
#AutoIt3Wrapper_Compression=4
#AutoIt3Wrapper_UseUpx=y
#AutoIt3Wrapper_Res_Comment=This tool was made by Jarno Colombeen
#AutoIt3Wrapper_Res_Description=DigiAD is an alternative tool for the default Active Directory tool
#AutoIt3Wrapper_Res_Fileversion=1.2.0.8
#AutoIt3Wrapper_Res_Fileversion_AutoIncrement=p
#AutoIt3Wrapper_Res_ProductVersion=1.2
#AutoIt3Wrapper_Res_LegalCopyright=Jarno Colombeen
#AutoIt3Wrapper_Res_Language=1033
://////=__=
#AutoIt3Wrapper_Add_Constants=n
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
;========================================================================;
#cs

    Script:         DigiAD
    Author:         Jarno Colombeen
    Copyright:      colombeen.be

    Description:    DigiAD is an alternative tool for the default
                    Active Directory tool

    Date:           19/08/2014
    AutoIt Version: 3.3.10.2

#ce
Opt("GuiOnEventMode", 1)
;========================================================================;
; General variables
;========================================================================;
    Global $AppDataDir  =   @AppDataDir & "\DigiAD\"
    Global $DigiAD_INI  =   $AppDataDir & "Config.ini"
    Global $DigiAD, $DigiAD_PopUp, $AD_results, $Tabs
    Global $SearchInput, $SearchButton, $SearchButtonReset
    Global $TU_ImageButton, $TU_Name, $TU_TelephoneNr, $TU_Email, $TU_Description, $TU_Company, $TU_Department, $TU_Title, $TU_Office
    Global $TU_Username, $TU_Email_Logon, $TU_A_Expires, $TU_P_Expires, $TU_P_Set, $TU_Custom10, $TU_Custom2, $TU_HomeDrive, $TU_Logonscript
    Global $TU_A_Locked, $TU_A_Disabled, $TU_A_Expired, $TU_P_Expired, $TU_P_Change, $TU_P_Locked
    Global $TU_MemberOf
    Global $TU_LastLogon, $TU_LockoutState
    Global $TU_ExchangeAddr
    Global $TU_UnlockButton, $TU_EnDisableButton, $TU_ResetPwd1Button, $TU_ResetPwd2Button, $TU_ResetAtNextLogon
    Global $Search1Input, $Search2Input, $CompareButton, $CompareButtonReset
    Global $CU_User1, $CU_Both, $CU_User2
    Global $colorRed    =   0xFF0000
    Global $colorGreen  =   0x00CC00
    Global $colorWhite  =   0xFFFFFF
    Global $colorBlack  =   0x00000
    If @Compiled = 0 Then Global $ErrorHandler = ObjEvent("AutoIt.Error", "_ErrFunc")
;========================================================================;
; Required files
;========================================================================;
    #include <AD.au3>
    #include <ButtonConstants.au3>
    #include <EditConstants.au3>
    #include <GUIConstantsEx.au3>
    #include <ListBoxConstants.au3>
    #include <ListViewConstants.au3>
    #include <StringConstants.au3>
    #include <TabConstants.au3>
    #include <WindowsConstants.au3>
    #include "functions.au3"
;========================================================================;
; Init App
;========================================================================;
Func _init ()
    ; Open AD connection
    _AD_Open ()
    If @error Then Exit MsgBox(16, "DigiAD", "Er kan geen verbinding worden gemaakt met Active Directory." & @CRLF & "Error code : " & @error & @CRLF & "Extended error : " & @extended)

    ; GUI
    If FileExists ($DigiAD_INI) And @Compiled = 1 Then
        $DigiAD             =   GUICreate ("Digipolis Active Directory tool", 900, 700, IniRead ($DigiAD_INI, "PosX", "value", 0), IniRead ($DigiAD_INI, "PosY", "value", 0))
    Else
        $DigiAD             =   GUICreate ("Digipolis Active Directory tool", 900, 700)
    EndIf
    GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit", $DigiAD)
    GUISetFont (_fontsizeDPI (8), 400, 0, "Verdana", $DigiAD)
    GUICtrlSetDefColor ($colorBlack, $DigiAD)

    ; GUI Menubar
    $menu_file          =   GUICtrlCreateMenu("Bestand")
    $menu_file_quit     =   GUICtrlCreateMenuItem("Sluiten", $menu_file)
    GUICtrlSetOnEvent (-1, "_Exit")
    $menu_help          =   GUICtrlCreateMenu("Help")
    $menu_help_about    =   GUICtrlCreateMenuItem("Over DigiAD", $menu_help)

    ; GUI Tabs
    $Tabs               =   GUICtrlCreateTab (5, 5, 890, 670, $TCS_FOCUSNEVER)
    GUICtrlSetOnEvent (-1, "_DigiAD_Change_Focus")

    ;==================== ACCOUNT INFO ====================

    $TabUser            =   GUICtrlCreateTabItem (" Account informatie ")
    ; Search
    GUICtrlCreateGroup (" Zoeken ", 20, 40, 860, 47)
    _GUICtrlCreateLabel ("Naam", 160, 58, 50, 20, 0)
    $SearchInput        =   GUICtrlCreateInput ("", 220, 56, 240, 20)
    $SearchButton       =   GUICtrlCreateButton ("Zoeken", 480, 54, 90, 24, $BS_DEFPUSHBUTTON)
    GUICtrlSetOnEvent (-1, "_AD_Gather_Information")
    $SearchButtonReset  =   GUICtrlCreateButton ("Alles wissen", 580, 54, 120, 24)
    GUICtrlSetOnEvent (-1, "_AD_Reset_Fields")

    ; General
    GUICtrlCreateGroup (" Algemeen ", 20, 103, 300, 200)
    GUICtrlCreateButton ("F", 285, 122, 22, 22, $BS_ICON)
    GUICtrlSetImage (-1, "shell32.dll", 22, 0)
    GUICtrlSetTip (-1, "Foto van de gebruiker")
    GUICtrlSetOnEvent (-1, "_AD_Show_Picture")
    _GUICtrlCreateLabel ("Naam", 35, 125, 50, 20, 0)
    $TU_Name            =   GUICtrlCreateInput ("", 115, 123, 169, 20, BitOR ($ES_AUTOHSCROLL, $ES_READONLY))
    _GUICtrlCreateLabel ("Telefoon", 35, 146, 50, 20, 0)
    $TU_TelephoneNr     =   GUICtrlCreateInput ("", 115, 144, 190, 20, BitOR ($ES_AUTOHSCROLL, $ES_READONLY))
    _GUICtrlCreateLabel ("E-mail", 35, 167, 50, 20, 0)
    $TU_Email           =   GUICtrlCreateInput ("", 115, 165, 190, 20, BitOR ($ES_AUTOHSCROLL, $ES_READONLY))
    _GUICtrlCreateLabel ("Bedrijf", 35, 188, 50, 20, 0)
    $TU_Description     =   GUICtrlCreateInput ("", 115, 186, 190, 20, BitOR ($ES_AUTOHSCROLL, $ES_READONLY))
    _GUICtrlCreateLabel ("Groep", 35, 209, 50, 20, 0)
    $TU_Company         =   GUICtrlCreateInput ("", 115, 207, 190, 20, BitOR ($ES_AUTOHSCROLL, $ES_READONLY))
    _GUICtrlCreateLabel ("Cel", 35, 230, 50, 20, 0)
    $TU_Department      =   GUICtrlCreateInput ("", 115, 228, 190, 20, BitOR ($ES_AUTOHSCROLL, $ES_READONLY))
    _GUICtrlCreateLabel ("Functie", 35, 251, 50, 20, 0)
    $TU_Title           =   GUICtrlCreateInput ("", 115, 249, 190, 20, BitOR ($ES_AUTOHSCROLL, $ES_READONLY))
    _GUICtrlCreateLabel ("Kantoor", 35, 272, 50, 20, 0)
    $TU_Office          =   GUICtrlCreateInput ("", 115, 270, 190, 20, BitOR ($ES_AUTOHSCROLL, $ES_READONLY))

    ; Account
    GUICtrlCreateGroup (" Account ", 340, 103, 300, 221)
    _GUICtrlCreateLabel ("Gebruiker login", 355, 125, 100, 20, 0)
    $TU_Username        =   GUICtrlCreateInput ("", 470, 123, 156, 20, BitOR ($ES_AUTOHSCROLL, $ES_READONLY))
    _GUICtrlCreateLabel ("E-mail login", 355, 146, 100, 20, 0)
    $TU_Email_Logon     =   GUICtrlCreateInput ("", 470, 144, 156, 20, BitOR ($ES_AUTOHSCROLL, $ES_READONLY))
    _GUICtrlCreateLabel ("Account verloopt", 355, 167, 116, 20, 0)
    $TU_A_Expires       =   GUICtrlCreateInput ("", 470, 165, 156, 20, BitOR ($ES_AUTOHSCROLL, $ES_READONLY))
    _GUICtrlCreateLabel ("Paswoord ingesteld", 355, 188, 116, 20, 0)
    $TU_P_Set           =   GUICtrlCreateInput ("", 470, 186, 156, 20, BitOR ($ES_AUTOHSCROLL, $ES_READONLY))
    _GUICtrlCreateLabel ("Paswoord verloopt", 355, 209, 116, 20, 0)
    $TU_P_Expires       =   GUICtrlCreateInput ("", 470, 207, 156, 20, BitOR ($ES_AUTOHSCROLL, $ES_READONLY))
    _GUICtrlCreateLabel ("RRNR", 355, 230, 100, 20, 0)
    $TU_Custom10        =   GUICtrlCreateInput ("", 470, 228, 156, 20, BitOR ($ES_AUTOHSCROLL, $ES_READONLY))
    _GUICtrlCreateLabel ("MFK-code", 355, 251, 100, 20, 0)
    $TU_Custom2         =   GUICtrlCreateInput ("", 470, 249, 156, 20, BitOR ($ES_AUTOHSCROLL, $ES_READONLY))
    _GUICtrlCreateLabel ("Homedrive (H:)", 355, 272, 100, 20, 0)
    $TU_HomeDrive       =   GUICtrlCreateInput ("", 470, 270, 156, 20, BitOR ($ES_AUTOHSCROLL, $ES_READONLY))
    _GUICtrlCreateLabel ("Logonscript", 355, 293, 100, 20, 0)
    $TU_Logonscript     =   GUICtrlCreateInput ("", 470, 291, 135, 20, BitOR ($ES_AUTOHSCROLL, $ES_READONLY))
    GUICtrlCreateButton ("L", 606, 290, 22, 22, $BS_ICON)
    GUICtrlSetImage (-1, "shell32.dll", 22, 0)
    GUICtrlSetTip (-1, "Toon het logonscript van de gebruiker")
    GUICtrlSetOnEvent (-1, "_AD_Show_Logonscript")

    ; Status
    GUICtrlCreateGroup (" Status ", 660, 103, 220, 140)
    _GUICtrlCreateLabel (" ", 670, 120, 200, 120)
    $TU_A_Disabled      =   GUICtrlCreateCheckbox (" Account is uitgeschakeld", 675, 120, 190, 20)
    $TU_A_Locked        =   GUICtrlCreateCheckbox (" Account is geblokkeerd", 675, 139, 190, 20)
    $TU_A_Expired       =   GUICtrlCreateCheckbox (" Account is verlopen", 675, 158, 190, 20)
    $TU_P_Expired       =   GUICtrlCreateCheckbox (" Paswoord is verlopen", 675, 177, 190, 20)
    $TU_P_Change        =   GUICtrlCreateCheckbox (" Paswoord wijzigen bij inloggen", 675, 196, 190, 20)
    $TU_P_Locked        =   GUICtrlCreateCheckbox (" Paswoord kan niet wijzigen", 675, 215, 190, 20)

    ; MemberOfGroups
    GUICtrlCreateGroup (" Rechtengroepen ", 20, 310, 300, 350)
    $TU_MemberOf        =   GUICtrlCreateList ("", 35, 330, 270, 320, BitOR ($LBS_SORT,$LBS_STANDARD,$WS_VSCROLL))

    ; Login info
    GUICtrlCreateGroup (" Login informatie ", 340, 331, 300, 109)
    _GUICtrlCreateLabel ("Laatst ingelogd", 355, 353, 116, 20, 0)
    $TU_LastLogon       =   GUICtrlCreateInput ("", 470, 351, 156, 20, BitOR ($ES_AUTOHSCROLL, $ES_READONLY))
    $TU_LockoutState    =   GUICtrlCreateButton ("Account geblokkeerd status", 355, 389, 270, 24)
    GUICtrlSetOnEvent (-1, "_Run_LockoutState")
    GUICtrlSetState (-1, $GUI_DISABLE)

    ; Exchange e-mailaddresses
    GUICtrlCreateGroup (" Exchange e-mailadressen ", 340, 450, 540, 210)
    $TU_ExchangeAddr    =   GUICtrlCreateList ("", 355, 470, 510, 180, BitOR ($LBS_SORT,$LBS_STANDARD,$WS_VSCROLL))

    ; Actions
    GUICtrlCreateGroup (" Acties ", 660, 250, 220, 190)
    $TU_EnDisableButton =   GUICtrlCreateButton ("Account uitschakelen", 675, 272, 190, 24)
    GUICtrlSetOnEvent (-1, "_AD_EnDisableAccount")
    GUICtrlSetState (-1, $GUI_DISABLE)
    $TU_UnlockButton    =   GUICtrlCreateButton ("Account deblokkeren", 675, 304, 190, 24)
    GUICtrlSetOnEvent (-1, "_AD_UnlockAccount")
    GUICtrlSetState (-1, $GUI_DISABLE)
    $TU_ResetPwd1Button =   GUICtrlCreateButton ("Paswoord reset Stad", 675, 336, 190, 24)
    GUICtrlSetOnEvent (-1, "_AD_ResetPassword")
    GUICtrlSetState (-1, $GUI_DISABLE)
    $TU_ResetPwd2Button =   GUICtrlCreateButton ("Paswoord reset OCMW", 675, 368, 190, 24)
    GUICtrlSetOnEvent (-1, "_AD_ResetPassword")
    GUICtrlSetState (-1, $GUI_DISABLE)
    $TU_ResetAtNextLogon=   GUICtrlCreateButton ("Paswoord wijzigen bij inloggen", 675, 400, 190, 24)
    GUICtrlSetOnEvent (-1, "_AD_ResetAtNextLogon")
    GUICtrlSetState (-1, $GUI_DISABLE)

    ;=================== ACCOUNT COMPARE ==================

    $TabComp            =   GUICtrlCreateTabItem (" Accounts vergelijken ")

    ; Search
    GUICtrlCreateGroup (" Zoeken ", 20, 40, 860, 47)
    _GUICtrlCreateLabel ("Naam 1", 40, 58, 50, 20, 0)
    $Search1Input       =   GUICtrlCreateInput ("", 100, 56, 200, 20)
    _GUICtrlCreateLabel ("Naam 2", 320, 58, 50, 20, 0)
    $Search2Input       =   GUICtrlCreateInput ("", 380, 56, 200, 20)
    $CompareButton      =   GUICtrlCreateButton ("Zoeken", 630, 54, 90, 24)
    GUICtrlSetOnEvent (-1, "_AD_Compare_Accounts")
    $CompareButtonReset =   GUICtrlCreateButton ("Alles wissen", 740, 54, 120, 24)
    GUICtrlSetOnEvent (-1, "_AD_Reset_Compare")

    GUICtrlCreateGroup (" Rechten alleen bij gebruiker 1 ", 20, 103, 273, 557)
    $CU_User1           =   GUICtrlCreateList ("", 35, 123, 243, 527, BitOR ($LBS_SORT,$LBS_STANDARD,$WS_VSCROLL))
    GUICtrlCreateGroup (" Gezamelijke rechten ", 313, 103, 273, 557)
    $CU_Both            =   GUICtrlCreateList ("", 328, 123, 243, 527, BitOR ($LBS_SORT,$LBS_STANDARD,$WS_VSCROLL))
    GUICtrlCreateGroup (" Rechten alleen bij gebruiker 2 ", 606, 103, 273, 557)
    $CU_User2           =   GUICtrlCreateList ("", 621, 123, 243, 527, BitOR ($LBS_SORT,$LBS_STANDARD,$WS_VSCROLL))

    ;===================== SYSTEM INFO ====================

    $TabSys             =   GUICtrlCreateTabItem (" Toestel informatie ")

    ;====================== TABS END ======================

    $TabEnd             =   GUICtrlCreateTabItem ("")

    GUISetState (@SW_SHOW, $DigiAD)

    ControlFocus ($DigiAD, "", "Edit1")

    While 1
        Sleep (100)
    WEnd
EndFunc
;========================================================================;
; End App
;========================================================================;
_init ()

If you need the function that fills the fields, let me know :)

Link to comment
Share on other sites

  • Moderators
  • Solution

colombeen,

Without sight of your code I cannot comment - but here is the code working for 20 inputs without problem: ;)

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

Global $aInput[20]

$hGUI = GUICreate("Test", 500, 500)

For $i = 0 to 19
    $aInput[$i] = GUICtrlCreateInput("my test text for the input field", 10, 10 + (20 * $i), 100, 20, BitOr($ES_AUTOHSCROLL, $ES_READONLY))
Next

GUISetState()

For $i = 1 To 19
    ControlSend($hGUI, "", $aInput[$i], "{HOME}")
Next

While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
    EndSwitch
WEnd
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

strange... this doesn't work in my case. I'll check again for possible typos :-)

Just checked it. in my code I would have to do something like this :

  GUICtrlSetData ($TU_Email_Logon, $AD_query[1][16])
  ControlSend($DigiAD, "", $TU_Email_Logon, "{HOME}")

But that fails

EDIT: changed the fields from input to edit

all is good with the world again :)

Edited by colombeen
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...