Sign in to follow this  
Followers 0
On_fire

Determining if text is visible.

3 posts in this topic

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?

Share this post


Link to post
Share on other sites



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]

Share this post


Link to post
Share on other sites

#3 ·  Posted (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 by On_fire

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0