snow_leopard Posted July 29, 2019 Share Posted July 29, 2019 I have a simple GUI label that take a variable length of strings and creates a number of UI panels to display those strings. The problem I am having is that the hardcoded spacing causes long strings to overflow and short string to fit improperly. Is there a way to center GUI labels? For learning purposes I am trying to avoid any UDFs and would like to do everything myself. Link to comment Share on other sites More sharing options...
Subz Posted July 29, 2019 Share Posted July 29, 2019 Look at $SS_CENTER and $SS_CENTERIMAGE in the helpfile for centering however although you want to avoid udfs which doesn't really make much sense to me, I would highly recommend StringSize udf by Melba23, since it can work out the exact size of a label based upon font size, weight etc... My 2 cents. Link to comment Share on other sites More sharing options...
BigDaddyO Posted July 29, 2019 Share Posted July 29, 2019 you can also force the font on your gui to something specific so you can guarantee the text you hard code will fit in the fields since other users can have some pretty wild fonts. I usually only do this on really complicated gui's. GUISetFont(8.5, 400, 0, "Consolas", $hGUI, 5) Link to comment Share on other sites More sharing options...
Zedna Posted July 29, 2019 Share Posted July 29, 2019 Set width of your label to the same value as width of your GUI form and set label's style to SS_CENTER. Skysnake 1 Resources UDF ResourcesEx UDF AutoIt Forum Search 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