Rad Posted March 28, 2011 Share Posted March 28, 2011 I have a text input control which shows a directory, like: [C:\My Folder\File.exe ] If the directory is long, it cuts off from the right: [C:\My Folder\Fi] I would rather it cuts off from the left, because you rarely need to know what folder/drive you are accessing, but rather what the file is. This is what I would prefer: [y Folder\File.exe] Normally if you were typing this into the input, because you type left-to-right, you would end up with this as a result. But if the script adds the text when you are done with the file browse dialog it won't do it that way. If there is a way to set the caret position of a control without giving the control focus, I could use that also. (But again, I couldn't find a way to do this in the help file) Is there a way to make text "flow" from the right instead of the left? I don't know the proper term... But align-right does not solve the issue. It aligns right until the text is cut off, and then it shows the string from the left first. I could probably write a way to remove excess characters if they scroll off the edge, but not without complicating the ability to manually edit the text input. /shrug If there is a built in option that I can't find, that is what I am looking for. Thanks. Link to comment Share on other sites More sharing options...
saywell Posted March 28, 2011 Share Posted March 28, 2011 Could you make the box longer, or the font smaller? William [non-techie solution!] Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted March 28, 2011 Moderators Share Posted March 28, 2011 Rad,[Techie solution!]Use the ELLIPSIS styles: #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> $spath = "C:\I am a very long path\Which needs to be\Shortened to fit\In the label.txt" $hGUI = GUICreate("Test", 500, 500) GUICtrlCreateLabel($sPath, 10, 10, 300, 30, $DT_PATH_ELLIPSIS) GUICtrlCreateLabel($sPath, 10, 50, 300, 30, $DT_END_ELLIPSIS) GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit EndSwitch WEndNote that I am pretty sure the 2 values have been reversed in the Constants file as I would have labelled them the other way round. But MS work in strange ways and perhaps they really are that way. M23 pixelsearch 1 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 columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
BrewManNH Posted March 28, 2011 Share Posted March 28, 2011 Try adding this to the program somewhere, this code assumes your second input control is called $input2 for the sake of this example. This will set the focus to the control, and then send the END key sequence to it so that it's at the end of the line. GUICtrlSetState($input2, $GUI_FOCUS) Send("{End}") Skysnake 1 If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator Link to comment Share on other sites More sharing options...
Rad Posted March 29, 2011 Author Share Posted March 29, 2011 The ellipsis thing is really nice. I've tried recreating that before, I didn't know it was a style option! But it doesn't seem to work inside an input and if it did it would limit the ability to manually edit the input (I assume I could remove the style when the user grants it focus, but... that would be weird). I'll just use Brewman's option. It looks like it would work, surprised I didn't think of it. Even when I mentioned moving the caret position, lol. Thanks! Link to comment Share on other sites More sharing options...
ProgAndy Posted March 29, 2011 Share Posted March 29, 2011 This should be a better way for inputs: _GUICtrlEdit_SetSel($hInput, -1, -1) _GUICtrlEdit_Scroll($hInput, $SB_SCROLLCARET) Skysnake 1 *GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes Link to comment Share on other sites More sharing options...
UEZ Posted March 29, 2011 Share Posted March 29, 2011 What about this? #include <EditConstants.au3> #include <GUIConstantsEx.au3> $Form1 = GUICreate("TEST", 215, 88) $Label1 = GUICtrlCreateLabel("Path:", 28, 32, 36, 17) $Input1 = GUICtrlCreateInput("", 64, 30, 121, 21, $GUI_SS_DEFAULT_INPUT) GUISetState(@SW_SHOW) GUICtrlSetData($Input1, "c:\ProgramData\Microsoft\Search\Data\Applications\Windows\Projects\SystemIndex\SecStore\") While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd 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!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now