qwert Posted May 4, 2008 Posted May 4, 2008 (edited) I've been trying to figure a way to display long text in a short field, but have the first part of the text show -- not the last. So I prepared this test script -- but the buttons aren't clickable for a reason that I can't figure out. It's structured just like any of a dozen other scripts I use. Both buttons work when I tab to them and press Enter. #include <GUIConstants.au3> $GUI = GUICreate("Text Position Test", 300, 200, -1, -1) $Label = GUICtrlCreateLabel("Long strings of displayed text need to start at the beginning ... but so do short strings.", 20, 80, 200, 60) $Entry = GUICtrlCreateInput("", 20, 40, 200, 20) $Key1 = GUICtrlCreateButton("Long", 50, 120, 60, 20) $Key2 = GUICtrlCreateButton("Short", 120, 120, 60, 20) GUISetState() While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Key1 GUICtrlSetData($Entry, "This is an example of long text that exceeds the viewable area") Case $Key2 GUICtrlSetData($Entry, "This is short text") EndSwitch WEnd I will appreciate a nudge on getting the buttons activated -- and then, mainly, any suggestions on how to achieve a left-justified input display. Thanks in advance. Edited May 5, 2008 by qwert
Triblade Posted May 5, 2008 Posted May 5, 2008 Lol, it baffeled me for 1 minute. But ur label overshadows ur buttons so u can't push them. U push ur label instead Try making ur label less high. And for the left part, try this: $Entry = GUICtrlCreateInput("", 20, 40, 200, 20, $ES_LEFT) My active project(s): A-maze-ing generator (generates a maze) My archived project(s): Pong3 (Multi-pinger)
ProgAndy Posted May 5, 2008 Posted May 5, 2008 no, doesn't work, try this: #include <GUIEDIT.au3> .... GUICtrlSetData($Entry, "This is an example of long text that exceeds the viewable area") _GUICtrlEdit_SetSel($Entry,0,0) *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
qwert Posted May 5, 2008 Author Posted May 5, 2008 My thanks to you both. Regarding the inactive buttons, I had looked at the code for hours and didn't see the obvious. And for the positioning within the text field, I hadn't noticed the entire set of GUICtrlEdit functions before now. I'd simply not had a need to work with text within a field. They'll be very useful.So, for anyone who might view this post, here's the working end result:#include <GUIConstants.au3> #include <GUIEDIT.au3> $GUI = GUICreate("Text Position Test", 300, 200, -1, -1) $Label = GUICtrlCreateLabel("Long strings of displayed text need to start at the beginning ... but so do short strings.", 20, 80, 200, 60) $Entry = GUICtrlCreateInput("", 20, 40, 200, 20) $Key1 = GUICtrlCreateButton("Long", 50, 150, 60, 20) $Key2 = GUICtrlCreateButton("Short", 120, 150, 60, 20) GUISetState() While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Key1 GUICtrlSetData($Entry, "This is an example of long text that exceeds the viewable area") _GUICtrlEdit_SetSel($Entry,0,0) Case $Key2 GUICtrlSetData($Entry, "This is short text") _GUICtrlEdit_SetSel($Entry,0,0) EndSwitch WEnd
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