dreamzboy Posted October 29, 2013 Share Posted October 29, 2013 I hate to open another thread but I could not find the answer through searching and documentation. I wanted to create a real-time log file in my script using GUICtrlSetData; however, when that function is used, it overwrites the old data. I've created an Array to handle such case but couldn't get the logic to work the way I'd imagined. Is there another function that I can use to append? The final result that I want is 1. Saving default password into XML Script. 2. Saving default password into XML Script. 3. Saving default password into XML Script. 4. Saving default password into XML Script. My retarded script #include <GUIConstantsEx.au3> #include <StaticConstants.au3> Local $i = 0 Local $log_label[4] GUICreate ("RIBCL XML Script Generator", 600, 400) GUISetState () For $i = 0 To 3 Step 1 $log_label[$i] = GUICtrlCreateLabel ("", 300, 40, 270, 280, $ss_sunken) GUICtrlSetFont (-1, 10, 800) GUICtrlSetData ($log_label[$i], $i & ". Saving default password into XML Script." & @CRLF) Sleep (1000) Next Thank you! LiquidNitrogen 1 Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted October 29, 2013 Moderators Share Posted October 29, 2013 dreamzboy,I would use a List control - like this:#include <GUIConstantsEx.au3> #include <MsgBoxConstants.au3> $hGUI = GUICreate("Test", 500, 500) $cList = GUICtrlCreateList("", 10, 10, 200, 200, BitOr($WS_BORDER, $WS_VSCROLL)) GUISetState() For $i = 1 To 10 GUICtrlSetData($cList, $i & ": SEC = " & @SEC) Sleep(1000) Next While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit EndSwitch WEndPlease 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...
dreamzboy Posted October 29, 2013 Author Share Posted October 29, 2013 Thanks Melba for the quick response. I'm getting a few errors regarding declaring some variables which I added; however, it complains about $WS_BORDER and $SW_VSCROLL. It also complains about "MsgBoxConstants.au3" not being there either. I'm running SciTE Version 3.3.0. Here's a modified version of your script. #include <GUIConstantsEx.au3> #include <ListBoxConstants.au3> #include <MsgBoxConstants.au3> local $hGUI, $cList, $i $hGUI = GUICreate("Test", 500, 500) $cList = GUICtrlCreateList("", 10, 10, 200, 200, BitOr($WS_BORDER, $WS_VSCROLL)) GUISetState() For $i = 1 To 10 GUICtrlSetData($cList, $i & ": SEC = " & @SEC) Sleep(1000) Next While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted October 29, 2013 Moderators Share Posted October 29, 2013 dreamzboy,It is the Autoit version that is of interest - I assume you are still on 3.3.8.1 and the includes are for 3.3.9.21 Beta. Sorry about that - I forget that not everyone is that keen on keeping up with the new versions. Try this script - it works fine for me on 3.3.8.1:#include <GUIConstantsEx.au3> #include <ListBoxConstants.au3> #include <WindowsConstants.au3> #include <Constants.au3> Global $hGUI, $cList ; These are Global regardless of what you tell AutoIt so you might as well use the right Keyword $hGUI = GUICreate("Test", 500, 500) $cList = GUICtrlCreateList("", 10, 10, 200, 200, BitOr($WS_BORDER, $WS_VSCROLL)) ; You need to define the styles as the default will sort the entries alphabetically GUISetState() For $i = 1 To 10 ; No need to declare loop variables GUICtrlSetData($cList, $i & ": SEC = " & @SEC) Sleep(1000) Next While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit EndSwitch WEndI also added a couple of comments re your changes - please ask if you do not understand them. 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...
dreamzboy Posted October 29, 2013 Author Share Posted October 29, 2013 Thank you for the extra clarification. It really helps. Last question - Is there a way to enable horizontal scrolling? Some of my texts are being cut-off even when I use $WS_HSCROLL. The vertical scroll bar automatically applies as the list goes off the designated field but not the horizontal scroll bar. $log_label = GUICtrlCreateList ("", 300, 40, 270, 280, BitOR($WS_BORDER, $WS_HSCROLL, $WS_VSCROLL)) Much appreciated. Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted October 29, 2013 Moderators Share Posted October 29, 2013 dreamzboy,Interesting - I cannot get it to work either and yet I am sure I have seen it done. So I suggest we move to an edit control - that certainly does work: #include <GUIConstantsEx.au3> #include <GUIEdit.au3> Global $hGUI, $cEdit $hGUI = GUICreate("Test", 500, 500) $cEdit = GUICtrlCreateEdit("", 10, 10, 200, 200) GUISetState() For $i = 1 To 20 _GUICtrlEdit_AppendText($cEdit, $i & ": just to make it a very long line SEC = " & @SEC & @CRLF) Sleep(1000) Next While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit EndSwitch WEndI will keep looking at the List control when I have a moment and see if I can get it to scroll horizontally. And I should mention that there is a default 64k limit on the text you can fit into an Edit control - use GUICtrlSetLimit to increase it if needed. 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...
dreamzboy Posted October 29, 2013 Author Share Posted October 29, 2013 I'm glad I did something right. I thought it was a newbie mistake. I'd be interesting to know if you can get around that horizontal scroll for the list. I prefer the list over the edit box because it's less flicky. What I meant is my mouse pointer tends to flicker when I move it to the edit box. Now I kind of understand what the GuiCtrlSetLimit does. I messed with it in the example script but didn't quite understand its functionality. Link to comment Share on other sites More sharing options...
dreamzboy Posted October 29, 2013 Author Share Posted October 29, 2013 (edited) I looked in the helpfile and it has an example of Horizontal Scroll (_GUICtrlListBox+AddString.au3). That example script worked but the "$WS_HSCROLL" doesn't when it's being used with GuiCtrlSetData. I think we have to call "_GUICtrlListBox_UpdateHScroll" for it to work. :Edit: Just tested it with your script and it works. Be sure to add #include <GuiListBox.au3> _GUICtrlListBox_UpdateHScroll ($log_label) Thanks again for all your help Melba. Edited October 29, 2013 by dreamzboy Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted October 30, 2013 Moderators Share Posted October 30, 2013 dreamzboy,Good spot - thanks for doing all the work. 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...
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