Posted 17 November 2019, 8:01 pm EST
Hello,
In detail section I have number of rows of fields that look like a table,if some of the fields grows - how can I make all the other fields from the same row grow too?test.zip
Forums Home / ComponentOne / WinForms Edition
Posted by: mary431982 on 17 November 2019, 8:01 pm EST
Posted 17 November 2019, 8:01 pm EST
Hello,
In detail section I have number of rows of fields that look like a table,if some of the fields grows - how can I make all the other fields from the same row grow too?test.zip
Posted 18 November 2019, 8:50 pm EST
Hello,
I have modified your report to use CalculateSize method of the section and then set the height of Field1 and Field3, based on the rendered height of Field2. This is done in the Detail.OnFormat script, as follows:
Detail.CalculateSize()
Field1.Height= Field2.RenderHeight
Field3.Height=Field2.RenderHeight
Regards,
Esha
test_modified.zip
Posted 18 November 2019, 11:52 pm EST
Ok, I get it, thank you,
but how would it look like in general case?
How would the code look like in the case of:
Thanx
Posted 19 November 2019, 4:41 pm EST
Hello,
This would require manually comparing RenderHeight value for all the fields and then assigning the maximum height value to those fields.
Thanks,
Esha
test_new.zip
Posted 19 November 2019, 7:49 pm EST
Thanx,
Though, I was hoping for a more elegant solution, for example For loop for all N fields…I have more than 30 fields and I didn’t want to write few lines for all 30 fields…
I wanted to use For loop or smth as elegant as that.
Posted 19 November 2019, 9:32 pm EST
Hello,
Yes, this is possible as well. It’s another way of comparing field values using VB Script for the purpose:
Detail.CalculateSize()
Dim maxheight=0
For i=0 to 4
For j=0 to 4
If Report.Fields(i).RenderHeight > Report.Fields(j).RenderHeight Then
maxheight=Report.Fields(i).RenderHeight
Else
maxheight=Report.Fields(j).RenderHeight
EndIf
Next
Next
For i=0 to 4
Report.Fields(i).Height=maxheight
Next
Regards.
Posted 19 November 2019, 11:06 pm EST
Ok, thank you very much. That is what I wanted!!!