[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 965
  • Last Modified:

keep label same height as text box when growing or shrinking

How can I keep a label (or text box), that's on the same row, the same height as a text box on the same row that can grow or shrink? The text box's content can change, but the label either has a single character or is empty (tried using a text box instead of label with formula similar to the text box that is growing/shrinking).

This must happen a lot....and thanks for looking
0
avoorheis
Asked:
avoorheis
1 Solution
 
GRayLCommented:
Text boxes grow and shrink to accomodate text at a given font and size.  The text in the caption of a label is similarly configured with a font and a size.  If the text box now grows to accomodate more text do you mean you want the size of the font as well as the size of the label to grow accordingly?  For a text box that has grown to 4 lines you now want the label text to be 4 times as high as it was when the textbox was only one line.  Form space is valuable real estate and I can see too much of it being eaten up by oversized labels.  In addition as the text height grows so does it's horizontal size.  Do you have that much room to the left of the textbox to allow a label to grow to 4 times its original size?  Why not put the lable above the textbox for those controls which will grow and save the left aligned labels for the single rowed textboxes. Just my 2¢.  
0
 
avoorheisAuthor Commented:
The text box is almost the width of the report, except for the label, which is just to the left of it. Right now I have a dash "-" in the label, which would be good to have centered, but, at least want the border of the label to match the height of the textbox. The size of the font in the textbox stays the same, just the data changes (more/fewer lines, or shrinks completely if nothing).

I'd really like to have a square bullet centered to the left of the text box, just haven't gotten that far yet, and may just settle for a dash alongside the first line of the text box.
0
 
clarkscottCommented:
me.YourLableName.height = me.YourTextField.height

Scott C
0
The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

 
JimFiveCommented:
In the OnFormat event of the detail section set the height of the label = height of the textbox.
--
JimFive
0
 
avoorheisAuthor Commented:
thanks for the vb solutions, although I was hoping to stay away from that as this will be a fairly complex report with possibly up to 6k records, so, just trying to eliminate as much overhead as possible. But, it seems there may not be a simple solution.
0
 
GRayLCommented:
I have a fairly straightforward solution with the 'bullet' but I am occupied for the rest of the day.  I'll check in tomorrow and if the question is still open, I'll post then.  Thanks,

Ray
0
 
GRayLCommented:
   <-- I created a small label just to the left of a single line textbox the same height as the textbox.  My Font for the report was Arial so I used the Windows Character Map to find the Arial 'Black Square' symbol and pasted it in the Caption property of the label, as you see at the beginning of this post.    Now when the report runs, you at least have a square bullet at the top of and to the left of your multi-line text boxes.  I am still trying to figure how to use the retreat event of the Detail section to allow positioning of the 'Top' property of the label to somewhat less than half the height of the textbox after it has been populated, but before it is actually printed or in preview.
0
 
GRayLCommented:
In the edit panel of this post I had pasted the 'Black Square", and now I see it disappears when one clicks 'Submit'.  Anyway, the 'Black Square' exists and can be pasted to the Caption property.  BTW I have a test table with a single memo field containing both a 12 line text sample and a two line text sample.  The form has the label and a single-line textbox side by side and the textbox extends across the page.  When I run the form, there is the black square lined up with the top line of text.  I've spent several hours now trying to move it down by adjusting the Label0.Top property so it will appear half way down the text for both records - at run time.  There's the trick laddie!
0
 
avoorheisAuthor Commented:
Thanks for taking on the challange Ray. I was thinking this would have been a pretty standard requirement, but, aparently not. Too bad there isn't a vertical centering option for text boxes and labels.
0
 
GRayLCommented:
Well that ruined my weekend, but here's what I found.  From the Detail_Print Event you can use the Line method to draw a line or a portion thereof down the left side of the textbox using Me!Text0.Top and Me!Text0.Height as references for creating the line.  In addition you would have to describe the line thickness and how far from the left side of the Detail you wanted it.  I could not find any way to determine the height of the testbox in Detail_Print, and then backup to Detail_Format and make the changes to the Label there.  As I found out, one cannot make any formatting changes to any control once the Detail_Print event has occurred.  Maybe there is a way to use Detail_Retreat to do that but it's beyond me.  
0
 
avoorheisAuthor Commented:
Thanks for all you work Ray, I'll play around with it and see what I can do. Good to know.
0
 
GRayLCommented:
I did find out that in both the Detail_Print, and Form_Page events you can 'add' items like lines and circles to the page.  Thus in the Detail_print event, where you are looking at the detail for a given record, you can use the Line method to draw lines and rectangles.  You could then put a solid bar down the left side of a variable sized textbox in the Detail_Print event using Me.Text0.Left, Me.Text0.Top, and Me.Text0.Height  as references for the line method.  Seem like a plan?
0
 
GRayLCommented:
Looks like I did not see my prevous post;-)  Thanks and good luck with the project.
0

Featured Post

The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now