mohammadezazi Posted July 24, 2013 Posted July 24, 2013 (edited) Hello I used GUICtrlCreateEdit function to show my "sometext.txt" file contents in a GUI. But it does not give me a good interface and i have some problems with it. One of problems in GUICtrlCreateEdit function is that when the text appears in editbox, whole text has been selected at first time !! and i must click once to get out it from selected state. Other my problem is: i can not set just a vertical scrolbar. I want to use just vertical scrolbar not horizontal. I want to it fits to editbox's width horizontally but scrol vertically. $myfile = FileOpen("Last10PMs.txt") $PM10Text = FileRead($myfile) $hgui = GUICreate("Title",800,600,-1,-1,-1) GUICtrlCreateEdit($PM10Text, -1, -1, 800, 600) When i use GUICtrlCreateLabel function to show text file, the state comes so bad from Editbox. Thanks for any suggestion to view a text file in a better UI or resolving my problems. Edited July 24, 2013 by mohammadezazi
Danyfirex Posted July 24, 2013 Posted July 24, 2013 Hi, you can do something like this: #include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Form1", 623, 442, 192, 124) $Edit1 = GUICtrlCreateEdit("", 56, 16, 489, 305,$ES_AUTOVSCROLL + $WS_VSCROLL) GUICtrlSetData(-1, "hi word") $Button1 = GUICtrlCreateButton("Button1", 240, 384, 81, 33) GUICtrlSetState($Edit1,$GUI_FOCUS) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit case $Button1 EndSwitch WEnd saludos Danysys.com AutoIt... UDFs: VirusTotal API 2.0 UDF - libZPlay UDF - Apps: Guitar Tab Tester - VirusTotal Hash Checker Examples: Text-to-Speech ISpVoice Interface - Get installed applications - Enable/Disable Network connection PrintHookProc - WINTRUST - Mute Microphone Level - Get Connected NetWorks - Create NetWork Connection ShortCut
Moderators Melba23 Posted July 24, 2013 Moderators Posted July 24, 2013 (edited) mohammadezazi,I do not know about the "best" way, but I would do it like this:#include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <Constants.au3> #include <GuiEdit.au3> #include <String.au3> $sText = "" For $i = 1 To 20 $sRandom = _StringRepeat("-", Random(10, 100, 1)) $sText &= "Line " & $i & " " & $sRandom & @CRLF Next $hGUI = GUICreate("Test", 500, 500) $cEdit = GUICtrlCreateEdit("", 10, 10, 200, 100, BitOr($ES_WANTRETURN, $WS_VSCROLL, $ES_AUTOVSCROLL), $WS_EX_CLIENTEDGE) GUICtrlSetData($cEdit, $sText) GUISetState() _GUICtrlEdit_SetSel($cEdit, -1, -1) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit EndSwitch WEndAll clear? M23 Edited July 24, 2013 by Melba23 Amended styles 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
AZJIO Posted July 24, 2013 Posted July 24, 2013 '?do=embed' frameborder='0' data-embedContent>> My other projects or all
AZJIO Posted July 24, 2013 Posted July 24, 2013 Melba23 $WS_EX_CLIENTEDGE Style should be in the position of the extended styles. I suggested it be noted in the help file My other projects or all
Moderators Melba23 Posted July 24, 2013 Moderators Posted July 24, 2013 AZJIO,Thanks for that - I had just copied the line from the "style" section of the GUICtrlCreateEdit page in the Help file. Will you tell guinness? M23 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
mohammadezazi Posted July 24, 2013 Author Posted July 24, 2013 Thank you all. My problem resolved by your nice guides and codes. Best regards.
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