Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Container Object not Resizing in Grid
Message
From
24/06/2005 16:36:55
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Container Object not Resizing in Grid
Environment versions
Visual FoxPro:
VFP 9
Miscellaneous
Thread ID:
01026447
Message ID:
01026447
Views:
68
I have a container object that I am adding to a grid column. The container has three textboxes in it (two side-by-side and the third below). When the column is resized, the container should set its width based on the new column width (set in column resize event); however, the container width is not changing. In debug I can see the old width and the new width of the column, but the container width does not change.

Any suggestions...

Below is the code to demonstrate this:


**************************************************
loForm = CREATEOBJECT("GridForm")
loForm.visible = .T.
READ EVENTS


**************************************************
*
DEFINE CLASS GridForm AS Form
Top = 0
Left = 0
Height = 169
Width = 574
DoCreate = .T.
Caption = "Grid Demostration"
Name = "Form1"


ADD OBJECT grid1 AS grid WITH ;
ColumnCount = 3, ;
Height = 169, ;
Left = 0, ;
Panel = 1, ;
Top = 0, ;
Width = 574, ;
Name = "Grid1", ;
Column1.Name = "Column1", ;
Column2.Width = 330, ;
Column2.Name = "Column2", ;
Column3.Name = "Column3"


PROCEDURE Load
CREATE CURSOR c_temp (field1 C(25), field2 C(25), field3 C(25), field4 C(50), field5 C(25))
INSERT INTO c_temp (field1,field2,field3,field4,field5);
VALUES ("Test Data","More Test Data","Yet more test data","This is a longer text phrase","Last text data")
ENDPROC


PROCEDURE Init
WITH thisform.grid1
.Columns(2).Addobject("MultiEdit1","MultiLineGrid",.Columns(2).width)
.Columns(2).CurrentControl = "MultiEdit1"
.Columns(2).MultiEdit1.Visible = .T.
.Columns(2).Sparse = .F.
.Rowheight = 45
.recordsource = 'c_temp'
.column1.controlsource = 'c_temp.field1'
.column2.MultiEdit1.Text1.controlsource = 'c_temp.field2'
.column2.MultiEdit1.Text2.controlsource = 'c_temp.field3'
.column2.MultiEdit1.Text3.controlsource = 'c_temp.field4'
.column3.controlsource = 'c_temp.field5'
ENDWITH
ENDPROC


PROCEDURE Resize
thisform.grid1.Width = thisform.width
thisform.grid1.Height = thisform.Height
ENDPROC


PROCEDURE grid1.Column2.Resize
this.MultiEdit1.width = this.Width
this.MultiEdit1.SetTextColumns()
ENDPROC
ENDDEFINE


**************************************************
*
DEFINE CLASS MyTextBox AS TextBox
BorderStyle = 0
Margin = 0
ForeColor = RGB(0,0,0)
BackColor = RGB(255,255,255)
ENDDEFINE


**************************************************
*
DEFINE CLASS MultiLineGrid AS container
Width = 478
Height = 46
BackStyle = 0
BorderWidth = 0
Name = "MultiLineGrid"


ADD OBJECT text1 AS textbox WITH ;
BorderStyle = 1, ;
Height = 23, ;
Left = -1, ;
SelectOnEntry = .T., ;
SpecialEffect = 1, ;
Top = -1, ;
Width = 240, ;
Name = "Text1"


ADD OBJECT text2 AS textbox WITH ;
BorderStyle = 1, ;
Height = 23, ;
Left = 238, ;
SelectOnEntry = .T., ;
SpecialEffect = 1, ;
Top = -1, ;
Width = 240, ;
Name = "Text2"


ADD OBJECT text3 AS textbox WITH ;
BorderStyle = 0, ;
Height = 23, ;
Left = 0, ;
SelectOnEntry = .T., ;
SpecialEffect = 1, ;
Top = 22, ;
Width = 480, ;
Name = "Text3"


*-- Sets the text column widths based on container width
PROCEDURE SetTextColumns
this.Text1.Width = INT(this.Width/2) + 1
this.Text2.Width = this.Text1.Width + 1
this.Text2.Left = this.Text1.Width - 2
this.Text3.Width = this.width
ENDPROC


PROCEDURE Init
LPARAMETERS pnWidth
this.Width = pnWidth
this.SetTextColumns()
ENDPROC


ENDDEFINE
Next
Reply
Map
View

Click here to load this message in the networking platform