Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > ActiveX COM > Property Grid
  New Posts New Posts RSS Feed - Feature Request? Multiline issue
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Feature Request? Multiline issue

 Post Reply Post Reply
Author
Message Reverse Sort Order
Zach View Drop Down
Groupie
Groupie


Joined: 19 July 2006
Status: Offline
Points: 62
Post Options Post Options   Thanks (0) Thanks(0)   Quote Zach Quote  Post ReplyReply Direct Link To This Post Topic: Feature Request? Multiline issue
    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.
Back to Top
sbarkeruk View Drop Down
Newbie
Newbie
Avatar

Joined: 01 March 2007
Location: United Kingdom
Status: Offline
Points: 2
Post Options Post Options   Thanks (0) Thanks(0)   Quote sbarkeruk Quote  Post ReplyReply Direct Link To This Post 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!
Back to Top
sbarkeruk View Drop Down
Newbie
Newbie
Avatar

Joined: 01 March 2007
Location: United Kingdom
Status: Offline
Points: 2
Post Options Post Options   Thanks (0) Thanks(0)   Quote sbarkeruk Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.141 seconds.