MariusN Posted February 11, 2010 Share Posted February 11, 2010 last q for today...If you look at the below code Func _message() $font = "Times New Roman" GUICreate("Timer Settings", 330, 100) GUICtrlCreateLabel("Timer set to an interval of", 10, 30, 210) GUICtrlSetFont(-1, 14, 800, 0, $font) GUICtrlCreateLabel($input, 220, 30, -1) GUICtrlSetFont(-1, 14, 800, 0, $font) GUICtrlSetColor(-1, 0x3333FF) $string = StringLen ($input) $total = 240+$string ; <-----the string will be 2 digits MsgBox(0,"",$total);<--- this actually SHOWS 242 GUICtrlCreateLabel("seconds", $total, 30, 60);<---but it doesnt get added here GUICtrlSetFont(-1, 14, 800, 0, $font) GUISetState() While 1 Sleep(2000) ExitLoop WEnd GUIDelete() EndFunc The $total (left align of "seconds") doesnt accept 242 as an input, but 240 instead... What am i doing wrong here? thanks guys... Link to comment Share on other sites More sharing options...
PsaltyDS Posted February 11, 2010 Share Posted February 11, 2010 Where is the value of $input set and what is it set to? Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
enaiman Posted February 12, 2010 Share Posted February 12, 2010 GUICtrlCreateLabel("seconds", $total, 30, 60, 90) Just specify the width of the label and it will be OK; the text simply couldn't fit in the default dimensions. SNMP_UDF ... for SNMPv1 and v2c so far, GetBulk and a new example script wannabe "Unbeatable" Tic-Tac-Toe Paper-Scissor-Rock ... try to beat it anyway :) Link to comment Share on other sites More sharing options...
MariusN Posted February 12, 2010 Author Share Posted February 12, 2010 (edited) I FOUND MY PROB...IM A D**K...LOL I just found out that 1 digit is about = 5 which means I must add 240+($string*6) Edited February 12, 2010 by MariusN Link to comment Share on other sites More sharing options...
enaiman Posted February 12, 2010 Share Posted February 12, 2010 I guess you're lacking sleep I don't have your "input" box but have a look at how I tested your script: $font = "Times New Roman" GUICreate("Timer Settings", 400, 150) GUICtrlCreateLabel("Timer set to an interval of", 10, 30, 210) $string = StringLen ("qwjkjksdfsdffhjksdfhsjdfdsfksdfsdfdsdffffffffdfsfdsfds") $total = 240+$string ; GUICtrlSetFont(-1, 14, 800, 0, $font) GUICtrlCreateLabel($total, 220, 30, 30) GUICtrlSetFont(-1, 14, 800, 0, $font) GUICtrlSetColor(-1, 0x3333FF) GUICtrlCreateLabel(" seconds", $total, 30, 90);<---but it doesnt get added here GUICtrlSetFont(-1, 14, 800, 0, $font) GUISetState() While 1 Sleep(2000) ExitLoop WEnd Just play with the string length and you'll see that the label moves accordingly. SNMP_UDF ... for SNMPv1 and v2c so far, GetBulk and a new example script wannabe "Unbeatable" Tic-Tac-Toe Paper-Scissor-Rock ... try to beat it anyway :) Link to comment Share on other sites More sharing options...
AdmiralAlkex Posted February 12, 2010 Share Posted February 12, 2010 Did you even try your own code? The input goes exactly where you tell it to, there's no problem here. $GUI = GUICreate("Timer Settings", 330, 100) $total = 240+StringLen ("12") ; <-----the string will be 2 digits $Label = GUICtrlCreateLabel("seconds", $total, 30, 60);<---but it doesnt get added here $array = ControlGetPos($GUI, "", $Label) ConsoleWrite($array[0] & @CRLF) For the future, please post a working (runnable), and short reproducer. People don't like to wade through unnessary code, or write the basics just to see the problem. As a bonus, there is also a high chance that you find the answer to your question when writing the reproducer. .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...
MariusN Posted February 12, 2010 Author Share Posted February 12, 2010 Did you even try your own code? The input goes exactly where you tell it to, there's no problem here. $GUI = GUICreate("Timer Settings", 330, 100) $total = 240+StringLen ("12") ; <-----the string will be 2 digits $Label = GUICtrlCreateLabel("seconds", $total, 30, 60);<---but it doesnt get added here $array = ControlGetPos($GUI, "", $Label) ConsoleWrite($array[0] & @CRLF) For the future, please post a working (runnable), and short reproducer. People don't like to wade through unnessary code, or write the basics just to see the problem. As a bonus, there is also a high chance that you find the answer to your question when writing the reproducer. Yep...my OWN code *-proud-* this made it for me ---> $total = 230+($string*8) ...due to the font size etc, the "8" works 100% Thanks for all the help and effort from you guys...much appreciated Link to comment Share on other sites More sharing options...
MariusN Posted February 12, 2010 Author Share Posted February 12, 2010 I guess you're lacking sleep I don't have your "input" box but have a look at how I tested your script: $font = "Times New Roman" GUICreate("Timer Settings", 400, 150) GUICtrlCreateLabel("Timer set to an interval of", 10, 30, 210) $string = StringLen ("qwjkjksdfsdffhjksdfhsjdfdsfksdfsdfdsdffffffffdfsfdsfds") $total = 240+$string ; GUICtrlSetFont(-1, 14, 800, 0, $font) GUICtrlCreateLabel($total, 220, 30, 30) GUICtrlSetFont(-1, 14, 800, 0, $font) GUICtrlSetColor(-1, 0x3333FF) GUICtrlCreateLabel(" seconds", $total, 30, 90);<---but it doesnt get added here GUICtrlSetFont(-1, 14, 800, 0, $font) GUISetState() While 1 Sleep(2000) ExitLoop WEnd Just play with the string length and you'll see that the label moves accordingly. ...talking about sleep...I just woke up...maybe that's the trick 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