monte Posted January 28, 2009 Share Posted January 28, 2009 (edited) hello, I've searched around for a while a have not found an answer to my problem (and I'm too stupid at the moment to find it myself). So, I need to continuously scroll a label and maybe wait about 3 seconds between scrolls. Also, the text that I want to scroll ($currentConditions) is overwriting my label ($condLabel) specifying that there is text to scroll. Any ideas? Thanks. #include <GUIConstantsEx.au3> $currentConditions = "Snow this morning will become heavy at times this afternoon. Some sleet may mix in. High 31F. Winds E at 10 to 20 mph. 6 to 10 inches of snow expected." global $conditionSize = 600 global $conditionText = 600 $gui = GUICreate("", 333, 709, 686, 1) $condLabel = GUICtrlCreateLabel("Conditions: ", 2, 25, 60, 15) $conditions = GUICtrlCreateLabel($currentConditions, 70, 25, 500, 15) GUISetState(@SW_SHOW) AdlibEnable('_MoveMarquee', 15) While 1 ;scroll conditions label AdlibEnable('_MoveMarquee', 15) $guiMsg = GUIGetMsg() Switch $guiMsg Case $GUI_EVENT_CLOSE Exit EndSwitch sleep(1000) WEnd Func _MoveMarquee() Local $aCpos = ControlGetPos($gui, '', $conditions) If $aCpos[0] >= $conditionSize Then $aCpos[0] = -$conditionText ControlMove($gui, '', $conditions, $aCpos[0] -1, $aCpos[1]) EndFunc Edited January 28, 2009 by monte Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted January 28, 2009 Moderators Share Posted January 28, 2009 monte, This is the basis of the code I use for permanently scrolling labels. It should not be too hard to amend it to work as you wish:expandcollapse popup#include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <StaticConstants.au3> ; create parent GUI $ParentGUI = GUICreate("Parent", 450, 250, -1, -1, $WS_BORDER) $Close = GUICtrlCreateButton("Close", 350, 35, 60, 40) GUISetState(@SW_SHOW, $ParentGUI) ; Set size parameters $scroller_win_width = 175 ; just wide enought to hold label $scroller_win_depth = 85 ; Anything you like, but close to label depth looks good $scroller_label_depth = 80 ; This is the depth needed to display the label without big margins ; Create child GUI $ChildGUI = GUICreate("Scroller", $scroller_win_width, $scroller_win_depth, -1, -1, $WS_POPUP, $WS_EX_MDICHILD, $ParentGUI) GUISetBkColor(0xffff00); just for testing ; Create label to scroll $ScrollingLabel = GUICtrlCreateLabel("This is a test of a" & @CR & _ "scroller label." & @CR & "Inspired by:" & @CR & "something I found on the" & @CR & _ "AutoIt forums and significantly" & @CR & "modified!", _ 1, $scroller_win_depth, $scroller_win_width - 2, $scroller_label_depth, $SS_RIGHT) ; Place in position below window $winpos = WinGetPos($ParentGUI, "") WinMove($ChildGUI, "", $winpos[0]+260, $winpos[1]+125) ; Set transparancy to permit draggging withour artefacts WinSetTrans($ChildGUI, "", 250) GUISetState(@SW_SHOW, $ChildGUI) While 1 For $i = $scroller_win_depth To -$scroller_label_depth Step -1 ; Nedd to look for this within loop $msg = GUIGetMsg() If $msg = $Close Then GUIDelete($ParentGUI) Exit EndIf ControlMove($ChildGUI, "", $ScrollingLabel, 1, $i) Sleep(50) ; Needed despite GUIGetMsg to slow the scroll! Next WEnd Try playing with it and ask if you have any difficulties. I will come back about the overwriting problem when I have looked more closely. 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...
Moderators Melba23 Posted January 28, 2009 Moderators Share Posted January 28, 2009 monte,The marquee label is being moved over the static label as it moves. If you use the separate child window idea that I posted earlier, you should be able to keep your label separate.I assume you want to do other things while you scroll, so your Adlib function will have to replace my For...Next loop - not too difficult a task. ;-)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...
monte Posted January 28, 2009 Author Share Posted January 28, 2009 thanks melba23 I'll give it a whirl. Link to comment Share on other sites More sharing options...
monte Posted January 30, 2009 Author Share Posted January 30, 2009 found my answer else where, thanks. #include <GUIConstantsEx.au3> $currentConditions = "Snow this morning will become heavy at times this afternoon. Some sleet may mix in. High 31F. Winds E at 10 to 20 mph. 6 to 10 inches of snow expected." $gui = GUICreate("", 333, 750, 686, 1) $conditions = GUICtrlCreateLabel($currentConditions, 70, 25, 750, 15) GUISetState(@SW_SHOW) While 1 ;scroll conditions label scrollconditions() $guiMsg = GUIGetMsg() Switch $guiMsg Case $GUI_EVENT_CLOSE Exit EndSwitch sleep(1000) WEnd func scrollConditions() While 1 For $x = 100 to -600 step -2 ControlMove ($gui,"",$conditions, $x, 25) Sleep(30) Next exitloop WEnd endfunc 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