Rogue5099 Posted February 13, 2014 Share Posted February 13, 2014 I am loading several lines of data into an edit box before I even show a GUI and would like to know if I could have it show the top of the vertical scroll instead of displaying the last bottom. I have made a quick test GUI to create data and then input it into the edit box. #include <GuiConstantsEx.au3> #include <EditConstants.au3> #include <WindowsConstants.au3> $HardwareGUI = GUICreate("Test", 300, 305, -1, -1, BitOR($WS_BORDER, $WS_SYSMENU), BitOR($WS_EX_TOPMOST, $WS_EX_TOOLWINDOW)) Local $AboutEditbox = GUICtrlCreateEdit("", 0, 0, 295, 255, BitOR($ES_WANTRETURN, $WS_VSCROLL, $ES_READONLY));, $ES_AUTOVSCROLL Local $ButtonLink = GUICtrlCreateButton("Google", 0, 255, 300, 25) Local $Text = "" $Link = "www.google.com" GUISetState(@SW_SHOW, $HardwareGUI) GUICtrlSetState($AboutEditbox, @SW_DISABLE) For $i = 1 To 60 $Text &= "Line " & $i & @CRLF Next GUICtrlSetData($AboutEditbox, $Text, 1) While 1 $aMsg = GUIGetMsg(1) Switch $aMsg[1] Case $HardwareGUI Switch $aMsg[0] Case $GUI_EVENT_CLOSE ExitLoop Case $ButtonLink ShellExecute($Link) EndSwitch EndSwitch WEnd I would like to show Line 1 when the GUI is shown instead of having to scroll up every time. My projects: Inventory / Mp3 Inventory, Computer Stats Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted February 13, 2014 Moderators Share Posted February 13, 2014 Rogue5099,Set the caret position and then scroll to it: #include <GuiConstantsEx.au3> #include <EditConstants.au3> #include <WindowsConstants.au3> #include <GuiEdit.au3> #include <ScrollBarsConstants.au3> $HardwareGUI = GUICreate("Test", 300, 305, -1, -1, BitOR($WS_BORDER, $WS_SYSMENU), BitOR($WS_EX_TOPMOST, $WS_EX_TOOLWINDOW)) Local $AboutEditbox = GUICtrlCreateEdit("", 0, 0, 295, 255, BitOR($ES_WANTRETURN, $WS_VSCROLL, $ES_READONLY));, $ES_AUTOVSCROLL Local $ButtonLink = GUICtrlCreateButton("Google", 0, 255, 300, 25) Local $Text = "" $Link = "www.google.com" GUISetState(@SW_SHOW, $HardwareGUI) GUICtrlSetState($AboutEditbox, @SW_DISABLE) For $i = 1 To 60 $Text &= "Line " & $i & @CRLF Next GUICtrlSetData($AboutEditbox, $Text, 1) _GUICtrlEdit_SetSel($AboutEditbox, 0, 0) ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< _GUICtrlEdit_Scroll($AboutEditbox, $SB_SCROLLCARET) ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< While 1 $aMsg = GUIGetMsg(1) Switch $aMsg[1] Case $HardwareGUI Switch $aMsg[0] Case $GUI_EVENT_CLOSE ExitLoop Case $ButtonLink ShellExecute($Link) EndSwitch EndSwitch WEndAll clear? 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 Link to comment Share on other sites More sharing options...
Rogue5099 Posted February 13, 2014 Author Share Posted February 13, 2014 Yes but I also found this and was about to post. #include <GuiConstantsEx.au3> #include <EditConstants.au3> #include <WindowsConstants.au3> #include <GuiEdit.au3> $HardwareGUI = GUICreate("Test", 300, 305, -1, -1, BitOR($WS_BORDER, $WS_SYSMENU), BitOR($WS_EX_TOPMOST, $WS_EX_TOOLWINDOW)) Local $AboutEditbox = GUICtrlCreateEdit("", 0, 0, 295, 255, BitOR($WS_VSCROLL, $ES_READONLY)) Local $ButtonLink = GUICtrlCreateButton("Google", 0, 255, 300, 25) Local $Text = "" $Link = "www.google.com" GUISetState(@SW_SHOW, $HardwareGUI) For $i = 1 To 60 $Text &= "Line " & $i & @CRLF Next _GUICtrlEdit_SetText($AboutEditbox, $Text) While 1 $aMsg = GUIGetMsg(1) Switch $aMsg[1] Case $HardwareGUI Switch $aMsg[0] Case $GUI_EVENT_CLOSE ExitLoop Case $ButtonLink ShellExecute($Link) EndSwitch EndSwitch WEnd Thank you for your help though!! My projects: Inventory / Mp3 Inventory, Computer Stats 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