[Gambas-user] GridView Cell Height with WordWrap

Rolf-Werner Eilert rwe-sse at osnanet.de
Thu Feb 25 08:42:11 CET 2021


Am 24.02.21 um 15:09 schrieb Benoît Minisini:
> Le 24/02/2021 à 13:53, Rolf-Werner Eilert a écrit :
>> When I want to have the individual rows adapt to the correct height to 
>> show every line of word-wrapped text, how can I achieve that?
>>
>> This is what I tried. "lsMeine" is the GridView:
>>
>> Public Sub lsMeine_Data(Row As Integer, Column As Integer)
>>
>>    If Row Mod 2 = 0 Then
>>      lsMeine.Data.Background = Color.Lighter(Color.LightGray)
>>      lsMeine.Data.Text = nzEigene[Row]
>>    Else
>>      lsMeine.Data.WordWrap = True
>>      lsMeine.Data.Text = nzEigene[Row]
>>      lsMeine.Rows[Row].Height = lsMeine.Font.TextHeight(nzEigene[Row])
>>    Endif
>>
>> I try to attach a screenshot.
>>
>> In line [1] of the list it doesn't work (because the text doesn't have 
>> a line break (LF) in it?). In line [3] it runs well, there are several 
>> line breaks.
>>
>> So, I have to find out the necessary height of the cell even when text 
>> has been word-wrapped only.
>>
>> Regards
>> Rolf
>>
> 
> If you set the row height to -1, it should do the stuff for you.
> 
> Regards,
> 

You are right, guys, I tried just that. The reason for which it fails 
is, there is no WordWrap in the version I use. I saw this only now.

This is Gambas 3.15.2 (isn't that the latest version?) running under 
Ubuntu Mate 18, and the project uses gb.qt4 + gb.qt4.ext. The reason 
might be that in the past I needed one or two of the special things that 
come with qt4.ext.

So I wonder if I can easily switch to another component without loosing 
some feature somewhere else I do not remember. The project is rather old 
and rather big.

Anyone with an idea?

Regards
Rolf


More information about the User mailing list