kingjacob90 Posted November 30, 2015 Share Posted November 30, 2015 (edited) Hi.I am wanting to have a script that when you push a button it will put data from an input box into a list (like data log) but the list must also have the previous data as well. I have code that dose this but I have the problem of it not been able to scroll as I am using an input box to store my data.Any ideas?Thanks. Global $top = 0 GUICreate("...",200,300) $top=$top+10 GUICtrlCreateLabel("-- input hear --",2,$top,150,20) $top=$top+20 $Input = GUICtrlCreateInput("",2,$top,100,20) $Button = GUICtrlCreateButton("Submit",105,$top-1.5,90,23) $top=$top+25 $View = GUICtrlCreateInput("-- data under hear --",2,$top,196,100,0x0004,0x0800) GUISetState() While 1 $GUI_MSG = GUIGetMsg() Select Case $GUI_MSG = -3 Exit Case $GUI_MSG = $Button GUICtrlSetData($View,GUICtrlRead($View)&@CRLF&"data: "&GUICtrlRead($Input)) GUICtrlSetData($Input,"") EndSelect WEnd Edited November 30, 2015 by kingjacob90 Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted November 30, 2015 Moderators Share Posted November 30, 2015 kingjacob90,Inputs are forced to a single line - use an edit control instead:expandcollapse popup; Use named constants - not "magic numbers" #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <GuiEdit.au3> #include <ScrollBarsConstants.au3> Global $top = 0 GUICreate("...", 200, 300) $top = $top + 10 GUICtrlCreateLabel("-- input here --", 2, $top, 150, 20) $top = $top + 20 $Input = GUICtrlCreateInput("", 2, $top, 100, 20) $Button = GUICtrlCreateButton("Submit", 105, $top - 1.5, 90, 23) $top = $top + 25 ; Use a read-only edit control $View = GUICtrlCreateEdit("-- data under hear --", 2, $top, 196, 100, BitOr($ES_READONLY, $WS_VSCROLL, $ES_AUTOVSCROLL), $WS_EX_STATICEDGE) GUISetState() While 1 ; I prefer Switch to Select Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $Button GUICtrlSetData($View, GUICtrlRead($View) & @CRLF & "data: " & GUICtrlRead($Input)) ; Scroll to the bottom _GUICtrlEdit_Scroll($View, $SB_SCROLLCARET) GUICtrlSetData($Input, "") ; Refocus on the input GUICtrlSetState($Input, $GUI_FOCUS) EndSwitch WEndYou will note one or two other comments as well - please ask if you have any questions.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...
kingjacob90 Posted November 30, 2015 Author Share Posted November 30, 2015 kingjacob90,Inputs are forced to a single line - use an edit control instead:expandcollapse popup; Use named constants - not "magic numbers" #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <GuiEdit.au3> #include <ScrollBarsConstants.au3> Global $top = 0 GUICreate("...", 200, 300) $top = $top + 10 GUICtrlCreateLabel("-- input here --", 2, $top, 150, 20) $top = $top + 20 $Input = GUICtrlCreateInput("", 2, $top, 100, 20) $Button = GUICtrlCreateButton("Submit", 105, $top - 1.5, 90, 23) $top = $top + 25 ; Use a read-only edit control $View = GUICtrlCreateEdit("-- data under hear --", 2, $top, 196, 100, BitOr($ES_READONLY, $WS_VSCROLL, $ES_AUTOVSCROLL), $WS_EX_STATICEDGE) GUISetState() While 1 ; I prefer Switch to Select Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $Button GUICtrlSetData($View, GUICtrlRead($View) & @CRLF & "data: " & GUICtrlRead($Input)) ; Scroll to the bottom _GUICtrlEdit_Scroll($View, $SB_SCROLLCARET) GUICtrlSetData($Input, "") ; Refocus on the input GUICtrlSetState($Input, $GUI_FOCUS) EndSwitch WEndYou will note one or two other comments as well - please ask if you have any questions.M23Thanks Melba23 Just what I wanted! Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted November 30, 2015 Moderators Share Posted November 30, 2015 kingjacob90,Glad I could help. But when you reply, please use the "Reply to this topic" button at the top of the thread or the "Reply to this topic" editor at the bottom rather than the "Quote" button - I know what I wrote and it just pads the thread unnecessarily.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...
kingjacob90 Posted December 1, 2015 Author Share Posted December 1, 2015 I see thanks I have not used the forums much. Very helpful! Thanks again. 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