Jump to content
Sign in to follow this  
shai

control below tabs dont work

Recommended Posts

shai

i have some controls that if the position of the control is below tabs the control wont work.

see example:

this code work:

; ===============================================================================================================================
; File : DragDropEvent_Example_2.au3 (2012/3/9)
; Purpose : Demonstrate the usage of DragDropEvent UDF
; Author : Ward
; ===============================================================================================================================
#include <TabConstants.au3>
#Include <GUIConstantsEx.au3>
#Include <WindowsConstants.au3>
#Include "DragDropEvent.au3"

Opt("MustDeclareVars", 1)

Global $Button2

DragDropEvent_Startup()
Main()
Exit

Func Main()
Local $MainWin = GUICreate("DragDropEvent Example", 460, 400, -1, -1, -1, $WS_EX_TOPMOST)
$Button2 = GUICtrlCreateButton("Drop Files", 240, 20, 200, 150)
DragDropEvent_Register(GUICtrlGetHandle($Button2), $MainWin)
GUIRegisterMsg($WM_DRAGENTER, "OnDragDrop")
GUIRegisterMsg($WM_DRAGOVER, "OnDragDrop")
GUIRegisterMsg($WM_DRAGLEAVE, "OnDragDrop")
GUIRegisterMsg($WM_DROP, "OnDragDrop")
GUICtrlCreateTab(5, 245, 390, 100,BitOR($TCS_FIXEDWIDTH, $TCS_TABS))
GUICtrlCreateTabItem("1")
GUICtrlSetResizing(-1, $GUI_DOCKWIDTH+$GUI_DOCKHEIGHT)
GUICtrlCreateLabel("abc", 30, 270, 50, 20)
GUICtrlCreateTabItem("2")
GUICtrlSetResizing(-1, $GUI_DOCKWIDTH+$GUI_DOCKHEIGHT)
GUICtrlCreateLabel("abc", 30, 270, 50, 20)
GUICtrlCreateTabItem("")

GUISetState(@SW_SHOW)
While 1
Local $Msg = GUIGetMsg()
Switch $Msg
Case $Button2
DragDropEvent_Revoke(GUICtrlGetHandle($Msg))
Case $GUI_EVENT_CLOSE
ExitLoop
EndSwitch
WEnd
GUIDelete()
EndFunc

Func OnDragDrop($hWnd, $Msg, $wParam, $lParam)
Static $DropAccept

Switch $Msg
Case $WM_DRAGENTER, $WM_DROP
ToolTip("")
Local $Target = DragDropEvent_GetHWnd($wParam)
Select
Case DragDropEvent_IsFile($wParam)
If $Msg = $WM_DROP Then
Local $FileList = DragDropEvent_GetFile($wParam)
MsgBox(262144, "DragDropEvent", StringReplace($FileList, "|", @LF))
EndIf
$DropAccept = $DROPEFFECT_COPY
Case Else
$DropAccept = $DROPEFFECT_NONE
EndSelect
Return $DropAccept

Case $WM_DRAGOVER
Local $X = DragDropEvent_GetX($wParam)
Local $Y = DragDropEvent_GetY($wParam)
Local $KeyState = DragDropEvent_GetKeyState($wParam)
ToolTip("(" & $X & "," & $Y & "," & $KeyState & ")")
Return $DropAccept

Case $WM_DRAGLEAVE
ToolTip("")

EndSwitch
EndFunc

and this code wnot work:

; ===============================================================================================================================
; File : DragDropEvent_Example_2.au3 (2012/3/9)
; Purpose : Demonstrate the usage of DragDropEvent UDF
; Author : Ward
; ===============================================================================================================================
#include <TabConstants.au3>
#Include <GUIConstantsEx.au3>
#Include <WindowsConstants.au3>
#Include "DragDropEvent.au3"

Opt("MustDeclareVars", 1)

Global $Button2

DragDropEvent_Startup()
Main()
Exit

Func Main()
Local $MainWin = GUICreate("DragDropEvent Example", 460, 400, -1, -1, -1, $WS_EX_TOPMOST)
GUICtrlCreateTab(5, 5, 390, 100,BitOR($TCS_FIXEDWIDTH, $TCS_TABS))
GUICtrlCreateTabItem("1")
GUICtrlSetResizing(-1, $GUI_DOCKWIDTH+$GUI_DOCKHEIGHT)
GUICtrlCreateLabel("abc", 30, 30, 50, 20)
GUICtrlCreateTabItem("2")
GUICtrlSetResizing(-1, $GUI_DOCKWIDTH+$GUI_DOCKHEIGHT)
GUICtrlCreateLabel("abc", 30, 40, 50, 20)
GUICtrlCreateTabItem("")
$Button2 = GUICtrlCreateButton("Drop Files", 240, 120, 200, 150)
DragDropEvent_Register(GUICtrlGetHandle($Button2), $MainWin)
GUIRegisterMsg($WM_DRAGENTER, "OnDragDrop")
GUIRegisterMsg($WM_DRAGOVER, "OnDragDrop")
GUIRegisterMsg($WM_DRAGLEAVE, "OnDragDrop")
GUIRegisterMsg($WM_DROP, "OnDragDrop")
GUISetState(@SW_SHOW)
While 1
Local $Msg = GUIGetMsg()
Switch $Msg
Case $Button2
DragDropEvent_Revoke(GUICtrlGetHandle($Msg))
Case $GUI_EVENT_CLOSE
ExitLoop
EndSwitch
WEnd
GUIDelete()
EndFunc

Func OnDragDrop($hWnd, $Msg, $wParam, $lParam)
Static $DropAccept

Switch $Msg
Case $WM_DRAGENTER, $WM_DROP
ToolTip("")
Local $Target = DragDropEvent_GetHWnd($wParam)
Select
Case DragDropEvent_IsFile($wParam)
If $Msg = $WM_DROP Then
Local $FileList = DragDropEvent_GetFile($wParam)
MsgBox(262144, "DragDropEvent", StringReplace($FileList, "|", @LF))
EndIf
$DropAccept = $DROPEFFECT_COPY
Case Else
$DropAccept = $DROPEFFECT_NONE
EndSelect
Return $DropAccept

Case $WM_DRAGOVER
Local $X = DragDropEvent_GetX($wParam)
Local $Y = DragDropEvent_GetY($wParam)
Local $KeyState = DragDropEvent_GetKeyState($wParam)
ToolTip("(" & $X & "," & $Y & "," & $KeyState & ")")
Return $DropAccept

Case $WM_DRAGLEAVE
ToolTip("")

EndSwitch
EndFunc

DragDropEvent.au3

to see what dont work, try drop file to the big button.

thank for any help.

Edited by shai

Share this post


Link to post
Share on other sites
rudi

Hi.

Dropping a file here on the "big button in the tabbed version" is working fine.

Win7 64bit Enterprise

Autoit 3.3.8.1

DragDropEvent.au3 (2012/3/15)

Regards, Rudi.


Earth is flat, pigs can fly, and Nuclear Power is SAFE!

Share this post


Link to post
Share on other sites
shai

I did not understand. Two scripts I gave work for you?

Share this post


Link to post
Share on other sites
PhoenixXL

The second code you provided is working with me

maybe the button is getting pressed and your Events are getting cancelled

try with this [just commented the revoke function]

; ===============================================================================================================================
; File : DragDropEvent_Example_2.au3 (2012/3/9)
; Purpose : Demonstrate the usage of DragDropEvent UDF
; Author : Ward
; ===============================================================================================================================
#include <TabConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include "DragDropEvent.au3"

Opt("MustDeclareVars", 1)

Global $Button2

DragDropEvent_Startup()
Main()
Exit

Func Main()
Local $MainWin = GUICreate("DragDropEvent Example", 460, 400, -1, -1, -1, $WS_EX_TOPMOST)
GUICtrlCreateTab(5, 5, 390, 100, BitOR($TCS_FIXEDWIDTH, $TCS_TABS))
GUICtrlCreateTabItem("1")
GUICtrlSetResizing(-1, $GUI_DOCKWIDTH + $GUI_DOCKHEIGHT)
GUICtrlCreateLabel("abc", 30, 30, 50, 20)
GUICtrlCreateTabItem("2")
GUICtrlSetResizing(-1, $GUI_DOCKWIDTH + $GUI_DOCKHEIGHT)
GUICtrlCreateLabel("abc", 30, 40, 50, 20)
GUICtrlCreateTabItem("")
$Button2 = GUICtrlCreateButton("Drop Files", 240, 120, 200, 150)
DragDropEvent_Register(GUICtrlGetHandle($Button2), $MainWin)
GUIRegisterMsg($WM_DRAGENTER, "OnDragDrop")
GUIRegisterMsg($WM_DRAGOVER, "OnDragDrop")
GUIRegisterMsg($WM_DRAGLEAVE, "OnDragDrop")
GUIRegisterMsg($WM_DROP, "OnDragDrop")
GUISetState(@SW_SHOW)
While 1
Local $Msg = GUIGetMsg()
Switch $Msg
Case $Button2
;DragDropEvent_Revoke(GUICtrlGetHandle($Msg))
Case $GUI_EVENT_CLOSE
ExitLoop
EndSwitch
WEnd
GUIDelete()
EndFunc ;==>Main

Func OnDragDrop($hWnd, $Msg, $wParam, $lParam)
Static $DropAccept

Switch $Msg
Case $WM_DRAGENTER, $WM_DROP
ToolTip("")
Local $Target = DragDropEvent_GetHWnd($wParam)
Select
Case DragDropEvent_IsFile($wParam)
If $Msg = $WM_DROP Then
Local $FileList = DragDropEvent_GetFile($wParam)
MsgBox(262144, "DragDropEvent", StringReplace($FileList, "|", @LF))
EndIf
$DropAccept = $DROPEFFECT_COPY
Case Else
$DropAccept = $DROPEFFECT_NONE
EndSelect
Return $DropAccept

Case $WM_DRAGOVER
Local $X = DragDropEvent_GetX($wParam)
Local $Y = DragDropEvent_GetY($wParam)
Local $KeyState = DragDropEvent_GetKeyState($wParam)
ToolTip("(" & $X & "," & $Y & "," & $KeyState & ")")
Return $DropAccept

Case $WM_DRAGLEAVE
ToolTip("")

EndSwitch
EndFunc ;==>OnDragDrop
Edited by PhoenixXL

My code:

PredictText: Predict Text of an Edit Control Like Scite. Remote Gmail: Execute your Scripts through Gmail. StringRegExp:Share and learn RegExp.

Run As System: A command line wrapper around PSEXEC.exe to execute your apps scripts as System (LSA). Database: An easier approach for _SQ_LITE beginners.

MathsEx: A UDF for Fractions and LCM, GCF/HCF. FloatingText: An UDF for make your text floating. Clipboard Extendor: A clipboard monitoring tool. 

Custom ScrollBar: Scroll Bar made with GDI+, user can use bitmaps instead. RestrictEdit_SRE: Restrict text in an Edit Control through a Regular Expression.

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  

×