Jump to content

Zorder problem - example script here


sulfurious
 Share

Recommended Posts

I am constantly running into this problem. If my script creates more than one gui, and dropaccepted is implemented, the underlying form, if it is higher zorder, messes with lower zorder drops.

In this example click the option menu (function). Then drop stuff in the input boxes. There are spots that will give a fatal error. It depends on what is behind it. Try missing the input box and dropping it just to the left of the close button. There is a spot there that repeats every time.

I have tried everything I could find in the help file. OnTop, focus, switch, those kinds of things. Nothing seems to work if the zorder is out. I don't think positioning of the forms so they do not overlap is a good solution. Especially when you have 3 or 4 forms, each with drop zones.

Can anyone figure this out? Cause I can't seem to be able to.

late,

Sul

#include <GUIConstants.au3>

Opt("GUIOnEventMode", 1)
$winMAIN = GUICreate("WinMain", 622, 465, 326, 115,-1,0x00000010)
GUISetOnEvent($GUI_EVENT_CLOSE, "_EXIT")
GUISetOnEvent($GUI_EVENT_DROPPED,"_DragDropRules")
GUICtrlCreateLabel("Some label", 8, 352, 135, 17)
$in1 = GUICtrlCreateInput("", 8, 368, 337, 21, -1, $WS_EX_CLIENTEDGE)
GUICtrlSetState(-1,$GUI_DROPACCEPTED)
GUICtrlCreateLabel("Some label 2", 8, 392, 139, 17)
$in2 = GUICtrlCreateInput("", 8, 408, 337, 21, -1, $WS_EX_CLIENTEDGE)
GUICtrlSetState(-1,$GUI_DROPACCEPTED)
GUICtrlCreateLabel("Some label 3", 8, 312, 64, 17)
$inCustomFilter = GUICtrlCreateInput("", 8, 328, 289, 18, -1, $WS_EX_CLIENTEDGE)
$treFILTERS = GUICtrlCreateTreeView(312, 8, 305, 337,BitOr($TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT _
, $TVS_SHOWSELALWAYS), $WS_EX_CLIENTEDGE)

$cb1 = GUICtrlCreateCheckbox("check box 1", 16, 16, 202, 15)
$cb2 = GUICtrlCreateCheckbox("check box 2", 16, 40, 202, 15)
$cb3 = GUICtrlCreateCheckbox("check box 3", 16, 64, 202, 15)
$cb4 = GUICtrlCreateCheckbox("check box 4", 16, 88, 202, 15)
$cb5 = GUICtrlCreateCheckbox("check box 5", 16, 112, 202, 15)
$cb6 = GUICtrlCreateCheckbox("check box 6", 16, 136, 210, 15)
$cb7 = GUICtrlCreateCheckbox("check box 7", 16, 160, 202, 15)
$cb8 = GUICtrlCreateCheckbox("check box 8", 16, 184, 202, 15)
$cb9 = GUICtrlCreateCheckbox("check box 9", 16, 208, 202, 15)
$cb10 = GUICtrlCreateCheckbox("check box 10", 16, 232, 202, 15)

$btn1 = GUICtrlCreateButton("Button 1", 352, 368, 57, 17)
$btn2 = GUICtrlCreateButton("Button 2", 352, 408, 57, 17)
$btn3 = GUICtrlCreateButton("Button 3", 528, 360, 73, 25)
$btn4 = GUICtrlCreateButton("Exit", 528, 400, 73, 25)
GUICtrlSetOnEvent(-1,"_exit")
$btn5 = GUICtrlCreateButton("Button 5", 432, 360, 65, 25)
$btn6 = GUICtrlCreateButton("Button 6", 432, 400, 65, 25)
GUICtrlSetState(-1,$GUI_DROPACCEPTED)

$mnuOPTIONS = GUICtrlCreateMenu("&Options")
$smnu1 = GUICtrlCreateMenuitem("&Fucntion",$mnuOPTIONS)
GUICtrlSetOnEvent(-1,"_showFrm2")
GUISetState(@SW_SHOW)

$winFrm2 = GUICreate("Some function GUI", 382, 145, 192, 125,-1,0x00000010)
GUISetOnEvent($GUI_EVENT_CLOSE,"_Close")
GUISetOnEvent($GUI_EVENT_DROPPED,"_DragDropRules")
GUICtrlCreateLabel("Input 1", 8, 8, 144, 16)
$in3 = GUICtrlCreateInput("", 8, 24, 305, 18, -1, $WS_EX_CLIENTEDGE)
GUICtrlSetState(-1,$GUI_DROPACCEPTED)
GUICtrlCreateLabel("Input 2", 8, 56, 43, 16)
$in4 = GUICtrlCreateInput("", 8, 72, 305, 18, -1, $WS_EX_CLIENTEDGE)
GUICtrlSetState(-1,$GUI_DROPACCEPTED)
$btn7 = GUICtrlCreateButton("Button 7", 320, 24, 49, 17)
$btn8 = GUICtrlCreateButton("Button 8", 320, 72, 49, 17)
$btn9 = GUICtrlCreateButton("Button 9", 304, 104, 65, 28)
$btn10 = GUICtrlCreateButton("Close", 200, 104, 65, 28)
GUICtrlSetOnEvent(-1,"_Close")

Sleep(2000)
While 1
    Sleep(1000)  ; Idle around
WEnd
GUIDelete()
Exit

Func _EXIT()
    Exit
EndFunc ;--->>> Generic exit function
Func _Close()
    GUISwitch($winMAIN)
    GUISetState(@SW_HIDE,$winFrm2)
    GUISetState(@SW_SHOW,$winMAIN)
EndFunc

Func _DragDropRules()
;~  MsgBox(0,"drop id",@GUI_DropId)
    Return
EndFunc  ;--->>> _DragDropRules

Func _showFrm2()
    GUISwitch($winFrm2)
;~  GUISetState(@SW_HIDE,$winMAIN)
    GUISetState(@SW_SHOW,$winFrm2)
EndFunc
Link to comment
Share on other sites

Hello,

I have constated that the bug apperars when the second window and the main are superposed.

When I move the second window, until they aren't superposed yet, there is no bug more.

I have completed your two functions _Close() and _showFrm2() like this :

Func _Close()
    GUISwitch($winMAIN)
    WinMove("WinMain","",$position[0],$position[1])
    GUISetState(@SW_HIDE,$winFrm2)
    GUISetState(@SW_SHOW,$winMAIN)
EndFunc


Func _showFrm2()
    GUISwitch($winFrm2)
    $position=WinGetPos("WinMain")
    GUISetState(@SW_HIDE,$winMAIN)
    WinMove("WinMain","",@DesktopWidth,@DesktopHeight)
    GUISetState(@SW_SHOW,$winFrm2)
EndFunc

with a global var "position"

I have no more problem

Edited by sylvanie
Link to comment
Share on other sites

I would say it's a bug.

Even if you comment out all the DROPACCEPTED lines it will crash when something is dropped onto $winFrm2, if $winMAIN is behind. However, if I drag and drop things onto $winMAIN, with $winFrm2 behind it, I haven't been able to make it crash.

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
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...