>*Column2.Resize() event code > >Local loCtl > >For Each loCtl In This.Controls > If loCtl.BaseClass = "Container" Then > loCtl.Resize() > EndIf >Next loCtl > > > >*Container Resize() event code > >If This.Parent.Parent.RowHeight > 10 And This.Parent.Width > 10 Then > This.Width = This.Parent.Width > This.Height = This.Parent.Parent.RowHeight > > With This.cmdFindCustomer > .Top = 0 > .Width = This.Height > .Height = This.Height > .Left = This.Width - This.Height > EndWith > > With This.txtCustomerName > .Top = 0 > .Left = 0 > .Height = This.Height > .Width = This.Width - This.Height > EndWith >EndIf > >>
Use customer Public oForm oForm = Createobject('Form') oForm.Newobject('myGrid','Grid') oForm.myGrid.RecordSource = 'customer' oForm.myGrid.Newobject('NewColumn','myColumn') oForm.myGrid.NewColumn.ColumnOrder = 1 oForm.myGrid.NewColumn.Resize() oForm.SetAll('Visible',.T.) oForm.Show Define Class myColumn As Column Procedure Resize For Each loCtl In This.Controls If loCtl.BaseClass = "Container" Then loCtl.Resize() Endif loCtl = .Null. Next loCtl This.Refresh Endproc Procedure Init This.Newobject('myControl','myContainer') This.CurrentControl = 'myControl' This.Sparse = .F. Endproc Enddefine Define Class myContainer As Container Height = 20 Width = 100 Add Object cmdFindCustomer As CommandButton With Left = 60, Width=38, Caption='...' Add Object txtCustomerName As TextBox With Left = 2, Width = 50 Procedure Resize If Type('This.Parent.Parent.RowHeight')='N' ; and This.Parent.Parent.RowHeight > 10 ; And This.Parent.Width > 10 Then Local lnWidth,lnHeight lnWidth = This.Parent.Width lnHeight = This.Parent.Parent.RowHeight This.Width = lnWidth This.Height = lnHeight With This.cmdFindCustomer .Top = 0 .Width = lnHeight .Height = lnHeight .Left = lnWidth - .Width Endwith With This.txtCustomerName .Top = 0 .Left = 0 .Height = lnHeight .Width = lnWidth - lnHeight Endwith Endif Endproc EnddefineCetin