Print Page | Close Window

BUG? Label with .Autosize and .Wordwrap

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Controls
Forum Description: Topics Related to Codejock Controls
URL: http://forum.codejock.com/forum_posts.asp?TID=18425
Printed Date: 02 June 2024 at 1:26am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: BUG? Label with .Autosize and .Wordwrap
Posted By: SeungMina
Subject: BUG? Label with .Autosize and .Wordwrap
Date Posted: 23 May 2011 at 7:07am
I am using the CodeJock label control with VB6.

With the VB6 intrinsic Label control, I can set a fixed Width so that when Autosize and Wordwrap are set, the control ONLY grows or shrinks VERTICALLY according to the Caption text.

I need the same functionality from the CodeJock Label control, but I can't get it to work.

Setting Autosize and Wordwrap on the CodeJock control results in unpredictable Width and Height of the control when the Caption is changed repeatedly.

This can result in large areas of empty space, and it looks terrible, if any other controls are dynamically repositioned according to changes in the Label's Height (ie. changes to the word-wrapped Caption)

Is this a bug? Or is there a way to make the CJ Label have a fixed width, and only grow/shrink vertically according to the word-wrapping of the Caption?



Replies:
Posted By: SeungMina
Date Posted: 31 May 2011 at 6:11am
CJ support gave me this workaround:

Label.AutoSize = False
Label.Width=<desired width>
Label.Caption=<new text>
Label.AutoSize = True

This works, although it didn't seem 100% successful unless I reset label height to a single line  (as well as resetting width), before setting a new label caption.

I still consider this a bug though. I expect word-wrapping to behave like a word processor. You expect text in a word processor to wrap at the edge of a page/column ie. at the page/column width that YOU set. Word-wrapped text expands downwards and pages are added/removed depending on the height of the word-wrapped text.

Imagine if your word processor ignored your page/column widths and randomly chose its own position where word-wrapping occurs. CHAOS.

A label with both word wrap and autosize, should not change its width (the place where word-wrapping occurs). And it should only resize vertically, to reveal text that has wrapped, or hide empty lines. Just like a word-processor. And this is exactly what the intrinsic VB6 label control does.

My suggestion is to add a new property to the FlatEdit eg. AutoSizeVerticalOnly. This could default to False, so that any existing applications would be unaffected - but when enabled it would override current AutoSize and deliver the above behaviour.



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net