sharrakor Posted February 3, 2009 Share Posted February 3, 2009 I was trying to pass a variable into a gui label, but i couldn't figure out how to get it to work. I tried: guictrlcreatelabel("You've completed "$variable"runs.",50,50,100,50,$ss_center) This code doesn't work though, and apparently I'm using the $ss_center command incorrectly, because it is basing the location of the label on my X corrdinate. What would be the best approach to making a centered statement in a gui window? Link to comment Share on other sites More sharing options...
AdmiralAlkex Posted February 3, 2009 Share Posted February 3, 2009 To mix variables and text you have to concatenate the text with an ampersand "You've completed " & $variable & "runs." If you want the label to be centered on both the horizontal AND vertical plane use BitOR($SS_CENTER, $SS_CENTERIMAGE) .Some of my scripts: ShiftER, Codec-Control, Resolution switcher for HTC ShiftSome of my UDFs: SDL UDF, SetDefaultDllDirectories, Converting GDI+ Bitmap/Image to SDL Surface Link to comment Share on other sites More sharing options...
sharrakor Posted February 3, 2009 Author Share Posted February 3, 2009 Thanks a lot. Making my first GUI was a little harder than it had to be apparently! Link to comment Share on other sites More sharing options...
Zedna Posted February 3, 2009 Share Posted February 3, 2009 Thanks a lot. Making my first GUI was a little harder than it had to be apparently!Look at Koda GUI form designerhttp://www.autoitscript.com/forum/index.php?showtopic=32299There you can easily set SS_CENTER style and generate code, so you will see correct syntax generated ... Resources UDF Â ResourcesEx UDF Â AutoIt Forum Search Link to comment Share on other sites More sharing options...
sharrakor Posted February 3, 2009 Author Share Posted February 3, 2009 Ok, that didn't work exactly as I expected. What I mean is, if I have: guicreate("About",300,300) guisetstate(@sw_show) guictrlcreatelabel("You've completed " & $variable & "runs.",100,25,100,25,$SS_CENTER) I want my label to be perfectly centered, regardless of how many digits $variable is. I only want to specify the Y coordinate; the script should decide what the starting X coordinate is. Is there any way to do this? Link to comment Share on other sites More sharing options...
AdmiralAlkex Posted February 3, 2009 Share Posted February 3, 2009 You would do that like this: guicreate("About",300,300) guisetstate(@sw_show) guictrlcreatelabel("You've completed " & $variable & "runs.",0,25,300,25,$SS_CENTER) .Some of my scripts: ShiftER, Codec-Control, Resolution switcher for HTC ShiftSome of my UDFs: SDL UDF, SetDefaultDllDirectories, Converting GDI+ Bitmap/Image to SDL Surface Link to comment Share on other sites More sharing options...
sharrakor Posted February 3, 2009 Author Share Posted February 3, 2009 Thanks to both of you. Nice program, and also nice to know how to do it manually. Link to comment Share on other sites More sharing options...
EndFunc Posted February 4, 2009 Share Posted February 4, 2009 You would do that like this: guicreate("About",300,300) guisetstate(@sw_show) guictrlcreatelabel("You've completed " & $variable & "runs.",0,25,300,25,$SS_CENTER) Ever since upgrading to 3.3.0 it tells me that the $SS_CENTER has been used before being declared and stops the script. It worked fine before. Anyone no what's the deal? EndFuncAutoIt is the shiznit. I love it. Link to comment Share on other sites More sharing options...
jvanegmond Posted February 4, 2009 Share Posted February 4, 2009 Ever since upgrading to 3.3.0 it tells me that the $SS_CENTER has been used before being declared and stops the script. It worked fine before. Anyone no what's the deal?$SS_CENTER is now defined in WindowsConstants.au3:#include <WindowsConstants.au3> github.com/jvanegmond Link to comment Share on other sites More sharing options...
EndFunc Posted February 4, 2009 Share Posted February 4, 2009 $SS_CENTER is now defined in WindowsConstants.au3:#include <WindowsConstants.au3>Thanks but its still not working. I added the include but continue to have the errors.WARNING: $ES_CENTER: possibly used before declaration.WARNING: $BS_FLAT: possibly used before declaration. WARNING: $CBS_DROPDOWNLIST: possibly used before declaration.Anything else I can do? EndFuncAutoIt is the shiznit. I love it. Link to comment Share on other sites More sharing options...
sharrakor Posted February 4, 2009 Author Share Posted February 4, 2009 Endfunc, try #Include <GuiEdit.au3> Link to comment Share on other sites More sharing options...
EndFunc Posted February 4, 2009 Share Posted February 4, 2009 Endfunc, try #Include <GuiEdit.au3> Well it decreased my warning to 4 but still have some. WARNING: $SS_CENTER: possibly used before declaration. These are my includes. #include <GUIConstants.au3> #include <constants.au3> #include "File.au3" #include "GuiTab.au3" #include "INet.au3" #include "IE.au3" #include "String.au3" #Include <Array.au3> #include <CompInfo.au3> #include <WindowsConstants.au3> #Include <GuiEdit.au3> EndFuncAutoIt is the shiznit. I love it. Link to comment Share on other sites More sharing options...
EndFunc Posted February 4, 2009 Share Posted February 4, 2009 Well it decreased my warning to 4 but still have some. WARNING: $SS_CENTER: possibly used before declaration.These are my includes.#include <GUIConstants.au3>#include <constants.au3>#include "File.au3"#include "GuiTab.au3"#include "INet.au3"#include "IE.au3"#include "String.au3"#Include <Array.au3>#include <CompInfo.au3>#include <WindowsConstants.au3>#Include <GuiEdit.au3>Wow after reading this,http://www.autoitscript.com/forum/index.php?showtopic=88948The includes are all changed now. Completely hosed alot of things if you want to use that version. Now I have to try and figure out what needs to be replaced.Fixed it with this #include <StaticConstants.au3>Must be new. EndFuncAutoIt is the shiznit. I love it. 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