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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Resizing control on runtime

Status
Not open for further replies.

caster

Programmer
Jan 3, 2003
32
IN
Hi all;
My actuate server is on the UNIX enviornment.
I want to change the height of a specific control during runtime depending upon the length of the data that will be displayed in that control.
What I am looking for is some kind of flag or any other technique Actuate will be following internally to check the word wrap.Another option is to GET THE SIZE OF THE STRING THAT WILL BE DISPLAYED IN TWIPS OR INCHES.Any suggestion on this?
I have written a logic by my self which will check number of characters in the string and ASSUMING the total number of characters that can fit in the control,change the height.But I want to make it generic.
NOTE : GetDisplayHeight wont work with UNIX

Will really appriciate your help
 
You must not be using version 6, because this became standard behaviour in that version. It's not overly complicated to grow a control dynmaincally.

Create a global variable like gGrowContrtol. In the control to grow's OnRow() method, declare a variable to hold the length of the data, such as MyLen.

Dim MyLen As Integer

'***********************************************************
'* The length of data for this variable can vary extensively. Since there is not
'* much room, it can become necessary to expand the control. Based on the lenth of
'* data is how much the control must grow.
'*************************************************************************************
MyLen = Len(me.DataValue)

If MyLen > 18 And MyLen < 37 Then
gGrowControl = &quot;two&quot; 'number of lines needed
ElseIf MyLen > 36 And MyLen < 55 Then
gGrowControl = &quot;three&quot;
ElseIf MyLen > 54 Then
gGrowControl = &quot;four&quot;
End If

Select Case gGrowControl
Case &quot;two&quot;
ME.size.height = 720 '.50*1440 twips per inch
Case &quot;three&quot;
ME.size.height = 1080 ' .75 * 1440 twips per inch
Case &quot;four&quot;
ME.size.height = 1440
End Select

End Sub

You also need to expand the frame, so in the frame's AdjustSize() method:

Select Case gGrowControl
Case &quot;two&quot;
ME.size.height = 720 ' .50 * 1440 twips per inch
Case &quot;three&quot;
ME.size.height = 1080 ' .75 * 1440 twips per inch
Case &quot;four&quot;
ME.size.height = 1440
End Select


And finally, in the control to grow's Finish() method, I rese the global just the next control doesn't need to grow:

gGrowControl = &quot;&quot;


Oh, and you need to set the control's TextPlacement.Multiline to TRUE.

This was used for improper sentence strings; so there weren't necessarily spaces, periods, commas, etc. If you need more along that line, ,let me know; I might have an old example somewhere, but if so it wouldn't have any documentation, and I've not used it!


Good luck!

Bill
bcaslow@hotmail.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top