Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Modifying height property of DW column object at runtime 1

Status
Not open for further replies.

girls3dog1

Programmer
Nov 22, 2002
30
US
I'd like to dynamically modify the height of a column datawindow object as function of the string length for the data in that column. I want to minimize white space in the datawindow because row data may have 1 character in this column and the next row may have 150 characters or more for the same column. Yes, I can fix the column object height for the worst case, but presentation-wise this would look unappealing to the user.

I've been playing with the code below, but I'm wondering if there's a more elegant method to detect when I've reached or exceeded the column width with text.

long ll_row_count, ll_description
integer i
ll_row_count = dw_datasheet_note.rowcount()

If ll_row_count < 1 then return

For i = 1 to ll_row_count

ll_description = len(dw_datasheet_note.getitemstring(i,&quot;tbl_notes_general_description&quot;))

Choose case ll_description

Case is > 91
dw_datasheet_note.object.tbl_notes_general_description.height = 284

Case is > 61
dw_datasheet_note.object.tbl_notes_general_description.height = 228

Case is > 31
dw_datasheet_note.object.tbl_notes_general_description.height = 152

Case is < 30
dw_datasheet_note.object.tbl_notes_general_description.height = 76

End Choose

Next

 
Girls3Dog1,

There is a MORE graceful way to do what you are trying to achieve:

1. Go to DetailBand->Properties and set the AutoSizeHeight to TRUE (RMB click on the detail-band).

2. Go to the Column->Properties->Position tab and set the AutoSizeHeight to TRUE.

That should work automatically without any code.

---
PowerObject!
-----------------------------------------
PowerBuilder / PFC Developers' Group
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top