[Gambas-user] Scrolling text ... how to do in gambas

Fabien Bodard gambas.fr at ...626...
Sat Apr 26 16:20:57 CEST 2008


txtl.autoresize = true

height = txtl.height


i think this will work...

not tested yet.

And by drawing the text ?

Draw.Richtext(text,x,y) ?

in a drawing area...

Private $iHeight as integer
Private $sMyText as String

Private $iX, $iY as Integer


Public Sub Form_Open()

$ix = DrawingArea.ClientH

$sMyText = "tiutiut....................istsiutsistist"

Draw.Begin(DrawingArea1)

$iHeight = Draw.RichTextHeight($sMyText, DrawingArea1.ClientW)

Draw.End

End

Public Sub Timer_Timer()

dec $ix
if $ix+$iHeight<=0 then $ix = DrawingArea.ClientH
DrawingArea.Refresh

End

Public Sub  DrawingArea1_Draw()
Draw.RichText($sMyText, ,$ix,$iy,Last.ClientW)
end

2008/4/25 Werner <wdahn at ...1000...>:
> M0E Lnx wrote:
>  > I'm not sure this does what I need though...
>  > In this code you sent, there is a scrollview, and a text label.
>  > The timer shifts the scrollview's Y property to do the animation, but
>  > still doesn't work for me, because that would be the same as simply
>  > using a text label, and moving it's Y property.
>  >
>  > That I can do with a timer like in your example... but how to
>  > determine how tall or wide the text label has to be in order for the
>  > text not to get cut off the label?
>  >
>  >
>  If I understand the question correctly, you want to know how many pixels
>  wide and high a given text using a particular font on the screen will be.
>
>  The gb.qt Font class has the answer to that.
>
>  Example: if the name of your TextLabel is txl then
>
>  PRINT "The text is " & txl.Font.Width(txl.Text) & " pixel wide and " &
>  txl.Font.Height(txl.Text) & " pixel high."
>
>  prints the width and the height when using the TextLabel's font.
>
>  One word of caution: Some fonts designers were a little sloppy in
>  describing their fonts accurately, especially as far as height is concerned.
>
>  Hope I haven't answered a different question :-)
>
>  Regards,
>
>  Werner
>
>
>
>
>  -------------------------------------------------------------------------
>  This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
>  Don't miss this year's exciting event. There's still time to save $100.
>  Use priority code J8TL2D2.
>  http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
>  _______________________________________________
>  Gambas-user mailing list
>  Gambas-user at lists.sourceforge.net
>  https://lists.sourceforge.net/lists/listinfo/gambas-user
>




More information about the User mailing list