[Gambas-user] Draw.Text problem with control chars

Fabien Bodard gambas.fr at ...626...
Sat Jan 30 10:20:52 CET 2010


you are true ... so use an array with predifined tabs


Dim aTabs as new Integer[8]

For i = 0 to aTabs.Max

  aTabs[i] = j
   j+=drawingArea.Width/aTabs.Count
next



2010/1/30 Doriano Blengino <doriano.blengino at ...1909...>:
> Fabien Bodard ha scritto:
>> draw.text(replace(stext, "\t",string(" ",5)),x,y)
>>
> Quick and simple hack, but may be he wants to make tabular columns...
> not so simple to do.
>
> Tab widths are not always the same, it depends on the position on screen.
> If using a fixed font, then replacing a tabulator with the correct
> amount of spaces (not always 5 spaces) works well.
> If not using a fixed font, the previous method works not so well: the
> calculus should be done in pixels.
> To print a tab, one must take the current position, divide by 8 (or
> another "tab width", or 64 pixels, or the width of 16 spaces...), take
> the integer part, add 1, and multiply again for the tab width (8, or 64,
> or the width of 16 spaces, or whatever).
> In a word processor applications, tabs are at fixed positions not
> necessarily even-spaced. An array with predetermined tab positions could
> work.
>
> Regards,
>
> --
> Doriano Blengino
>
> "Listen twice before you speak.
> This is why we have two ears, but only one mouth."
>
>
> ------------------------------------------------------------------------------
> The Planet: dedicated and managed hosting, cloud storage, colocation
> Stay online with enterprise data centers and the best network in the business
> Choose flexible plans and management services without long-term contracts
> Personal 24x7 support from experience hosting pros just a phone call away.
> http://p.sf.net/sfu/theplanet-com
> _______________________________________________
> 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