Sign in to follow this  
Followers 0
mnchartier

Vertical Scrolling Text

8 posts in this topic

#1 ·  Posted (edited)

I am looking for a way to scroll text vertically on a GUI. I am trying to replace a display system that we currently have that runs the AdvScrolltext java applet that does not update properly. So I am trying to create a GUI that will display the data in a vertical scroll (loop). I have seen the marquis text but have not been able to figure this out. I am still fairly new with AutoIT and only use it to automate redundant tasks that I don't want to deal with daily.

I am not sure if I should be using Lists or listviews to accomplish this.

Edited by mnchartier

Share this post


Link to post
Share on other sites



Oh, how useful the search is:

#include <GUIConstants.au3>

Opt("GUIOnEventMode", 0)
$AboutGUI = GUICreate("About iDFree", 436, 251, -1, -1, $WS_BORDER)
WinSetOnTop("About iDFree", "", 1)
GUISetBkColor(0xFFFFFF)
GUICtrlCreatePic(@TempDir & "\about.gif", 0, 0, 436, 251)
GUICtrlSetState(-1, $GUI_DISABLE)

$close = GUICtrlCreateButton(" Ok! ", 380, 75, 35, 22)
$win = WinGetPos("About iDFree")
$child = GUICreate("About scroller", 175, 115, $win[0]+260, $win[1]+125, $WS_POPUP, $WS_EX_TRANSPARENT, $AboutGUI)
GUISetBkColor(0xFFFFFF)
$AboutLabel = GUICtrlCreateLabel("Coded by Ben Perkins" & @CR & "Magic Soft Inc." & @CR & "Inspired by:" & @CR & "Alex Bagby and Ichaelmay58" & _
                    @CR & "BG image thanks to Reel Big Fish" & @CR & @CR & "-The Magician", 1, -80, 170, 105, BitOr($SS_NOTIFY, $SS_RIGHT))
GUISetState(@SW_SHOW, $AboutGUI)
GUISetState(@SW_SHOW, $child)

While 1
    For $i = -105 to 130
        $msg = GUIGetMsg()
        ControlMove("About scroller", "", $AboutLabel, 1, 30-$i)
        If $msg = $close Then
            Opt("GUIOnEventMode", 1)
            GUIDelete($AboutGUI)
            Return
        EndIf
        sleep(50)
    Next
WEnd

Share this post


Link to post
Share on other sites

Change "Return" to "Exit" in that loop. Cheers.


IE Dev ToolbarMSDN: InternetExplorer ObjectMSDN: HTML/DHTML Reference Guide[quote]It is surprising what a man can do when he has to, and how little most men will do when they don't have to. - Walter Linn[/quote]--------------------[font="Franklin Gothic Medium"]Post a reproducer with less than 100 lines of code.[/font]

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

NeoTroniX - I have been searching and everything I have found was for horizontal scrolling. I really appreciate you posting that example. This was very helpful and I have everything running smooth now. Thanks.

Edited by mnchartier

Share this post


Link to post
Share on other sites

Okay I have everything working the way it should. No a question came up about can we have three areas on the screen,one for the Court Info, one for the calendar, and one for judicial info. So now I have two different areas that have labels that I need to move simultaneously, I was thinking that I would need to spawn off another script to control the second labels position while the main script is controlling the first label. Here is what I have now, the text for the info will be coming from a data source that I will implement afterwards.

#include <GUIConstants.au3>

HotKeySet("{Esc}","_exit") 

$Bckgrnd = GuiCreate("Kent County Courthouse", 1020, 760,-1, -1 , $WS_BORDER)
GUISetBkColor(0xFFFFFF)
$Group_1 = GuiCtrlCreateGroup("", 2, 2, 350, 525)
    $Pic_4 = GuiCtrlCreatePic("C:\test\seal.jpg", 20, 10, 300,195)
    GUICtrlCreateLabel("Welcome to the", 3,250,345,25,$SS_CENTER)
    GUICtrlSetFont(-1,6,700,1,"Courier") 
    GUICtrlSetColor(-1,0x000380) 
    GUICtrlCreateLabel("Kent County Courthouse", 3,280, 345,25,$SS_CENTER)
    GUICtrlSetFont(-1,3,700,1,"Courier") 
    GUICtrlSetColor(-1,0x000380) 
    GUICtrlCreateLabel("Calendar for Family Court", 3,310, 345,25,$SS_CENTER)
    GUICtrlSetFont(-1,3,700,1,"Courier") 
    GUICtrlSetColor(-1,0x000380) 
    GUICtrlCreateLabel("Courtroom 3-D", 3,340, 345,25,$SS_CENTER)
    GUICtrlSetFont(-1,3,700,1,"Courier") 
    GUICtrlSetColor(-1,0x000380) 
$Group_2 = GuiCtrlCreateGroup("", 351, 2, 665, 525)
    GUICtrlCreateLabel("Calendar", 352, 15, 660, 25,$SS_CENTER)
    GUICtrlSetFont(-1,3,700,1,"Courier") 
    GUICtrlSetColor(-1,0x000380) 
$Group_3 = GuiCtrlCreateGroup("", 2, 520, 1014, 225)
    GUICtrlCreateLabel("Info", 5, 535, 1005,25, $SS_CENTER)
    GUICtrlSetFont(-1,3,700,1,"Courier") 
    GUICtrlSetColor(-1,0x000380) 

$child1 = GUICreate("Cal", 657,508, 358, 40,$WS_POPUP, $WS_EX_TRANSPARENT, $Bckgrnd)
    GUISetBkColor(0xFFFFFF)
    $Calendar = GUICtrlCreateLabel("Calendar Text", 10, 15, 300, 50,$SS_CENTER)
    GUICtrlSetFont(-1,3,700,1,"Courier") 
    GUICtrlSetColor(-1,0x000380) 
$child2 = GUICreate("Info", 1000, 200, 15, 552, $WS_POPUP, $WS_EX_TRANSPARENT,$Bckgrnd)
    GUISetBkColor(0xFFFFFF)
    $Info = GUICtrlCreateLabel("Info Text" & @CRLF & "Can be from database" & @CRLF & "or text file", 300, 15, 300, 300, $SS_CENTER)
    GUICtrlSetFont(-1,3,700,1,"Courier") 
    GUICtrlSetColor(-1,0x000380) 

GuiSetState(@SW_SHOW,$Bckgrnd)
GUISetState(@SW_LOCK, $Bckgrnd)
GUISetState(@SW_SHOW,$child1)
GUISetState(@SW_SHOW,$child2)

While 1 
    For $i = -100 to 350 
        $msg = GUIGetMsg()  
        ControlMove("Cal","",$Calendar, 10,300-$i)
        Sleep (20)
    Next 
WEnd 



Func _exit() 
    Exit 
EndFuncoÝ÷ Ù8ZK- רNº'!j÷­æ¢÷¡×°¢¹"§v¯y§^qéíסûayÊ'qêmë¬yا¶Å©©è^¦-y×è®g£Z´¦¶§)àËajÛazÇ¢wlr¸©·
.ÙÞyÛh¶Ó~)]Û§vÙ¨½ëa{MúwèrÚåjëh×6While 1 
    For $i = -100 to 150 
        $msg = GUIGetMsg() 
        ControlMove("Info", "", $Info, 300, 30-$i) 
        Sleep (20)
    Next 
WEnd

But I am not sure if it will be able to get the ctrl handles

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

#include <GUIConstants.au3>
Opt("GUIOnEventMode", 1)
HotKeySet("{Esc}","Quit")
Global $text = "Multiple vertical" & @CR & "scrolling texts example" & @CR & "coded by mikehunt114"

$testGUI = GUICreate("Multiple Vertical Scrolling Texts", 400, 400)
GUISetOnEvent($GUI_EVENT_CLOSE, "Quit")

$win = WinGetPos("Multiple Vertical Scrolling Texts")
$childOne = GUICreate("Child One", 150, 150, $win[0]+10, $win[1]+50, $WS_POPUP, -1, $testGUI)
$label1 = GUICtrlCreateLabel($text, 10, 147, -1, 50)

$childTwo = GUICreate("Child Two", 150, 150, $win[0]+220, $win[1]+50, $WS_POPUP, -1, $testGUI)
$label2 = GUICtrlCreateLabel($text, 10, 147, -1, 50)

GUIRegisterMsg (0x0003,"Move")
GUISetState(@SW_SHOW, $testGUI)
GUISetState(@SW_SHOW, $childOne)
GUISetState(@SW_SHOW, $childTwo)

While 1
    For $i = 147 To -50 Step -1
        ControlMove("Child One", "", $label1, 10, $i)
        ControlMove("Child Two", "", $label2, 10, $i)
        Sleep(40)
    Next
WEnd

Func Move($hWndGUI)
    $ParentPosArr = WinGetPos($testGUI)
    WinMove($ChildOne, "", $ParentPosArr[0]+10, $ParentPosArr[1]+50)
    WinMove($childTwo, "", $ParentPosArr[0]+220, $ParentPosArr[1]+50)
EndFunc

Func Quit() 
    Exit 0
EndFunc

Edit: slightly better example

Edited by mikehunt114

IE Dev ToolbarMSDN: InternetExplorer ObjectMSDN: HTML/DHTML Reference Guide[quote]It is surprising what a man can do when he has to, and how little most men will do when they don't have to. - Walter Linn[/quote]--------------------[font="Franklin Gothic Medium"]Post a reproducer with less than 100 lines of code.[/font]

Share this post


Link to post
Share on other sites

Thanks but what I have done now is implimented the text files for the data to be displayed and the problem with what you posted above is that the length of the data is not the same so I will have times with no data being displayed in one or both of the areas. So I did this

$filepath = "m:\KENT_3d.txt"

$File = FileOpen($filepath, 0) 
$linecount = _FileCountLines ( $FilePath ) 
While 1  
    $line = FileReadLine($File) 
    If @error = -1 Then ExitLoop 
    $Text = $Text & @CRLF & $line 
WEnd 
FileClose($File) 
$Length = ($linecount * 50) 
$time = ($linecount * 13) 

$style = $WS_POPUP + $WS_DLGFRAME
HotKeySet("{Esc}","_exit") 

$Bckgrnd = GuiCreate("Kent County Courthouse", 1020, 760,-1, -1 , $style)
GUISetBkColor(0xFFFFFF)
$Group_1 = GuiCtrlCreateGroup("", 2, 2, 350, 525)
    $Pic_4 = GuiCtrlCreatePic("C:\test\seal.jpg", 20, 10, 300,195)
    GUICtrlCreateLabel("Welcome to the", 3,250,345,25,$SS_CENTER)
    GUICtrlSetFont(-1,6,700,1,"Courier") 
    GUICtrlSetColor(-1,0x000380) 
    GUICtrlCreateLabel("Kent County Courthouse", 3,280, 345,25,$SS_CENTER)
    GUICtrlSetFont(-1,3,700,1,"Courier")
    GUICtrlSetColor(-1,0x000380) 
    GUICtrlCreateLabel("Calendar for Family Court", 3,310, 345,25,$SS_CENTER)
    GUICtrlSetFont(-1,3,700,1,"Courier") 
    GUICtrlSetColor(-1,0x000380) 
    GUICtrlCreateLabel("Courtroom 3-D", 3,340, 345,25,$SS_CENTER)
    GUICtrlSetFont(-1,3,700,1,"Courier") 
    GUICtrlSetColor(-1,0x000380) 
$Group_2 = GuiCtrlCreateGroup("", 351, 2, 665, 525)
    GUICtrlCreateLabel("", 352, 15, 25, 25,$SS_CENTER)
    GUICtrlSetFont(-1,3,700,1,"Courier") 
    GUICtrlSetColor(-1,0x000380) 
$Group_3 = GuiCtrlCreateGroup("", 2, 520, 1014, 225)
    GUICtrlCreateLabel("", 25, 535, 25,25, $SS_CENTER)
    GUICtrlSetFont(-1,3,700,1,"Courier") 
    GUICtrlSetColor(-1,0x000380) 
$child1 = GUICreate("Cal", 662,508, 355, 10,$WS_POPUP, $WS_EX_TRANSPARENT, $Bckgrnd)
    GUISetBkColor(0xFFFFFF)
    $Calendar = GUICtrlCreateLabel($Text, 0, 510, 700, $Length,$SS_CENTER)
    GUICtrlSetFont(-1,3,700,1,"Courier") 
    GUICtrlSetColor(-1,0x000380) 


GuiSetState(@SW_SHOW,$Bckgrnd)
GUISetState(@SW_LOCK, $Bckgrnd)
GUISetState(@SW_SHOW,$child1)
run(@ScriptDir & "\judinfo.exe")

While 1 ; loop until exited
    For $i = -500 to $time 
        $msg = GUIGetMsg() 
        ControlMove("Cal","",$Calendar, 10,5-$i)
        Sleep (20)
    Next
WEnd


Func _exit()
    ProcessClose("judinfo.exe")
    Exit
EndFuncoÝ÷ ÚØ^Ø^çbú,r¸©µ«­¢+Ø¥¹±Õ±ÐíU%
½¹ÍѹÑ̹ÔÌÐì(¥¹±Õ±Ðí¥±¹ÔÌÐì)¥´ÀÌØíQáÐ(ÀÌØí¥±ÁÑ ôÅÕ½Ðí´èÀäÈí-9Q|ѹÑáÐÅÕ½Ðì((ÀÌØí¥±ô¥±=Á¸ ÀÌØí¥±ÁÑ °À¤(ÀÌØí±¥¹½Õ¹Ðô}¥±
½Õ¹Ñ1¥¹Ì ÀÌØí¥±AÑ ¤)]¡¥±Ä($ÀÌØí±¥¹ô¥±I1¥¹ ÀÌØí¥±¤(%%ÉɽÈô´ÄQ¡¸á¥Ñ1½½À($ÀÌØíQáÐôÀÌØíQáеÀì
I1µÀìÀÌØí±¥¹)]¹)¥±
±½Í ÀÌØí¥±¤(ÀÌØí]¥Ñ ô ÀÌØí±¥¹½Õ¹Ð¨ÔÀ¤(ÀÌØíÑ¥µô ÀÌØí±¥¹½Õ¹Ð¨Ä̤(((ÀÌØí¡¥±ÈôU%
ÉÑ ÅÕ½Ðí%¹¼ÅÕ½Ðì°ÄÀÀÀ°ÈÀÀ°ÄÀ°ÔÌÈ°ÀÌØí]M}A=AU@°ÀÌØí]M}a}QI9MAI9P¤(%U%MÑ    ­
½±½È Áá¤($ÀÌØí%¹¼ôU%
Ñɱ
ÉÑ1° ÀÌØíQáаÄÀ°ÄÔ°äÀÀ°ÀÌØí]¥Ñ °ÀÌØíMM}
9QH¤(%U%
ÑɱMѽ¹Ð ´Ä°Ì°ÜÀÀ°Ä°ÅÕ½Ðí
½ÕÉ¥ÈÅÕ½Ðì¤(%U%
ÑɱMÑ
½±½È ´Ä°ÁàÀÀÀÌàÀ¤()U%MÑMÑÑ¡M]}M!=°ÀÌØí¡¥±È¤()]¡¥±Ä(½ÈÀÌØí¤ô´ÄÀÀѼÀÌØíÑ¥µ(ÀÌØíµÍôU%Ñ5Í ¤($%
½¹Ñɽ±5½Ù ÅÕ½Ðí%¹¼ÅÕ½Ðì°ÅÕ½ÐìÅÕ½Ðì°ÀÌØí%¹¼°ÄÀ°Ô´ÀÌØí¤¤($%M±À ÈÀ¤(9áÐ)]¹

Share this post


Link to post
Share on other sites

Hi,

Did you know how to make this vertical scroll under the picture ?

Text with transparent background under a picture.

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0