Bert Posted November 2, 2006 Posted November 2, 2006 (edited) 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 errorMTB2_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 ;==>_ToolbarDockedThis line is causing the problem: ElseIf (($p_win2[0] <> $x2 Or $p_win2[1] <> $y2) And BitAND(WinGetState($GUI2), 8)) Then Edited November 2, 2006 by vollyman The Vollatran project My blog: http://www.vollysinterestingshit.com/
Valuater Posted November 2, 2006 Posted November 2, 2006 It appears that the toolbar is a child window, i noticed that i had a problem with a child window and GetCursurInfo()gafrost noted that i would need to set the state of the window as show before the cursur info would workmaybe for you it could help alsohttp://www.autoitscript.com/forum/index.ph...st&p=2601808)
Valuater Posted November 2, 2006 Posted November 2, 2006 Actually, if the toolbar is "based" on the parent window you have if WinExists($GUI1) = 0 then exit you could add if WinExists($GUI2) = 0 then exit ; for the toolbar 8)
Bert Posted November 2, 2006 Author Posted November 2, 2006 (edited) I tried that, and I still get the error. What is real odd is I use the same tooldock function for child windows (different script) and it works fine. Edited November 2, 2006 by vollyman The Vollatran project My blog: http://www.vollysinterestingshit.com/
Bert Posted November 2, 2006 Author Posted November 2, 2006 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 The Vollatran project My blog: http://www.vollysinterestingshit.com/
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