Jump to content

Toolbar dock error


Bert
 Share

Recommended Posts

I have a script that docks a toolbar to a window. Normally works fine. The problem I'm having is I'm getting a error when I close the parent window. Not all the time, but sometimes I will get a autoit error

MTB2_2.au3 (167) : ==> Subscript used with non-Array variable.:

The code I'm using for the docking is this:

Func _ToolbarDocked()
    $p_win1 = WinGetPos($GUI1);parent
    $p_win2 = WinGetPos($GUI2);toolbar
    if WinExists($GUI1) = 0 then exit
        If (($p_win1[0] <> $x1 Or $p_win1[1] <> $y1) And BitAND(WinGetState($GUI1), 8) Or $Dock = 2) Then
            $x1 = $p_win1[0]
            $y1 = $p_win1[1]
            $x2 = $p_win1[2] + $x1 - ($xx + 4)
            $y2 = $y1 - ($ya + 25)          
            WinMove($GUI2, "", $x2 + $iniread_12, $y2 + $iniread_14) 
        ElseIf (($p_win2[0] <> $x2 Or $p_win2[1] <> $y2) And BitAND(WinGetState($GUI2), 8)) Then
            $x2 = $p_win2[0]
            $y2 = $p_win2[1]
            $x1 = $p_win2[0] - $p_win1[2] + ($xx + 4)
            $y1 = $y2 + ($ya + 25)
            WinMove($GUI1, "", $x1 + $iniread_13, $y1 + $iniread_15) 
        EndIf
EndFunc   ;==>_ToolbarDocked

This line is causing the problem: ElseIf (($p_win2[0] <> $x2 Or $p_win2[1] <> $y2) And BitAND(WinGetState($GUI2), 8)) Then

Edited by vollyman
Link to comment
Share on other sites

I figured it out. I did this, and it worked fine:

Func _ToolbarDocked()
    $p_win1 = WinGetPos($GUI1);parent
    $p_win2 = WinGetPos($GUI2);toolbar
    if WinExists($GUI1) = 0 then exit
        If (($p_win1[0] <> $x1 Or $p_win1[1] <> $y1) And BitAND(WinGetState($GUI1), 8) Or $Dock = 2) Then
            $x1 = $p_win1[0]
            $y1 = $p_win1[1]
            $x2 = $p_win1[2] + $x1 - ($xx + 4)
            $y2 = $y1 - ($ya + 25)          
            WinMove($GUI2, "", $x2 + $iniread_12, $y2 + $iniread_14) 
        endif   
        if $p_win2 = 0 then 
            exit        
        elseIf (($p_win2[0] <> $x2 Or $p_win2[1] <> $y2) And BitAND(WinGetState($GUI2), 8)) Then
            $x2 = $p_win2[0]
            $y2 = $p_win2[1]
            $x1 = $p_win2[0] - $p_win1[2] + ($xx + 4)
            $y1 = $y2 + ($ya + 25)
            WinMove($GUI1, "", $x1 + $iniread_13, $y1 + $iniread_15) 
        EndIf
EndFunc   ;==>_ToolbarDocked
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...