On_fire Posted August 1, 2007 Posted August 1, 2007 I have a read-only edit control and I need to determine if all of the text in it is visible. Is this possible, and if not could it be done with another control or without being read-only?
lod3n Posted August 1, 2007 Posted August 1, 2007 Maybe use a fixed width font, and find out how many characters your edit control can display. Then count the number of characters you are displaying. If $count <= $max, then all of the text is visible. [font="Fixedsys"][list][*]All of my AutoIt Example Scripts[*]http://saneasylum.com[/list][/font]
On_fire Posted August 1, 2007 Author Posted August 1, 2007 (edited) Thanks for the help. I couldn't figure out how to find out how many characters it could display, so I made a block of text the right size, and checked how many lines there were. Here is the function I was working on, it changes the font size to the maximum that will display all the rows and columns specified. Please post any suggestions you have. Note: This does require the box to be read-only to work. EDIT: Wording and removed some old code. Func resize( $editBox, $cols, $rows ) $oldText = GUICtrlRead ( $editBox ) $testData = _StringRepeat ( " ", $cols) $testData = $testData & _StringRepeat ( @CRLF &_StringRepeat ( " ", $cols ), $rows -1) GUICtrlSetData ( $editBox, $testData ) Do increaseFontSize ( ) Until _GUICtrlEditGetLineCount ( $editBox ) <> $rows Do decreaseFontSize ( ) Until _GUICtrlEditGetLineCount ( $editBox ) = $rows GUICtrlSetData ( $editBox, $oldText ) EndFunc Edited August 1, 2007 by On_fire
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now