[Gambas-user] GridView.ClientWidth yields incorrect size on Form_Open

T Lee Davidson t.lee.davidson at gmail.com
Fri Feb 1 00:11:32 CET 2019


I am trying to resize a column other than the last column to take up the remaining available client space. But, I don't get a 
correct value for GridView.ClientWidth until the Form_Show event. Per the subject line, is this expected behavior or a bug?


To reproduce, put a GridView on a new form. Then set FMain.class to:

' Gambas class file

Public Sub Form_Open()

   Dim Headers As String[] = ["0123456789", "0123456789", "0123456789", "0123456789"]

   With GridView1
     .AutoResize = False
     .Header = GridView.Horizontal
   End With

   GridView1.Columns.Count = Headers.Count
   For i As Integer = 0 To Headers.Max
     GridView1.Columns[i].Title = Headers[i]
   Next
   Debug GridView1.ClientWidth

End


Public Sub Form_Resize()

   Debug GridView1.ClientWidth

End

Public Sub Form_Show()

   Debug GridView1.ClientWidth

End


___
Lee



More information about the User mailing list