Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to wrap text in a grid?
Message
From
20/01/2003 05:49:55
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
17/01/2003 22:46:11
Henry Ravichander
RC Management Systems Inc.
Saskatchewan, Canada
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00743089
Message ID:
00743398
Views:
11
>Hi All:
>
>I have 3 columns in a grid. The first column will display text up to 100 characters, while the second and third display the date.
>
>Problem: I would like to be able to get Grid1.Column1.Text1 to wrap text, so that all the hundred characters of text are visible. Further if the height of Column1.text1 increases, Column2.text1 and Column3.text1 should also reflect the exact increase.
>
>Any suggestions on how to accomplish this? Thank you all in advance.

Henry,
Add an editbox control to column. You could do that in code or designer. I find code easier (assuming you already set column's width) :
*grid.init
with this.columns(1) && Will put editbox in column 1
  .Addobject('edtMyText','Editbox') && Named control 'edtMyText'
  .edtMyText.BorderStyle = 0 && No border
  .edtMyText.visible = .t.   && Make it visible
  .Currentcontrol = 'edtMyText' && Set control to be used in this column
  .Sparse = .F.  && Show edtMyText in all rows 
endwith
this.RowHeight = this.RowHeight * 2 && Increase grid rowheight to double size
In designer :
-Right click grid and select edit (VFP7 Ctrl+click also works)
-From form control toolbar select editbox and click on column 1
-Now an editbox with default name of "Edit1" is added to column and shows in PEM sheet
-Go to PEM sheet and set its BorderStyle to 0 && None
-In PEM sheet drop down object combo and select column1
-Set CurrentControl to "Edit1"
-Set Sparse to .F.
-Select grid and set rowheight higher such as current value * 2

Yet another method combines code with design time :)
-Click on your grid && so it's the only selected object at design time
-Go to command window and type
modi comm xx < CR >
to get a code window.
-In code window write
aselobj(arrGrd)
with arrGrd[1].columns(1) && Will put editbox in column 1
  .Addobject('edtMyText','Editbox') && Named control 'edtMyText'
  .edtMyText.BorderStyle = 0 && No border
  .Currentcontrol = 'edtMyText' && Set control to be used in this column
  .Sparse = .F.  && Show edtMyText in all rows 
endwith
arrGrd[1].RowHeight = arrGrd[1].RowHeight * 2 && Increase grid rowheight
select the code, right click and 'Execute selection'

-Close code window w/o saving

Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform