Sign in to follow this  
Followers 0
trademaid

smart stayon top method for splashtexton

7 posts in this topic

This code will make stay on top off if the splashbox is moved with the move to the left (x < 5 ) and stayontop on if its > 600

The problem is stayon top is always on.

Anyone know why it doesnt work?

#include <Array.au3>

#include <File.au3>

#include <String.au3>

$NoOfSystems = 10

Dim $sid[$NoOfSystems][2]

$linecount = 0

;$sid[2][0] = "stratid"

$sym1 = "ES 03-09"

$ACCOUNT = "Sim101"

$width = 666

$xposition = 700

$yposition = 60

$height = 20

$heading = "heading"

$ontop = 0; this means stay on top; if its 2 then dont stay on top

$new = 0

While 1

$diag = $ACCOUNT & " " & $sym1

$heading = "Ninja errors " & @YEAR & @MON & @MDAY & " " & @HOUR & @MIN & @SEC & " x:" & $xposition & " y:" & $yposition & "ontop " & $ontop

;if $new =0 then

SplashTextOn($heading, $diag, $width, $height, $xposition, $yposition, 16 + 4 + 2 - $ontop, "10", 7);2 is without stay on top

Sleep(1000)

$size = WinGetPos($heading)

$heading = "Ninja errors " & @YEAR & @MON & @MDAY & " " & @HOUR & @MIN & @SEC

$xposition = $size[0]

$yposition = $size[1]

If $xposition < 5 Then $ontop = 0; if move to top then dont make it stay on top

If $xposition > 600 Then $ontop = 2; if move to top then dont make it stay on top

SplashTextOn($heading, $diag, $width, $height, $xposition, $yposition, 16 + 4 + 2 - $ontop, "10", 7);2 is without stay on top

WEnd

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Your code works as written.

SplashTextOn works as you have coded it.

Creating the splash window without the "always on top" attribute still creates the splash window on top of other windows each time through your loop. However, the splash window is allowed to go to the background if some other window "asks" to be on top of it.

edit: typo

Edited by herewasplato

[size="1"][font="Arial"].[u].[/u][/font][/size]

Share this post


Link to post
Share on other sites

Your code works as written.

SplashTextOn works as you have codded it.

Creating the splash window without the "always on top" attribute still creates the splash window on top of other windows each time through your loop. However, the splash window is allowed to go to the background if some other window "asks" to be on top of it.

Is there a way to let it remain in the background?

I do get the variable switching from 2 to zero, but Mine is always on top regardless of stay on top variable value.

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

Is there a way to let it remain in the background?

I do get the variable switching from 2 to zero, but Mine is always on top regardless of stay on top variable value.

Have the script loop in a sleep during the time that you want it in the background - in other words, stop calling it to the foreground.

Try a longer sleep and see if you still think that your splash window is always on top.

Sleep(10000)

$size = WinGetPos($heading)

Edited by herewasplato

[size="1"][font="Arial"].[u].[/u][/font][/size]

Share this post


Link to post
Share on other sites

good idea, but it still stays on top

Share this post


Link to post
Share on other sites

i now have a clue.

if i start with stayontop pff, its in the background.

once i have stayontop on, it stays on forground regardless of stayontop setting

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

During the 10 second pause in this test script - minimize a window and then restore it overtop of the splashscreen. See if it does not behave as it is supposed to.

SplashTextOn("heading", "text", 200, 100, 1, 1)
$pos = WinGetPos("heading")
$ontop = 0
While 1
    $pos = WinGetPos("heading")
    If $pos[0] < 5 Then $ontop = 0
    If $pos[0] > 600 Then $ontop = 2
    SplashTextOn("heading $ontop = " & $ontop, _
            "x = " & $pos[0], _
            200, 100, _
            $pos[0], $pos[1], _
            16 + 4 + 2 - $ontop)
    Sleep(10000)
WEnd

Edited by herewasplato

[size="1"][font="Arial"].[u].[/u][/font][/size]

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