AustrianOak Posted June 4, 2008 Share Posted June 4, 2008 is there a function for this? i want to measure how long it is so i can make the right size label for it... Link to comment Share on other sites More sharing options...
smashly Posted June 4, 2008 Share Posted June 4, 2008 (edited) measure stringOrAutoIt Help file under User Defined Functions -> WinAPI Management -> _WinAPI_GetTextExtentPoint32() Edited June 4, 2008 by smashly Link to comment Share on other sites More sharing options...
AustrianOak Posted June 4, 2008 Author Share Posted June 4, 2008 the label gets cut off if i make it to long heres what im doing: $datalabel = GUICtrlRead($input) $leng = _MeasureString($datalabel, $Arial, 12) $newlabel = GUICtrlCreateLabel($datalabel, 24, 470, $leng, 20) GUISetState(-1, $GUI_ONTOP) GUICtrlSetState($newlabel, $GUI_SHOW) now im not sure if the font is arial 12 because i didnt specify it. its just the font that comes when you type into any regular input. my input i think is 100 by 20 if that'll make any difference... Link to comment Share on other sites More sharing options...
smashly Posted June 4, 2008 Share Posted June 4, 2008 (edited) default font size for Autoit gui/controls will be 8.5 Also if your using the measure string function I wrote then the way you have it it's returning an array, $leng = _MeasureString($datalabel, "Arial", 8.5) $leng[0] = Width of the string $leng[1] = Height of the string you can return just the width or height $leng = _MeasureString($datalabel, "Arial", 8.5, -1, -1, -1, 0) $leng = Width of the string $leng = _MeasureString($datalabel, "Arial", 8.5, -1, -1, -1, 1) $leng = Height of the string Edited June 4, 2008 by smashly Link to comment Share on other sites More sharing options...
AustrianOak Posted June 4, 2008 Author Share Posted June 4, 2008 ok, i changed my code to 8.5 like this: $datalabel = GUICtrlRead($input) $leng = _MeasureString($datalabel, $Arial, 8.5) $newlabel = GUICtrlCreateLabel($datalabel, 24, 470, $leng, 20) GUISetState(-1, $GUI_ONTOP) GUICtrlSetState($newlabel, $GUI_SHOW) but it still didnt change anything. the label text is still getting cut off... Link to comment Share on other sites More sharing options...
smashly Posted June 4, 2008 Share Posted June 4, 2008 (edited) Look up and read my edited post..The way your using the measurestring function it's returning an array$leng = _MeasureString($datalabel, $Arial, 8.5)$newlabel = GUICtrlCreateLabel($datalabel, 24, 470, $leng[0], 20) Edited June 4, 2008 by smashly Link to comment Share on other sites More sharing options...
AustrianOak Posted June 4, 2008 Author Share Posted June 4, 2008 awesome. great function man thanks a bunch. Link to comment Share on other sites More sharing options...
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