Sign in to follow this  
Followers 0
PantZ4

Variables dont "update" problem...

9 posts in this topic

While 1
        For $x = 0 To ($StickyNumberOfWindows-1) step 1
            If $StickyWindowIsInUse[$x] = True Then
                $temp = WinGetPos($StickyWindow[$x])
                $StickyWindowPostionX[$x] = $temp[0]
                $StickyWindowPostionY[$x] = $temp[1]
                If $StickyWindowPostionTempX[$x] Not = $StickyWindowPostionX[$x] Then
                    $StickyWindowHasMoved[$x] = True
                    $StickyWindowPostionTempX[$x] = $StickyWindowPostionX[$x]
                EndIf
                If $StickyWindowPostionY[$x] Not = $StickyWindowPostionTempY[$x] Then
                    $StickyWindowHasMoved[$x] = True
                    $StickyWindowPostionTempY[$x] = $StickyWindowPostionY[$x]
                EndIf
                If $StickyWindowHasMoved[$x] = True Then
                    $StickyWindowHasMoved[$x] = False
                    ;Do something here
                EndIf
            EndIf
        Next
    Wend

Bacis outlines:

$StickyWindowPostionX[$x] = Current X position for window

$StickyWindowPostionY[$x] = Current Y position for window

$StickyWindowPostionTempX[$x] = Old X position for window

$StickyWindowPostionTempY[$x] = Old Y position for window

It seems that the variables only opdates once, why :whistle: ?

Thank you :P

Share this post


Link to post
Share on other sites



With what your showing us, we can't tell what the issue is, for all we know, the data never changes.

But, if I had to guess, I'd say that: $StickyWindowIsInUse[$x] is only ever true once.


[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

With what your showing us, we can't tell what the issue is, for all we know, the data never changes.

But, if I had to guess, I'd say that: $StickyWindowIsInUse[$x] is only ever true once.

Well its in my loop and it supose to see if the user have move the window.

$StickyWindowIsInUse[$x] is only set when I create a window, eg. when a window is open.

There isn't really more of the loop involing this part.

The whole loop:

Func _EventHandler()
    While 1
        For $x = 0 To ($StickyNumberOfWindows-1) step 1
            If $StickyWindowIsInUse[$x] = True Then
                $temp = WinGetPos($StickyWindow[$x])
                $StickyWindowPostionX[$x] = $temp[0]
                $StickyWindowPostionY[$x] = $temp[1]
                If $StickyWindowPostionTempX[$x] Not = $StickyWindowPostionX[$x] Then
                    $StickyWindowHasMoved[$x] = True
                    $StickyWindowPostionTempX[$x] = $StickyWindowPostionX[$x]
                EndIf
                If $StickyWindowPostionY[$x] Not = $StickyWindowPostionTempY[$x] Then
                    $StickyWindowHasMoved[$x] = True
                    $StickyWindowPostionTempY[$x] = $StickyWindowPostionY[$x]
                EndIf
                If $StickyWindowHasMoved[$x] = True Then
                    $StickyWindowHasMoved[$x] = False
                    GUIDelete($StickyTransparencyWindow[$x])
                    $StickyTransparencyWindow[$x] = _MakeStickyTransparencySlider($x,$StickyWindow[$x])
                    If $StickyTransparencyIsOn[$x] = True Then
                        GUISetState(@SW_SHOW,$StickyTransparencyWindow[$x])
                        WinActivate($StickyTransparencyWindow[$x])
                    EndIf
                EndIf
            EndIf
        Next
        $msg = GUIGetMsg(1)
        For $x = 0 To (($StickyNumberOfWindows*$StickyNumberOfButtons)-1) step 1
            If $msg[0] = $StickyButtonID[$x] And $msg[1] Not = 0 Then
                $ButtonNumber = $x
                While 1
                    If $ButtonNumber > ($StickyNumberOfButtons-1) Then 
                        $ButtonNumber = $ButtonNumber - $StickyNumberOfButtons
                    Else
                        ExitLoop
                    EndIf
                WEnd
                _StickyRunFunction($ButtonNumber,$msg[1])
            EndIf
        Next
        If $msg[0] = $GUI_EVENT_RESIZED Then
            For $x = 0 To ($StickyNumberOfWindows-1) step 1
                If $msg[1] = $StickyWindow[$x] And $msg[1] Not = 0 Then
                    $temp = WinGetPos($StickyWindow[$x])
                    If $temp[3] < $StickyMinimumHeigth Then 
                        WinMove ($msg[1],"",Default,Default,$temp[2],$StickyMinimumHeigth)
                        $temp[3] = $StickyMinimumHeigth
                    EndIf
                    If $temp[2] < $StickyMinimumWidth Then 
                        WinMove ($msg[1],"",Default,Default,$StickyMinimumWidth)
                        $temp[2] = $StickyMinimumWidth
                    EndIf
                    GUIDelete($StickyTransparencyWindow[$x])
                    $StickyTransparencyWindow[$x] = _MakeStickyTransparencySlider($x,$StickyWindow[$x])
                    If $StickyTransparencyIsOn[$x] = True Then
                        GUISetState(@SW_SHOW,$StickyTransparencyWindow[$x])
                    EndIf
                EndIf
            Next
        EndIf
        For $x = 0 To ($StickyNumberOfWindows-1) step 1
            If $StickyTransparencyIsOn[$x] = True Then
                If WinActive($StickyTransparencyWindow[$x]) = 0 Then
                    $StickyTransparencyIsOn[$x] = False
                    DllCall("user32.dll","int","AnimateWindow","hwnd",$StickyTransparencyWindow[$x],"int",100,"long",0x00050008)
                    GUISetState(@SW_HIDE,$StickyTransparencyWindow[$x])
                EndIf
            EndIf
        Next
    WEnd
EndFuncoÝ÷ Ù+Z®ÛÚºW¬jëh×6 Global $StickyDefualtWidthPostion                           = 0
    Global $StickyDefualtHeigthPostion                          = 0
    Global $StickyWindowPostionX[$StickyNumberOfWindows]        = [$StickyDefualtWidthPostion]
    Global $StickyWindowPostionY[$StickyNumberOfWindows]        = [$StickyDefualtHeigthPostion]
    Global $StickyWindowPostionTempX[$StickyNumberOfWindows]    = [$StickyDefualtWidthPostion]
    Global $StickyWindowPostionTempY[$StickyNumberOfWindows]    = [$StickyDefualtHeigthPostion]
I can't see why it wont update... Edited by Mr. Zero

Share this post


Link to post
Share on other sites

I got it!

For some reason does it not work when you write

If $StickyWindowPositionTempX[$x] Not = $temp[0] ThenoÝ÷ Øìµçb*.¸­y«­¢+Ø%ÀÌØíMÑ¥­å]¥¹½ÝA½Í¥Ñ¥½¹QµÁalÀÌØíát±ÐìÐìÀÌØíѵÁlÁtQ¡¸
when it works.

Weird...

Share this post


Link to post
Share on other sites

or

If Not $StickyWindowPositionTempX[$x] = $temp[0] Then
didnt AU3Check warn you?
No, not at all.

Share this post


Link to post
Share on other sites

ok then its weird :P

But it could have been nice to know this 12 hours before :whistle:

:D

Share this post


Link to post
Share on other sites

But it could have been nice to know this 12 hours before :whistle:

:P

You would have known it (for future reference) if someone could have ran your example... I didn't get past the 3rd line I think before I quit looking because I couldn't run it to understand the error you were getting.

Just take 10 minutes out of your time making a reproduction script that reproduces the error that people can actually run.

In addition... SciTe editor (Full Version v.1.7.7) + Ctrl + F5 (running au3check) would have shown you your error (might save you 12 hours of time next time if you run that before banging your head against the wall again).


[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

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