Sign in to follow this  
Followers 0
james3mg

Marquee control

23 posts in this topic

#1 ·  Posted (edited)

Here's a simple function that gives the look that some people have been trying to get...unfortunately though it creates a marquee (that can have anything in it...pictures, text, etc), it's not one that will accept user input at runtime (like an input control would). However, it does allow you to select and copy the text in it unlike a label control...so it's somewhere between an input and a label marquee. If you want to add formatting or something other than text (like a picture), you'll need to use HTML codes in the $_MarText argument to do that.

It can take quite a number of arguments to customize it almost as much as you want:

$_MarText:  the text (or HTML markup) the marquee should display) (required)
$_MarX:         the x position in the GUI where the marquee should be placed (required)
$_MarY:     the y position in the GUI where the marquee should be placed (required)
$_MarWidth: the width of the marquee control (required)
$_MarHeight:    the height of the marquee control (note that if your contents are taller than a horizontal marquee, they'll be cut off...same with width in a vertical marquee) (required)
$_MarBGColor:   the bgcolor of the marquee control in hex RGB (does not obey opt(colormode) (default is -1 and is usually white)
$_MarLoop:  the number of loops to repeat before stopping.  Use "slide" behavior if you want it to be visible after stopping.  (default is -1: infinite)
$_MarBehavior:  Behavior of the marquee.  Default is -1 (scroll).  Other options are "slide" and "alternate"
$_MarDirection: Direction of the scrolling.  Default is -1 (left).  Other options are "right", "up" and "down"
$_MarScrollAmount   Jump of each advance- effectively controls the speed of the marquee.  Default is -1 (equal to 6).  Higher numbers result in higher speed, lower numbers in a smoother animation.
$_MarScrollDelay    Time in milliseconds between each advance.  Default is -1 (equal to 85).  Higher numbers result in a lower speed, lower numbers in a smoother animation

The return is the IE object you can apply GUICtrlSetResizing and similar functions to.

Here's the code (including a very basic GUI to show it off):

GUICreate("Marquee test",320,240,-1,-1,0x40000)
_GUICtrlCreateMarquee("really really really really long text!",5,5,150,24,"999999")
GUICtrlSetResizing(-1,1)
_GUICtrlCreateMarquee("Another<br>marquee",5,35,50,150,-1,-1,-1,"up")
GUICtrlSetResizing(-1,1)
GUISetState()

While GUIGetMsg() <> -3
WEnd

Func _GUICtrlCreateMarquee($_MarText,$_MarX,$_MarY,$_MarWidth,$_MarHeight,$_MarBGColor=-1,$_MarLoop=-1,$_MarBehavior=-1,$_MarDirection=-1,$_MarScrollAmount=-1,$_MarScrollDelay=-1)
    Local $_MarString="<marquee width=100% height=100%"
    If $_MarLoop <> -1 Then $_MarString&=" loop="&$_MarLoop
    If $_MarBehavior <> -1 Then $_MarString&=" behavior="&$_MarBehavior
    If $_MarDirection <> -1 Then $_MarString&=" direction="&$_MarDirection
    If $_MarScrollAmount <> -1 Then $_MarString&=" scrollamount="&$_MarScrollAmount
    If $_MarScrollDelay <> -1 Then $_MarString&=" scrolldelay="&$_MarScrollDelay
    $_MarString &= ">"&$_MarText&"</marquee>"
    Local $_marIE = ObjCreate("Shell.Explorer")
    Local $_marReturn = GUICtrlCreateObj($_marIE,$_MarX,$_MarY,$_MarWidth,$_MarHeight)
    $_marIE.navigate("about:blank")
    $_marIE.document.body.topmargin=0
    $_marIE.document.body.leftmargin=0
    $_marIE.document.body.scroll="no"
    $_marIE.document.body.bgcolor=$_MarBGColor
    $_marIE.document.body.innerHTML = $_MarString
    $_marIE=0
    Return $_marReturn
EndFunc

Please note there is no error checking in the function at this time. I just made this for my use in a script where there won't be error checking required. I just wanted to share ;)

You can run as many of these as you want in your script...since the function edits InnerHTML of that instance of the about:blank page rather than writing and saving code in an HTML file, they won't conflict with each other, nor does it leave any latent files on your system that could be read later on. You may want to disable the control however; if the user were to refresh the marquee control, it will revert to about:blank, and so show up white and blank. The best way I've found to do that is to add GUICtrlCreateLabel("",$_MarX,$_MarY,$_MarWidth,$_MarHeight) at the first line of the function...that way it creates a label OVER the marquee, blocking mouse access to the marquee control. But don't forget to give the label the same resizing property as the marquee control! Unfortunately, $_marIE.document.body.oncontextmenu="return false;" doesn't do the trick :D

Have fun!

Edited by james3mg

"There are 10 types of people in this world - those who can read binary, and those who can't.""We've heard that a million monkeys at a million keyboards could produce the complete works of Shakespeare; now, thanks to the Internet, we know that is not true." ~Robert Wilensky0101101 1001010 1100001 1101101 1100101 1110011 0110011 1001101 10001110000101 0000111 0001000 0001110 0001101 0010010 1010110 0100001 1101110

Share this post


Link to post
Share on other sites



Here's a simple function that gives the look that some people have been trying to get...unfortunately though it creates a marquee (that can have anything in it...pictures, text, etc), it's not one that will accept typing. However, it does allow you to select and copy the text in it...so it's somewhere between an input and a label marquee.

It can take quite a number of arguments to customize it almost as much as you want:

$_MarText:  the text (or HTML markup) the marquee should display) (required)
$_MarX:         the x position in the GUI where the marquee should be placed (required)
$_MarY:     the y position in the GUI where the marquee should be placed (required)
$_MarWidth: the width of the marquee control (required)
$_MarHeight:    the height of the marquee control (note that if your contents are taller than a horizontal marquee, they'll be cut off...same with width in a vertical marquee) (required)
$_MarBGColor:   the bgcolor of the marquee control in hex RGB (does not obey opt(colormode) (default is -1 and is usually white)
$_MarLoop:  the number of loops to repeat before stopping.  Use "slide" behavior if you want it to be visible after stopping.  (default is -1: infinite)
$_MarBehavior:  Behavior of the marquee.  Default is -1 (scroll).  Other options are "slide" and "alternate"
$_MarDirection: Direction of the scrolling.  Default is -1 (left).  Other options are "right", "up" and "down"
$_MarScrollAmount   Jump of each advance- effectively controls the speed of the marquee.  Default is -1 (equal to 6).  Higher numbers result in higher speed, lower numbers in a smoother animation.
$_MarScrollDelay    Time in milliseconds between each advance.  Default is -1 (equal to 85).  Higher numbers result in a lower speed, lower numbers in a smoother animation

The return is the IE object you can apply GUICtrlSetResizing and similar functions to.

Here's the code (including a very basic GUI to show it off):

GUICreate("Marquee test",320,240,-1,-1,0x40000)
_GUICtrlCreateMarquee("really really really really long text!",5,5,150,24,999999)
GUICtrlSetResizing(-1,1)
GUISetState()

While GUIGetMsg() <> -3
WEnd

Func _GUICtrlCreateMarquee($_MarText,$_MarX,$_MarY,$_MarWidth,$_MarHeight,$_MarBGColor=-1,$_MarLoop=-1,$_MarBehavior=-1,$_MarDirection=-1,$_MarScrollAmount=-1,$_MarScrollDelay=-1)
    Local $_MarString="<marquee width=100% height=100%"
    If $_MarBGColor <> -1 Then $_MarString&=" bgcolor="&$_MarBGColor
    If $_MarLoop <> -1 Then $_MarString&=" loop="&$_MarLoop
    If $_MarBehavior <> -1 Then $_MarString&=" behavior="&$_MarBehavior
    If $_MarDirection <> -1 Then $_MarString&=" direction="&$_MarDirection
    If $_MarScrollAmount <> -1 Then $_MarString&=" scrollamount="&$_MarScrollAmount
    If $_MarScrollDelay <> -1 Then $_MarString&=" scrolldelay="&$_MarScrollDelay
    $_MarString &= ">"&$_MarText&"</marquee>"
    
    Local $_MarHTMLfile=FileOpen(@TempDir&"\marquee.html",2)
    FileWriteLine($_MarHTMLfile,"<body leftmargin=0 topmargin=0 scroll=no>")
    FileClose($_MarHTMLfile)
    Local $_marIE = ObjCreate("Shell.Explorer")
    Local $_marReturn = GUICtrlCreateObj($_marIE,$_MarX,$_MarY,$_MarWidth,$_MarHeight)
    $_marIE.navigate(@TempDir&"\marquee.html")
    $_marIE.document.body.innerHTML = $_MarString
    $_marIE=0
    Return $_marReturn
EndFunc

Please note there is no error checking in the function at this time. I just made this for my use in a script where there won't be error checking required. I just wanted to share ;)

You can run as many of these as you want in your script...since the function edits InnerHTML rather than writing the code into an HTML file, they won't conflict with each other, nor will the contents be recoverable by reading the file.

Have fun!

Edit: forgot to mention this will leave a harmless, tiny file in @temp. If you want a clean script, you should run FileDelete(@TempDir&"\marquee.html") when you exit your script.

Thats sweet man thanks!

Share this post


Link to post
Share on other sites

Very Nice!! Thank You

Share this post


Link to post
Share on other sites

Thanks for the kind words ;)

Small update this morning- it doesn't write anything to any files now, so there's nothing left over to delete. :D

Have a good monday!


"There are 10 types of people in this world - those who can read binary, and those who can't.""We've heard that a million monkeys at a million keyboards could produce the complete works of Shakespeare; now, thanks to the Internet, we know that is not true." ~Robert Wilensky0101101 1001010 1100001 1101101 1100101 1110011 0110011 1001101 10001110000101 0000111 0001000 0001110 0001101 0010010 1010110 0100001 1101110

Share this post


Link to post
Share on other sites

Cool Update!! Thanks!!

Share this post


Link to post
Share on other sites

That is excewllent, just what I was looking for. Will it be possible to read the scrolling text from an external html file?

Share this post


Link to post
Share on other sites

Problem with this IE objects (same thing with that GIF, PNG... support on AutoIt) is that you can drop something on it and there goes your marquee. Default behaviour is that IE will navigate to that what is dropped.

I would suggest adding new line under ' $_marIE.navigate("about:blank") ', the line is:

$_marIE.document.writeln('<HTML><HEAD><script type="text/javascript"> function fnCancelDefault(){var oEvent=window.event; oEvent.returnValue = false}</SCRIPT> </HEAD><BODY ondragover="fnCancelDefault()"></BODY></HTML>')

That will block IE's default behaviour by means of using simple javascript.

Link suggests that this can be achived without script, also.


♡♡♡

.

eMyvnE

Share this post


Link to post
Share on other sites

Problem with this IE objects (same thing with that GIF, PNG... support on AutoIt) is that you can drop something on it and there goes your marquee. Default behaviour is that IE will navigate to that what is dropped.

Thanks for the advice and link ;) Please also note that creating the label as recommended for disabling right-click, etc will prevent drag-n-drop actions such as you are concerned about, as well.

@oranis: if you mean you want to load and display the text from an external HTML file, there are a few ways of accomplishing that. You could have your script read the desired part of the HTML file itself, storing in in a variable, then create the marquee with the variable providing the "text". Or you could create your own IE object and navigate it to the desired external HTML file. If, however, you're worried about being able to read what's in the marquee outside the script for security reasons, there aren't any HTML files that will contain the marquee's contents when using my updated version of the script. However, I'm sure it's still possible with memory reading tools, screen readers or the like... I hope that answers your question :D


"There are 10 types of people in this world - those who can read binary, and those who can't.""We've heard that a million monkeys at a million keyboards could produce the complete works of Shakespeare; now, thanks to the Internet, we know that is not true." ~Robert Wilensky0101101 1001010 1100001 1101101 1100101 1110011 0110011 1001101 10001110000101 0000111 0001000 0001110 0001101 0010010 1010110 0100001 1101110

Share this post


Link to post
Share on other sites

Thanks.

Share this post


Link to post
Share on other sites

#10 ·  Posted (edited)

Why this is not working? (for disabling right-click)

[ code]...

I wish I knew. As I said in my OP, I tried it and couldn't get it to work. Maybe DaleHolm has an idea...he's the IE COM guru.

@oranais: YW

Edited by james3mg

"There are 10 types of people in this world - those who can read binary, and those who can't.""We've heard that a million monkeys at a million keyboards could produce the complete works of Shakespeare; now, thanks to the Internet, we know that is not true." ~Robert Wilensky0101101 1001010 1100001 1101101 1100101 1110011 0110011 1001101 10001110000101 0000111 0001000 0001110 0001101 0010010 1010110 0100001 1101110

Share this post


Link to post
Share on other sites

Hi,

Why this is not working? (for disabling right-click)

$_marIE.document.body.oncontextmenu = 'return false'
    $_marIE.document.body.onselectstart = 'return false'
    $_marIE.document.body.ondragstart = 'return false'oÝ÷ Ûú®¢×«b²Ë©¦íyÚ''謮*mjwU&(º¯zÚ¢+bX§y«­¢+ØÀÌØí}µÉ%¹½Õµ¹Ð¹Ýɥѱ¸ Ìäì±Ðí  =d½¹Í±ÑÍÑÉÐôÅÕ½ÐíÉÑÕɸ±ÍÅÕ½Ðì½¹½¹Ñáѵ¹ÔôÅÕ½ÐíÉÑÕɸ±ÍÅÕ½Ð콹ɽÙÈôÅÕ½ÐíÉÑÕɸ±ÍÅÕ½ÐìÐìÌäì¤oÝ÷ ØȬ¬º²×ÞÂj+zØbºÚ"µÍÕRPÜX]J    ][ÝÓX]YYHÝ   ][ÝËÌLKLK

BÑÕRPÝÜX]SX]YYJ ][ÝÜX[HX[HX[HX[HÛÈ^ ÌÌÎÉ][ÝË
K
KML ][ÝÎNNNNNI][ÝËLKLKLKLK  ][ÝÒÜ^Û[    ][ÝÊBÕRPÝÙ]Ú^[ÊLKJBÑÕRPÝÜX]SX]YYJ    ][ÝÉ[ÛÜÐ[ÝØÝÉ[ÛÜÛX]YYI][ÝË
KÍK
KMLLKLKLK   ][ÝÝ  ][ÝËLK    ][ÝÕXØ[  ][ÝÊBÕRPÝÙ]Ú^[ÊLKJBÕRTÙ]Ý]J
BÚ[HÕRQÙ]ÙÊ
H   ÉÝÈLÂÑ[[ÈÑÕRPÝÜX]SX]YYJ   ÌÍ×ÓX^  ÌÍ×ÓX   ÌÍ×ÓXK  ÌÍ×ÓXÚY    ÌÍ×ÓXZYÚ   ÌÍ×ÓXÐÛÛÜHLK    ÌÍ×ÓXÛÜHLK    ÌÍ×ÓXZ][ÜHLK   ÌÍ×ÓXXÝ[ÛHLK  ÌÍ×ÓXØÜÛ[[Ý[HLK ÌÍ×ÓXØÜÛ[^HHLK   ÌÍÝI][ÝÉ][ÝÊBSØØ[  ÌÍ×ÓXÝ[ÈH ][ÝÉÛX]YYHÚYLL  HZYÚLL I][ÝÂRY   ÌÍ×ÓXÛÜ   ÉÝÈLH[   ÌÍ×ÓXÝ[È  [ÏH    ][ÝÈÛÜI][ÝÈ   [È ÌÍ×ÓXÛÜRY ÌÍ×ÓXZ][Ü  ÉÝÈLH[   ÌÍ×ÓXÝ[È  [ÏH    ][ÝÈZ][ÜI][ÝÈ  [È ÌÍ×ÓXZ][ÜRY    ÌÍ×ÓXXÝ[Û ÉÝÈLH[   ÌÍ×ÓXÝ[È  [ÏH    ][ÝÈXÝ[ÛI][ÝÈ [È ÌÍ×ÓXXÝ[ÛRY   ÌÍ×ÓXØÜÛ[[Ý[    ÉÝÈLH[   ÌÍ×ÓXÝ[È  [ÏH    ][ÝÈØÜÛ[[Ý[I][ÝÈ    [È ÌÍ×ÓXØÜÛ[[Ý[RY  ÌÍ×ÓXØÜÛ[^H  ÉÝÈLH[   ÌÍ×ÓXÝ[È  [ÏH    ][ÝÈØÜÛ[^OI][ÝÈ  [È ÌÍ×ÓXØÜÛ[^BIÌÍ×ÓXÝ[È   [ÏH    ][ÝÉÝÉ][ÝÈ    [È ÌÍ×ÓX^  [È ][ÝÉËÛX]YYIÝÉ][ÝÂSØØ[ ÌÍ×ÛXQHHØÜX]J ][ÝÔÚ[^Ü][ÝÊBSØØ[   ÌÍ×ÛX]HÕRPÝÜX]SØ    ÌÍ×ÛXQK ÌÍ×ÓX   ÌÍ×ÓXK  ÌÍ×ÓXÚY    ÌÍ×ÓXZYÚ
BIÌÍ×ÛXQK]YØ]J ][ÝØXÝ][É][ÝÊBBUÚ[H  ÌÍ×ÛXQKÞBBTÛY
L
BUÑ[IÌÍ×ÛXQKØÝ[Y[Ü][    ÌÎNÉÐÑHÛÙ[XÝÝH ][ÝÜ][ÙI][ÝÈÛÛÛ^Y[OI][ÝÜ][ÙI][ÝÈÛYÛÝI][ÝÜ][ÙI][ÝÉÝÉÌÎNÊHIÌÍ×ÛXQKØÝ[Y[ÙK]HH ÌÍÝBIÌÍ×ÛXQKØÝ[Y[ÙKÜXÚ[HIÌÍ×ÛXQKØÝ[Y[ÙKYXÚ[HIÌÍ×ÛXQKØÝ[Y[ÙKØÜÛH   ][ÝÛÉ][ÝÂIÌÍ×ÛXQKØÝ[Y[ÙKØÛÛÜH   ÌÍ×ÓXÐÛÛÜIÌÍ×ÛXQKØÝ[Y[ÙK[SH  ÌÍ×ÓXÝ[ÂIÌÍ×ÛXQHHT]   ÌÍ×ÛX][[

♡♡♡

.

eMyvnE

Share this post


Link to post
Share on other sites

I suggest this change:

#cs
    ; Example
    GUICreate("Marquee test", 320, 240, -1, -1, 0x40000)
    _GUICtrlCreateMarquee("really really really really long text!", 5, 5, 150, 24, "999999", -1, -1, -1, 2, -1, "Horizontal")
    GUICtrlSetResizing(-1, 1)
    _GUICtrlCreateMarquee("&nbsp;Another<br>&nbsp;marquee", 5, 35, 65, 150, -1, -1, -1, "up", 2, -1, "Vertical")
    GUICtrlSetResizing(-1, 1)
    GUISetState()
    While GUIGetMsg() <> -3
    WEnd
#ce

; #FUNCTION# ====================================================================================================================
; Name...........:  _GUICtrlCreateMarquee
; Description ...:  Creates a marquee Label control for the GUI
; Syntax.........:  _GUICtrlCreateMarquee( "Text", Left, Top, Width, Height, "SetBkColor", Loop, Behavior, _
;                           Direction, ScrollAmount, ScrollDelay, "SetTip" )
; Parameters ....:  Text    - The text (or HTML markup) the marquee should display.
;                   Left    - The Left side of the control. If -1 is used then left will be computed according to GUICoordMode.
;                   Top     - The Top of the control. If -1 is used then left will be computed according to GUICoordMode.
;                   Width   - [optional] The width of the control (default is the previously used width).
;                   Height  - [optional] The height of the control (default is the previously used height).
;               SetBkColor  - [optional] The bgcolor in hex RGB(does not obey opt(colormode) (default is -1: white).
;                   Loop    - [optional] The number of loops to repeat before stopping. Use "slide" behavior if you want
;                           it to be visible after stopping (default is -1: infinite)
;               Behavior    - [optional] The behavior of the control (default is -1: scroll). Others are "slide" and "alternate".
;               Direction   - [optional] The direction of the scrolling (default is -1: left). Others are "right", "up" and "down".
;               ScrollAmount- [optional] The Jump of each advance- effectively controls the speed of the marquee
;                           (default is -1: 6). Higher numbers result in higher speed, lower numbers in a smoother animation.
;               ScrollDelay - [optional] The Time in milliseconds between each advance (default is -1: 85).
;                           Higher numbers result in a lower speed, lower numbers in a smoother animation.
;                   SetTip  - [optional] Tip text that will be displayed when the mouse is hovered over the control.
; Return values .:  Success - Returns the identifier (controlID) of the new Marquee control.
;                   Failure - Returns 0
; Author ........:  james3mg
; Modified.......:  trancexx and jscript "FROM BRAZIL"
; Remarks .......:  This function attempts to embed an 'ActiveX Control' or a 'Document Object' inside the GUI.
;                   'Document Objects' will only be visible if the Windows style $WS_CLIPCHILDREN has been used in GUICreate().
;                   The GUI functions GUICtrlRead and GUICtrlSet have no effect on this control. The object can only be
;                   controlled using 'methods' or 'properties' on the $ObjectVar.
; Related .......:  ObjCreate
; Link ..........;
; Example .......;  Yes
; ===============================================================================================================================
Func _GUICtrlCreateMarquee($sText, $iLeft, $iTop, $iWidth = -1, $iHeight = -1, $sSetBkColor = -1, $iLoop = -1, $iBehavior = -1, _
        $iDirection = -1, $iScrollAmount = -1, $iScrollDelay = -1, $sSetTip = "")
    ;==============================================
    ; Local Constant/Variable Declaration Section
    ;==============================================
    Local $sInnerHTML = "<marquee width=100% height=100%"
    Local $oShell = ObjCreate("Shell.Explorer")
    Local $iCtrlID = GUICtrlCreateObj($oShell, $iLeft, $iTop, $iWidth, $iHeight)
    
    If $iLoop <> -1 Then $sInnerHTML &= " loop=" & $iLoop
    If $iBehavior <> -1 Then $sInnerHTML &= " behavior=" & $iBehavior
    If $iDirection <> -1 Then $sInnerHTML &= " direction=" & $iDirection
    If $iScrollAmount <> -1 Then $sInnerHTML &= " scrollamount=" & $iScrollAmount
    If $iScrollDelay <> -1 Then $sInnerHTML &= " scrolldelay=" & $iScrollDelay
    $sInnerHTML &= ">" & $sText & "</marquee>"
    $oShell.navigate("about:blank")
    While $oShell.busy
        Sleep(100)
    WEnd
    $oShell.document.writeln('<BODY onselectstart = "return false" oncontextmenu="return false" ondragover="return false">')
    $oShell.document.body.title = $sSetTip
    $oShell.document.body.topmargin = 0
    $oShell.document.body.leftmargin = 0
    $oShell.document.body.scroll = "no"
    $oShell.document.body.bgcolor = $sSetBkColor
    $oShell.document.body.innerHTML = $sInnerHTML
    $oShell = 0
    Return $iCtrlID
EndFunc   ;==>_GUICtrlCreateMarquee

More professional?

Niceeee!! Good job!~!

Share this post


Link to post
Share on other sites

yes, really nice

"Shell.Explorer.2" , not "Shell.Explorer" ;)


♡♡♡

.

eMyvnE

Share this post


Link to post
Share on other sites

Hi,

How can I sets the text color of a Marquee control?

And the special flag $GUI_BKCOLOR_TRANSPARENT can be used?

Change body style color

$oShell.document.body.style.color = "red"oÝ÷ Ø   Ýjz-êí)àëwö˶f«ªçrê좷,²Ër殶­sbb33c¶õ6VÆÂæFö7VÖVçBçw&FVÆâb33²fÇC´TBfwC²fÇC·7GÆRGSÒgV÷C·FWBö772gV÷C²fwC¶Ö'VVW¶7W'6÷#¢FVfVÇGÒfÇC²÷7GÆRfwC²fÇC²ôTBfwC²fÇC´$ôEöç6VÆV7G7F'BÒgV÷C·&WGW&âfÇ6RgV÷C²öæ6öçFWFÖVçSÒgV÷C·&WGW&âfÇ6RgV÷C²öæG&v÷fW#ÒgV÷C·&WGW&âfÇ6RgV÷C²fwC²b33²

♡♡♡

.

eMyvnE

Share this post


Link to post
Share on other sites

very very cool and fantastic job, Mind Blowing work! thanks for it.


Website: www.cerescode.comForum: www.forum.cerescode.comIRC: irc.freenode.net , Channel: #Ceres--------------------Autoit Wrappers, Great additions to your script (Must See) (By: Valuater)Read It Befor Asking Question Click Here...--------------------Join Monoceres's Forums http://www.monoceres.se--------------------There are three kinds of people: Those who make things happen, those who watch things happen, and those who ask, ‘What happened?’” –Casey Stengel

Share this post


Link to post
Share on other sites

#16 ·  Posted (edited)

Very nice!!

One thing I dont understand is the changing font color!

$oShell.document.body.style.color = "red"

What am I supposed to do with this??

Where does it go ive tried everywhere but keep getting an error

thanks

EDIT!!! Sorted it

Edited by bluerein

Share this post


Link to post
Share on other sites

The problem with using a HTML page to display a marquee is that when other programs are using CPU extensively, your marquee is very likely to go slow or stutter. I've had this problem as well in a professional environment and solved it using Silverlight. That was my first silverlight project, and got me hooked. I am thinking of rewriting it in DirectX though..

Share this post


Link to post
Share on other sites

Very nice!!

One thing I dont understand is the changing font color!

$oShell.document.body.style.color = "red"

What am I supposed to do with this??

Where does it go ive tried everywhere but keep getting an error

thanks

EDIT!!! Sorted it

Global $txt = 'smilies<IMG src="http://i287.photobucket.com/albums/ll131/mailer_smilies/3.gif"><IMG src="http://i287.photobucket.com/albums/ll131/mailer_smilies/4.gif"><IMG src="http://i287.photobucket.com/albums/ll131/mailer_smilies/5.gif"> <IMG src="http://i287.photobucket.com/albums/ll131/mailer_smilies/6.gif"> <IMG src="http://i287.photobucket.com/albums/ll131/mailer_smilies/7.gif"><IMG src="http://i287.photobucket.com/albums/ll131/mailer_smilies/8.gif"> <IMG src="http://i287.photobucket.com/albums/ll131/mailer_smilies/9.gif"> <IMG src="http://i287.photobucket.com/albums/ll131/mailer_smilies/10.gif"><IMG src="http://i287.photobucket.com/albums/ll131/mailer_smilies/11.gif">'

GUICreate("Marquee test", 320, 220)

_GUICtrlCreateMarquee("Slowly... something", 10, 15, 300, 30, "What?", 0, 1, Default, 0, "alternate", "right", 1)
_GUICtrlCreateMarquee("These are " & $txt, 10, 50, 300, 30, "Just showing off", 1, 1)
_GUICtrlCreateMarquee("More " & $txt, 10, 95, 300, 28, "Hi", 2, "blue", "silver", 1, "slide", Default, 3) 
_GUICtrlCreateMarquee($txt, 25, 127, 280, 26, "Going up...", Default, "green", Default, Default, Default, "up", 1)
_GUICtrlCreateMarquee($txt, 10, 160, 300, 30, "From left to right", 3, "red", "white", Default, Default, "right", 5, 350)

GUISetState()

While GUIGetMsg() <> -3
WEnd

Func _GUICtrlCreateMarquee($sText, $iLeft, $iTop, $iWidth, $iHeight, $sSetTip = "", $iBorder = Default, $sSetTxtColor = Default, _
        $sSetBkColor = Default, $iLoop = 0, $iBehavior = Default, $iDirection = Default, _
        $iScrollAmount = 6, $iScrollDelay = 85)

    Local $sGetSysColor
    Local $oShell = ObjCreate("Shell.Explorer.2")
    
    If Not IsObj($oShell) Then Return SetError(1, 0, -1)
    
    Local $iCtrlID = GUICtrlCreateObj($oShell, $iLeft, $iTop, $iWidth, $iHeight)
    
    Switch $iBorder
        Case Default
            $iBorder = 0
        Case Else
            $iBorder = Abs($iBorder)
    EndSwitch   
    
        
    Switch $sSetTxtColor ; 16 colors by name, HTML 4.01 standard
        Case 'silver', 'gray', 'white', 'maroon', 'red', 'purple', 'fuchsia', 'green', 'lime', 'olive', 'yellow', 'navy', 'blue', 'teal', 'aqua'
        Case Else 
            $sSetTxtColor = 'black'
    EndSwitch
    
    Switch $sSetBkColor ; 16 colors by name, HTML 4.01 standard
        Case 'black', 'silver', 'gray', 'white', 'maroon', 'red', 'purple', 'fuchsia', 'green', 'lime', 'olive', 'yellow', 'navy', 'blue', 'teal', 'aqua'
        Case Else
            $sGetSysColor = DllCall('user32.dll', 'int', 'GetSysColor', 'int', 15)
            $sGetSysColor = Hex($sGetSysColor[0], 6)
            $sSetBkColor = StringMid($sGetSysColor, 5, 2) & StringMid($sGetSysColor, 3, 2) & StringMid($sGetSysColor, 1, 2)
    EndSwitch
        
    Switch $iBehavior
        Case 'alternate', 'slide'
        Case Else
            $iBehavior = 'scroll'           
    EndSwitch
    
    Switch $iDirection
        Case 'right', 'up', 'down'
        Case Else 
            $iDirection = 'left'
    EndSwitch
        
        
    $oShell.navigate("about:blank")
    While $oShell.busy
        Sleep(100)
    WEnd

    With $oShell.document
        .write('<style>marquee{cursor: default}></style>')
        .write('<body onselectstart="return false" oncontextmenu="return false" onclick="return false" ondragstart="return false" ondragover="return false">')
        .writeln('<marquee width=100% height=100%')
        .writeln("loop=" & $iLoop)
        .writeln("behavior=" & $iBehavior)
        .writeln("direction=" & $iDirection)
        .writeln("scrollamount=" & $iScrollAmount)
        .writeln("scrolldelay=" & $iScrollDelay)
        .write(">")
        .write($sText)
        .body.title = $sSetTip
        .body.topmargin = 0
        .body.leftmargin = 0
        .body.scroll = "no"
        .body.style.color = $sSetTxtColor
        .body.bgcolor = $sSetBkColor
        .body.style.borderWidth = $iBorder
    EndWith

    Return $iCtrlID
EndFunc

♡♡♡

.

eMyvnE

Share this post


Link to post
Share on other sites

#19 ·  Posted (edited)

how do i center the text in the marquee?

Edited by civilcalc

Share this post


Link to post
Share on other sites

<center> and </center> around the marguee.

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