[Gambas-user] GridView Cell Height with WordWrap

Rolf-Werner Eilert rwe-sse at osnanet.de
Fri Feb 26 11:14:51 CET 2021


Am 26.02.21 um 00:07 schrieb Gianluigi:
> Hi Benoit,
> 
> over to:
> GridView[0, 0].WordWrap = True
> GridView[0, 0].Text = "A really long text"
> GridView.Rows[0].Height = -1
> you have created"GridView.Data.WordWrap = True" but there seems to be no 
> quick way to adjust the row height.
> GridView.Rows[Row].Height = -1 within the Sub _Data fails.
> It is I who did not understand or, using the Sub _Data, the only way is 
> this [0].
> It would be much simpler and faster if GridView.Rows.Count started the 
> Sub _Data so that you could enter a command after processing all the rows.
> 
> Regards and Good night
> Gianluigi
> 
> [0]
> Private $sText1 As String = "Nel mezzo del cammin di nostra vita mi 
> ritrovai in una selva oscura"
> Private $sText2 As String = "Pippo"
> 
> Public Sub Form_Open()
> 
>    With GridView1
>      .Header = 3
>      .Columns.Count = 2
>      .Columns.Width = 100
>      .Rows.Count = 100
>    End With
>    For r As Integer = 0 To GridView1.Rows.Max
>      For c As Integer = 0 To GridView1.Columns.Max
>        If GridView1[r, c].WordWrap Then GridView1.Rows[r].Height = -1
>      Next
>    Next
> 
> End
> 
> Public Sub GridView1_Data(Row As Integer, Column As Integer)
> 
>    If Row Mod 2 = 0 Then
>      GridView1.Data.Text = $sText2
>      GridView1.Data.Background = &HBFFFBF
>    Else
>      GridView1.Data.WordWrap = True
>      GridView1.Data.Text = $sText1
>    Endif
> 
> End
> 
> 
> ----[ http://gambaswiki.org/wiki/doc/netiquette ]----
> 

Thank you so much, Gianluigi, that was it! It must not be within the 
_Data event sub, but it has to be called separately after _Data has run.

This way it runs flawlessly.

Regards
Rolf


More information about the User mailing list