Jump to content

Scrolling Text


ioliver
 Share

Recommended Posts

I need to make text scroll in a Label. Is this possible? Any Ideas how I could get it to work?

Thanks,

Ian

> Maybe someting like StringTrimLeft? You think that would work?

Edited by ioliver

"Blessed be the name of the Lord" - Job 1:21Check out Search IMF

Link to comment
Share on other sites

Thanks Larry.

This may be a stupid question. But if I put that loop inside the GUICreate(), GUIShow() structure, then the GUI will never be displayed, right?

So how do I add the While 1, Wend Loop?

Thanks again,

Ian

> Here's what I have so far:

Global $WS_POPUP = 0x80000000
Global $WS_DLGFRAME = 0x400000

; No Titlebar; you can remove WS_DLGFRAME if you want a borderless window
$style = $WS_POPUP + $WS_DLGFRAME
$text = "This is my scrolling text... This is my scrolling text... This is my scrolling text... This is my scrolling text...  This is my scrolling text... "
$show = $text
$len = StringLen($text)

GuiCreate("Ticker", 1024, 40, 0, 0, $style)
  $ref = GUISetControl("Label", $show, 10, 10)
  GUISetControlNotify()
GuiShow()
GuiWaitClose()

While 1
   For $i = 0 to $len - 1
      $show = StringRight($text,$len - $i) & StringLeft($text,$i)
     ;ToolTip($show, 10, 10)
      GUIWrite($ref, 0, $show)
      Sleep(500)
   Next
Wend

Thanks again,

Ian

Edited by ioliver

"Blessed be the name of the Lord" - Job 1:21Check out Search IMF

Link to comment
Share on other sites

Thanks again Larry.

Here's what I have so far.

Global $WS_POPUP = 0x80000000
Global $WS_DLGFRAME = 0x400000

$style = $WS_POPUP + $WS_DLGFRAME
$text = "This is my scrolling text... This is my scrolling text... This is my scrolling text... This is my scrolling text...  This is my scrolling text... "
$show = $text
$len = StringLen($text)

Opt("GuiNotifyMode", 1)
GuiCreate("Ticker", 1024, 40, 0, 0, $style)
  $ref = GUISetControl("Label", $show, 10, 10)
GuiShow()

While 1
  For $i = 0 to $len - 1
    $show = StringRight($text,$len - $i) & StringLeft($text,$i)
   ;ToolTip($show, 10, 10)
    GUIWrite($ref, 0, $show)
    Sleep(500)
  Next
Wend

It's working now, but I plan to do more with it. Thanks again for your help.

Ian

"Blessed be the name of the Lord" - Job 1:21Check out Search IMF

Link to comment
Share on other sites

  • 2 weeks later...

Just thought I would add something to this...

I wanted the same functionality, but having the text read from a file rather than being pre-definied in the script, that way making it a lot more flexible..

Here is the code..

Global $WS_POPUP = 0x80000000

Global $WS_DLGFRAME = 0x400000

$file = FileOpen("C:\test.txt", 0)

; Check if file opened for reading OK

If $file = -1 Then

MsgBox(0, "Error", "Unable to open file.")

Exit

EndIf

; Read in 1 character at a time until the EOF is reached

While 1

$text = FileRead($file, 200)

If @error = -1 Then ExitLoop

$style = $WS_POPUP + $WS_DLGFRAME

$show = $text

$len = StringLen($text)

Opt("GuiNotifyMode", 1)

GuiCreate("Ticker", 1024, 40, 0, 0, $style)

$ref = GUISetControl("Label", $show, 10, 10)

GuiShow()

While 1

For $i = 0 to $len - 1

$show = StringRight($text,$len - $i) & StringLeft($text,$i)

;ToolTip($show, 10, 10)

GUIWrite($ref, 0, $show)

Sleep(100)

Next

Wend

Wend

FileClose($file)

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...