Formatting rectangle

G

Guest

I have a report that has text boxes within rectangle objects. The text boxes
have the can grow property set to true. I want the rectangles to grow with
the text boxes. This is the code I came up with, but the rectangles do not
change. When it is stepped through with the debugger it seems to be all
good, but they don't change. I can't find a me.refresh or me.redraw or
anything in the rectangle methods. Am I missing something?

DefectDescription and RootCause are the textboxes.
The original height is set to 1800.

If Me.DefectDescription.Properties("Height") <> 1800 Then
Me.boxDefectDescription.Properties("Height") =
Me.boxDefectDescription.Properties("Height") +
(Me.DefectDescription.Properties("Height") - 1800)
End If

If Me.RootCause.Properties("Height") <> 1800 Then
Me.boxRootCorrective.Properties("Height") =
Me.boxRootCorrective.Properties("Height") +
(Me.boxRootCorrective.Properties("Height") - 1800)
End If
 
S

Steve Schapel

Jason,

I don't think the Height property of a textbox is altered if it "grows"
at runtime via the CanGrow process.

Doesn't it suit your purposes to show the border of the textboxes?

You might need to use the Line method to draw the rectangles. There is
some information here that might help...
http://www.lebans.com/PrintLines.htm
 
A

AlCamp

Jason,
I waited to see how others might respond to your question.
I agree with Steve in that the Height setting (at runtime) probably
doesn't reflect the "Grow" height. And... since it's always 1800 when you
apply your IF... the code never runs.

But... more importantly... you do appear to be "reinventing the wheel"
here. If you use the text control's own border property it will
"automagically" grow/shrink the border with the length of the text it
contains. No need to go through all this coding at all.
hth
Al Camp
 
M

Marshall Barton

JasonT said:
I have a report that has text boxes within rectangle objects. The text boxes
have the can grow property set to true. I want the rectangles to grow with
the text boxes. This is the code I came up with, but the rectangles do not
change. When it is stepped through with the debugger it seems to be all
good, but they don't change. I can't find a me.refresh or me.redraw or
anything in the rectangle methods. Am I missing something?

DefectDescription and RootCause are the textboxes.
The original height is set to 1800.

If Me.DefectDescription.Properties("Height") <> 1800 Then
Me.boxDefectDescription.Properties("Height") =
Me.boxDefectDescription.Properties("Height") +
(Me.DefectDescription.Properties("Height") - 1800)
End If

If Me.RootCause.Properties("Height") <> 1800 Then
Me.boxRootCorrective.Properties("Height") =
Me.boxRootCorrective.Properties("Height") +
(Me.boxRootCorrective.Properties("Height") - 1800)
End If


A serious issue with your approach is that the text box
CanGrow Height is not available in the section's Format
event. While it is available in the Print event, it is too
late to change the Height property of the rectangle
controls. Kind of a catch22.

However, instead of using rectangle controls, you can use
code in the Print event to draw rectangles using the
report's Line method.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top