[Gambas-user] Fwd: Re: GridView.ClientWidth yields incorrect size on Form_Open
Charlie Ogier
charlie at cogier.com
Sun Feb 3 16:17:51 CET 2019
(Sorry sent to T Lee instead of the mailing list)
Hi T Lee,
Try this code: -
/' Gambas class file//
//
//Public Sub Form_Open()//
//
// Dim Headers As String[] = ["012345", "0123456789012546",
"01234567890123456789", "01"]//
//
// With Me//
// .Arrangement = Arrange.Vertical//
// .Padding = 5//
// End With//
//
// With GridView1//
// .Expand = True//
// .Header = GridView.Both//
// .Columns.Count = Headers.Max//
// .Rows.Count = 1//
// End With//
//
// GridView1.Columns.Count = Headers.Count//
// For i As Integer = 0 To Headers.Max//
// GridView1.Columns[i].Title = Headers[i]//
// GridView1[0, i].Text = Headers[i]//
// Next//
//
// GridView1.Columns.width = -1//
//
// Debug GridView1.ClientWidth//
//
//End//
//
//Public Sub Form_Resize()//
//
// Debug GridView1.ClientWidth//
//
//End//
//
//Public Sub Form_Show()//
//
// Debug GridView1.ClientWidth//
//
//End/*
*
Charlie
On 31/01/2019 23:11, T Lee Davidson wrote:
> 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
>
>
> ----[ Gambas mailing-list is hosted by https://www.hostsharing.net ]----
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.gambas-basic.org/pipermail/user/attachments/20190203/5e4d9687/attachment.html>
More information about the User
mailing list