[Gambas-user] TextEdit and linefeeds

Rolf-Werner Eilert eilert-sprachen at ...221...
Tue Nov 8 11:25:01 CET 2011


Ron,

I guess I got it :-) I found my old project where I used it, and now 
read this:

It depends on whether TextEdit is ReadOnly AND you shouldn't use .Insert 
but concatenate TextEdit.Text (oh my goodness...).

If ReadOnly = True, it reacts like TextLabel, i. e. "\n" is ignored and 
only HTML tags are interpreted.

If ReadOnly = False, it looks for a Return = chr$(10) = "\n" (which 
could be pressed by the user) and starts a new paragraph.

As you need it for reading only, set it accordingly and change "\n" to 
"<br>" - this should do it.

PUBLIC SUB WriteLog(sText AS String, OPTIONAL bStrip AS Boolean)

   IF NOT bStrip THEN sText &= "<br>"

   sText = "<b>" & Format$(Now, "yyyy/mm/dd hh:nn:ss") & "</b> " & sText
   FMain.txtMainLog.EnsureVisible
   FMain.txtMainLog.Text &= sText   'This runs better
   'FMain.txtMainLog.Insert(sText)  'This will mess it up
   PRINT sText;

END


Hope it helps!

Rolf


Am 06.11.2011 11:22, schrieb Ron:
> Hi all,
>
> In my project I replaced the txtArea for readlonly TextEdit objects so I
> can color the text I want to emphasize, this works good.
>
> But how can I just do a single line wrap, until now I only got a blank line
> in between lines, or all lines concatenated together ;-(
>
> It must be something simple, see attached Gambas2 object to see what I mean.
>
> Thanks for any pointers in the right direction...
>
> Regards,
> Ron_2nd,
>
>
>
> ------------------------------------------------------------------------------
> RSA(R) Conference 2012
> Save $700 by Nov 18
> Register now
> http://p.sf.net/sfu/rsa-sfdev2dev1
>
>
>
> _______________________________________________
> 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