Print Page | Close Window

Feature Request? Multiline issue

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Property Grid
Forum Description: Topics Related to Codejock Property Grid
URL: http://forum.codejock.com/forum_posts.asp?TID=6540
Printed Date: 25 April 2024 at 6:59pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Feature Request? Multiline issue
Posted By: sbarkeruk
Subject: Feature Request? Multiline issue
Date Posted: 01 March 2007 at 11:06am
I am trying to setup a multiline string property item.
 
I have already acheived this withthe use of the following (example) code:
 
wndPropertyGrid.VariableItemsHeight = True
Item.EditStyle = EditStyleMultiLine
Item.MultiLinesCount = 4
 
However, when I edit I may want to add more than or less than the 4 lines specified here!
 
So is there a way of setting an 'autosize' or similar so that the height adjusts to the text size (or number of carriage returns) after the AfterEdit event?
 
If not then could I request this please, as it seems that a few people have been trying to do this (looking at older postings).
 
Simon



Replies:
Posted By: sbarkeruk
Date Posted: 01 March 2007 at 11:13am
p.s. I have also read the Adding Multi-Line items tutorial, but there is still no option for autosizing. After editing to a smaller or larger text output, the row then does not look too good!


Posted By: Zach
Date Posted: 15 May 2007 at 5:23am
When it gets focus... freeze the property grid... grab the current value... destroy that item.
 
Add back in the same place an item that is a few lines bigger than they currently have.
 
Use a Mono font
 
After its been edited run another function that you would also run if the text area's width was changed through a resize.
 
Get the current width of the text area.
 
Do the math... how many characters can fit in each line... run through the value .. you can not do simple division - you got to figure out each ... break it, then back track to the first space or other character that it would word wrap on... take the remainder... repeat until none is left.
 
You now know how many lines there is.... grab the value... destroy the control... add a new one in its place at the size you want.
 
 
Not as difficult as it sounds :) ... I have not done this here ... but it should work.  I have on the other hand done it with a textbox in html to make an html textbox with line numbering that handled wordwrap without a problem.
 
(Honestly takes less than 10 lines of code.. probably more like 5)
 
When all done... unfreeze the propertygrid... the end user will notice nothing other than the textarea is the size of their text.



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