Solved Comment / activity form resize comment box

Gaztry80

Member
Local time
Today, 18:51
Joined
Aug 13, 2022
Messages
62
Hi again,
I have this problem with my comment form, where I want to autoresize the comment field to save some space when it is not used.
What I found in a couple of threads is that this is probably not possible, since it is only possible within a report.
Some sources I found:

Not possible: https://www.access-programmers.co.uk/forums/threads/can-grow-not-working.101883/
Shows what I want to establish but then in a report:

My current Comment Form looks like this:

image.png


Does somebody has an idea/example where it is possible to auto resize these fields in the Form?
Thank you :)!
 
The problem with auto-resizing is that in form context, there is no simple way to compute the physical size requirements of a given text string without some serious gyrations. There is a built-in Excel subroutine that can do the computation, and there is a way for reports to do it, but there is no such ability for forms (that I have ever found... and believe me, I've looked.) You can take the all-or-nothing approach, perhaps, but here is the big question... other than possible aesthetics, why do you care? (That is not an off-handed question.)

In reports, the "can grow" property changes the height of a section - usually a Detail section. What happens in such cases is that the section ALWAYS expands to match the tallest control within it. So if you shrink one text box, the next-longest text box takes over to define the length of a section. The form, if you could implement a "can grow" option, would do the same thing. Remember, in form and report sections, you measure from the top and left, so the control with the lowest bottom line or right-most right line will limit any reduction of the form's dimensions.

You CAN reset the .Height of a textbox at run-time. Just load a new .Height value (in twips). But if you try to reset the .Height of the display area of the form (the Detail section), again you cannot reset the height of the section to any height that would overlap the lowest control. Unlike a report, which can have multiple detail sections, a form can only have one detail section. There is nothing below it. Therefore the question would come into play as to what you were going to do with the space you vacated by shrinking the section. You certain CAN do things to move around controls at run time. That much IS possible. If you wanted to make room for another form, sure. That could work. But when the text box is occupied, you can't do that so easily.

So my question is, what were you going to do with the extra real estate?
 
Hi. There is no way to have varying sizes for the same control in a continuous form. Anchoring could resize a control, but it doesn't do it based on the content but on the size of the screen. If you're pressed for screen real estate, you might consider using a Zoom Box or a Popup Form to display the entire contents of the the Comment field.
 
assuming you do not want to edit previous comments you could have a single form where users can enter a new comment and include a sub report to display previous messages with the can grow/shrink properties set to yes

with the single form you could perhaps include code to ‘expand as you type’ and include options to amend or delete previous comments if that is a requirement
 
Thanks guys for thinking with this problem. I now choosed to go for this method.

image2.png
 

Users who are viewing this thread

Back
Top Bottom