Jump to content

Moving text in GUI [solved]


Tipulatoid
 Share

Recommended Posts

Hello

Trying to make moving text (credits) in "About" dialogue.

What I've done for now:

#include <GuiConstantsEx.au3>
#include <StaticConstants.au3>
#Include <Array.au3>

$top = 600
GUICreate("Credits", 300, $top)

Local $ThanksgivingStrings[4] = ["I want to express special gratitude to:", "AutoIt Team", "AutoIt Community", "... and many other good people"]
Local $ThanksgivingLabel = GUICtrlCreateLabel (_ArrayToString ($ThanksgivingStrings, @CRLF, 0, UBound ($ThanksgivingStrings)-1), 150, $top, 200, 14*UBound ($ThanksgivingStrings)-1, $SS_CENTER)
Local $LabelBig = GUICtrlCreateLabel ("", 25, 100, 250, 400, $SS_BLACKFRAME)

GUISetState ()

While 1
    Sleep (20)
    $top -=2
    GUICtrlSetPos ($ThanksgivingLabel, 50, $top)
    If $top < -150 Then $top = 600
;   ConsoleWrite ($top & @CRLF)
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            ExitLoop
    EndSwitch
WEnd

I need moving text to be visible only within the scope of $LabelBig. But the fluidity of the moving strings appearing/disappearing must be the same as is.

Can you help with this? Thanks

Edited by Tipulatoid
Link to comment
Share on other sites

Finally solved that way:

#include <GuiConstantsEx.au3>
#include <StaticConstants.au3>
#include <EditConstants.au3>
#include <WindowsConstants.au3>

$top = 600
$GUI = GUICreate("Credits", 300, $top)
; GUISetBkColor(0xFFFFFF)

Local $ThanksgivingStrings[4] = ["I want to express special gratitude to:", "AutoIt Team", "AutoIt Community", "... and many other good people"]
; Local $LabelBig = GUICtrlCreateLabel ("", 25, 100, 250, 420, $SS_BLACKFRAME)
Local $ThanksgivingLabel[UBound ($ThanksgivingStrings)]

$sTransHeight = 5
$sTransValue = 30
For $x = 0 to $sTransValue
    $stemp = GUICreate("",250, $sTransHeight, 25, $sTransHeight * $x + 100 ,BitOR($WS_POPUP,$WS_CHILD),$WS_EX_MDICHILD,$GUI)
    GUISetState()
    WinSetTrans($stemp,"",(255/$sTransValue)*(-1*($x-$sTransValue)))
Next

For $x = 0 to $sTransValue
    $stemp = GUICreate("",250, $sTransHeight, 25, 365 - ($sTransHeight * $x - 150) ,BitOR($WS_POPUP,$WS_CHILD),$WS_EX_MDICHILD,$GUI)
    GUISetState()
    WinSetTrans($stemp,"",(255/$sTransValue)*(-1*($x-$sTransValue)))
Next


GUISetState (@SW_SHOW,$GUI)

$sScroll = 80
$LabelHeight = 18
While 1
    Sleep (5)
    $sScroll +=1

    For $f=0 to UBound ($ThanksgivingLabel) - 1
        If $sScroll = 100 + $LabelHeight*$f Then $ThanksgivingLabel[$f] = GUICtrlCreateLabel($ThanksgivingStrings[$f],50, $top - $sScroll,200,$LabelHeight,$ES_CENTER)
    Next


    For $w = 0 to UBound ($ThanksgivingLabel) - 1
        GUICtrlSetPos ($ThanksgivingLabel[$w], 50, $top - $sScroll + $w*$LabelHeight)
    Next


    For $t=0 to UBound ($ThanksgivingLabel) - 1
        If $sScroll = 500 + $LabelHeight*$t Then
           GUICtrlDelete ($ThanksgivingLabel[$t])
        EndIf
    Next


    If $sScroll > $top Then $sScroll = 80

    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            ExitLoop
    EndSwitch
WEnd
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...