Sign in to follow this  
Followers 0
anixon

SplashTextOn

3 posts in this topic

#1 ·  Posted (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?

CODE
Func 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 by anixon

Share this post


Link to post
Share on other sites



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

Share this post


Link to post
Share on other sites

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..

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0