Jump to content

Solved: [How to: Transparent Edit Control for Drop on top of picture?]


Mbee
 Share

Recommended Posts

I'm using trancexx's GifAnimation UDF to display an image (of any supported type, not just gifs), but I need to cover the entire pic area with a transparent Input control in order to use it to accept drag & drop of files. The problem is, even after making the input control transparent, no matter what I try, the input control blanks out (the image disappears). This is a major problem because in order to accept drag & drop, the input control must be on top of the gif/pic control.

Here's the code snippet I'm trying to get to work...

Local $GUI = GUICreate("My GUI",818,845,-1,-1,BitOr($WS_CAPTION,$WS_SYSMENU,$WS_MINIMIZEBOX,$WS_VISIBLE),
                        BitOr($WS_EX_ACCEPTFILES,$WS_EX_APPWINDOW))
;
;
$L_GifCtlID = _GUICtrlCreateGIF( $G_BinaryPicData, Default, $L_DispXpos, $L_DispYpos, _
                                    $Lf_PicWidth, $Lf_PicHeight )
;
;   PROBLEM: As soon as the next call is made to create an input control, the image disappears!
;
$L_DropInputCtlID = GUICtrlCreateInput( "", $Cmy_PicDisplayXpos, $Cmy_PicDisplayYpos, _
                            $Cmy_PicDisplayWidth, $Cmy_PicDisplayHeight, $ES_READONLY, $WS_EX_ACCEPTFILES )
GUICtrlSetState( $L_DropInputCtlID, $GUI_DROPACCEPTED )
;
;   Then Either this...
;
$Lf_InputCtlWindHdl = _WinAPI_GetDlgItem( $GUI, $L_DropInputCtlID )
WinSetTrans( $Lf_InputCtlWindHdl, "", 0 )               ; Make the input control/window transparent
;
;   ... Or this...
;
GUICtrlSetBkColor( $L_DropInputCtlID, $GUI_BKCOLOR_TRANSPARENT )    ; Docs says $GUI_BKCOLOR_TRANSPARENT not for Edit controls, but try it
GUICtrlSetColor(  $L_DropInputCtlID, $GUI_BKCOLOR_TRANSPARENT )     ; (likewise)
;

What else can I do to create a drag & drop input control without blanking the image ?

Edited by Mbee
Link to comment
Share on other sites

43 minutes ago, AutoBert said:

AutoItScript.com is a forum living from questions and the solutions. So please so kind and post the script you solved your issue, thanks.

Sorry. The problem turned out to come from my relative unfamiliarity with AutoIt GUI code. I was simply wrong to believe I had to create an input control to accept dropped files!  Here's the solution that worked...

Local $GUI = GUICreate("My GUI",818,845,-1,-1,BitOr($WS_CAPTION,$WS_SYSMENU,$WS_MINIMIZEBOX,$WS_VISIBLE),
                        BitOr($WS_EX_ACCEPTFILES,$WS_EX_APPWINDOW))
;
;
$L_GifCtlID = _GUICtrlCreateGIF( $G_BinaryPicData, Default, $L_DispXpos, $L_DispYpos, _
                                    $Lf_PicWidth, $Lf_PicHeight )
;
;
;   SOLUTION: DON'T Create an input control at all!  Just add the DropAccepted attribute to the Gif Control
;
GUICtrlSetState( $L_GifCtlID, $GUI_DROPACCEPTED )

 

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...