anixon Posted June 13, 2008 Posted June 13, 2008 (edited) I am using this code to put up a centred message box. The $Message [text] can varying in the number of characters. At the moment the width of the text box is set to "320" which on many occasions can be two wide for the amount of text that has to be displayed [currently set to the maximum box size required]. Based on the number of characters =stringlen($message) and the font [times new roman - 10] how do you calculate what the text box width should be to display each message based on those conditions? CODEFunc Message($Message) Sleep($MessageDelay); Delay between consecutive messages in milliseconds SplashTextOn($Title, " " & $Message & "..", 320, 50, -1, -1, 36, "times new roman", 10, 600) ;Display Message Sleep($MessageDelay) ;Length of display in milliseconds SplashOff() EndFunc ;==>MessageAndLog Assistance is always appreciated Ant.. Edit: I think that I have a resolution that will work and that is to predetermine the width for each message and make it a variable when calling the function: CODE message("This is the message", 350) Func Message($Message,$Width) Sleep($MessageDelay); Delay between consecutive messages in milliseconds SplashTextOn($Title, " " & $Message & "..", $Width, 50, -1, -1, 36, "times new roman", 10, 600) ;Display Message Sleep($MessageDelay) ;Length of display in milliseconds SplashOff() EndFunc ;==>MessageAndLog Edited June 13, 2008 by anixon
ChrisL Posted June 13, 2008 Posted June 13, 2008 Not an exact science but seems near enough $MessageDelay = 5000 $Title = "Test" message("This is the message") Func Message($Message) $FontSize = 10 $Width = StringLen($Message) * ($FontSize -2) ;Sleep($MessageDelay); Delay between consecutive messages in milliseconds SplashTextOn($Title, " " & $Message & "..", $Width, 50, -1, -1, 36, "times new roman", $FontSize, 600);Display Message Sleep($MessageDelay);Length of display in milliseconds SplashOff() EndFunc;==>MessageAndLog [u]Scripts[/u]Minimize gui to systray _ Fail safe source recoveryMsgbox UDF _ _procwatch() Stop your app from being closedLicensed/Trial software system _ Buffering Hotkeys_SQL.au3 ADODB.Connection _ Search 2d Arrays_SplashTextWithGraphicOn() _ Adjust Screen GammaTransparent Controls _ Eventlogs without the crap_GuiCtrlCreateFlash() _ Simple Interscript communication[u]Websites[/u]Curious Campers VW Hightops Lambert Plant Hire
anixon Posted June 13, 2008 Author Posted June 13, 2008 Not an exact science but seems near enough $MessageDelay = 5000 $Title = "Test" message("This is the message") Func Message($Message) $FontSize = 10 $Width = StringLen($Message) * ($FontSize -2) ;Sleep($MessageDelay); Delay between consecutive messages in milliseconds SplashTextOn($Title, " " & $Message & "..", $Width, 50, -1, -1, 36, "times new roman", $FontSize, 600);Display Message Sleep($MessageDelay);Length of display in milliseconds SplashOff() EndFunc;==>MessageAndLog Thanks for that I will give it a try near enough is definately good enough. I was thinking however that given MsgBox sizes itself according to the message I would have thought that someone might have known the forumla used in that function. Thanks for your help Ant..
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