[Gambas-user] Gambas-user Digest, Vol 66, Issue 27

Randy Millner randlemillner at ...626...
Fri Nov 18 22:25:11 CET 2011


Hello Rolf,
I am grateful for your assistance.
I was confused.
I saw nowhere in your function referencing .title?
I changed text to title

All is well!! Thank you!!!



> Message: 5
> Date: Thu, 17 Nov 2011 08:52:03 +0100
> From: Rolf-Werner Eilert <eilert-sprachen at ...221...>
> Subject: Re: [Gambas-user] TableView Lacking Alignment Function
> To: gambas-user at lists.sourceforge.net
> Message-ID: <4EC4BD23.20108 at ...221...>
> Content-Type: text/plain; charset=ISO-8859-1; format=flowed
>
> Am 16.11.2011 16:23, schrieb Randy Millner:
>> Hello Rolf, thanks for the reply,
>> I tried manually declaring padded whitespace. Example:
>> TableView1.Columns[7].Title = "         Amount"
>> And the result was only one space being delivered to the final output:
>> " Amount"
>> What would be different if I wrote a function?
>
> Oops - I guess nothing :-)
>
> But - err - hm. Ok, trying it myself...
>
> PRIVATE FUNCTION rightbound(column AS Integer, text AS String) AS String
>
>   IF tbk.Font.Width(text) >= tbk.Columns[column].Width THEN RETURN text
>
>   DO
>     text = " " & text
>   LOOP UNTIL tbk.Font.Width(text) >= tbk.Columns[column].Width - 10
>
>   RETURN text
>
> END
>
> Then I called this with
>
> tbk.Columns[1].Text = rightbound(1, "Text")
>
> In the program I tried this tbk is the name of the TableView. And it
> turned out to be fine with Width -10, otherwise it stops too late.
>
> Does it run for you too? Anyway, this way you have a dynamic thing that
> you can call if a user changes the column's width.
>
> Rolf
>
>
>




More information about the User mailing list