Drop files from Explorer to HMG Control

General Help regarding HMG, Compilation, Linking, Samples

Moderator: Rathinagiri

User avatar
AUGE_OHR
Posts: 2060
Joined: Sun Aug 25, 2019 3:12 pm
DBs Used: DBF, PostgreSQL, MySQL, SQLite
Location: Hamburg, Germany

Re: Drop files from Explorer to HMG Control

Post by AUGE_OHR »

hi,
andyglezl wrote: Mon Mar 23, 2020 5:18 am What makes the difference / advantage when using Drag & Drop instead of
the Technique :idea:
there are many Way and DragDrop is the Windows Way which i can use on Table-PC without Keyboard.

DragAcceptFiles() does exist in FiveWin v1.7 for Cl*pper from 1994 (!) which Code i use now with HMG.
have a look at those Code
DragQueryFiles.jpg
DragQueryFiles.jpg (161.21 KiB) Viewed 29132 times
so it is no new Windows API Function.
Next was DDE before OLE-DragDrop (what i still search)

---

i´m sure that

Code: Select all

  ON MOUSEMOVE DragMove( ThisWindow.Name ) ;
  ON MOUSEDRAG DragHere( ThisWindow.Name ) ;
does work when 1st HBFM Release ... but since some Time it does not work any more ... hm
so i search for DragAcceptFiles and found c:\MiniGUI\SOURCE\c_winapimisc.c which run under HMG

Demo show that DRAGQUERYFILES work and i can assign it to EditBox or Textbox.
For Media-File you got File-Name to use it as IMAGE or "play" Media-file

---

as you see Demo work ... but it is only a Demo so what about hole App :?:

in a normal Window i have more than 1 x Control so i need to know "where" i drop.
i got the Tip from Andrés to use "Hover" ... i have to EVAL Sample to find out how to implement it

but even it i found out "where" i drop i need some "extra" to identify if it "allow" on "that" Control
under Xbase++ we have a Property DropZone := .T. so only on those Control User "can" drop.

so i like to ask for new Property "DropZone" in next HMG Release
have fun
Jimmy
User avatar
AUGE_OHR
Posts: 2060
Joined: Sun Aug 25, 2019 3:12 pm
DBs Used: DBF, PostgreSQL, MySQL, SQLite
Location: Hamburg, Germany

Re: Drop files from Explorer to HMG Control

Post by AUGE_OHR »

hi

i made a new Sample with 4 Controls. when Drop it will assign it to "that" Control
Drop4.jpg
Drop4.jpg (40.81 KiB) Viewed 29126 times
i have limited it to EDITbox and Textbox, both are Type "EDIT"

Question : is there a overview for GetControlTypeByIndex() which Type are possible :?:

i have delete MiniGUI Source as i don´t understand how to use it.
DragAccept02.zip
(3.04 KiB) Downloaded 219 times
have fun
Jimmy
User avatar
AUGE_OHR
Posts: 2060
Joined: Sun Aug 25, 2019 3:12 pm
DBs Used: DBF, PostgreSQL, MySQL, SQLite
Location: Hamburg, Germany

Re: Drop files from Explorer to HMG Control

Post by AUGE_OHR »

hi,
Question : is there a overview for GetControlTypeByIndex() which Type are possible
found in DragDrop Sample from edk, Thx

Code: Select all

FUNCTION HMG_ValidControlTypeDragAndDrop( cCtrlType )
RETURN cCtrlType == 'GRID' .OR. cCtrlType == 'MULTIGRID' .OR. cCtrlType == 'EDIT' .OR. cCtrlType == 'LIST' .OR. ;
cCtrlType == 'MULTILIST' .OR. cCtrlType == 'RICHEDIT' .OR. cCtrlType == 'TEXT' .OR. cCtrlType == 'NUMTEXT' .OR. ;
cCtrlType == 'MASKEDTEXT' .OR. cCtrlType == 'CHARMASKTEXT' .OR. cCtrlType == 'TREE'
have fun
Jimmy
User avatar
andyglezl
Posts: 1461
Joined: Fri Oct 26, 2012 7:58 pm
Location: Guadalajara Jalisco, MX
Contact:

Re: Drop files from Explorer to HMG Control

Post by andyglezl »

AUGE_OHR wrote: Tue Mar 24, 2020 6:14 am hi

i made a new Sample with 4 Controls. when Drop it will assign it to "that" Control
i have limited it to EDITbox and Textbox, both are Type "EDIT"
ImagenDrop.jpg
ImagenDrop.jpg (141.28 KiB) Viewed 28788 times
Hola Jimmy
Gracias por tu ejemplo me es muy útil.
Solo que tengo el problema de que los caracteres acentuados no son interpretados en
el EDITBOX como lo muestra ésta imagen de ejemplo.
Sabrás la razón de este detalle ?
*--------------------------------------------------------------------------------------------------------
Hi jimmy
Thanks for your example it is very useful to me.
Just that I have the problem that accented characters are not interpreted in the EDITBOX as shown in this example image.
Do you know the reason for this detail?
Andrés González López
Desde Guadalajara, Jalisco. México.
User avatar
AUGE_OHR
Posts: 2060
Joined: Sun Aug 25, 2019 3:12 pm
DBs Used: DBF, PostgreSQL, MySQL, SQLite
Location: Hamburg, Germany

Re: Drop files from Explorer to HMG Control

Post by AUGE_OHR »

hi,
andyglezl wrote: Thu Nov 26, 2020 6:04 am Just that I have the problem that accented characters are not interpreted in the EDITBOX as shown in this example image.
Do you know the reason for this detail?
i just can guess : it is ANSI from Explorer
have fun
Jimmy
User avatar
andyglezl
Posts: 1461
Joined: Fri Oct 26, 2012 7:58 pm
Location: Guadalajara Jalisco, MX
Contact:

Re: Drop files from Explorer to HMG Control

Post by andyglezl »

Ok
La solución está aquí... (de edk)
*----------------------------------------------------------------------------
Okay
The solution is here ... (from edk)


https://www.hmgforum.com/viewtopic.php? ... ode#p63652


Para mí, así funciona:
*--------------------------------
For me, this is how it works:

Code: Select all

		CASE nMsg == WM_DROPFILES
			aFiles := DragQueryFileS( nWParam )
			SET( _SET_CODEPAGE, "DEWIN" )
        			SetProperty( "Win1", "EB_DropHere", "Value", aFiles[ 1 ] )
			SET( _SET_CODEPAGE, "UTF8" )
Thanks edk and Jimmy
Andrés González López
Desde Guadalajara, Jalisco. México.
User avatar
andyglezl
Posts: 1461
Joined: Fri Oct 26, 2012 7:58 pm
Location: Guadalajara Jalisco, MX
Contact:

Re: Drop files from Explorer to HMG Control

Post by andyglezl »

mmmm...
De está forma me sirve, pero el valor no es permanente, al cambiar de nuevo
a SET( _SET_CODEPAGE, "UTF8" ), queda igual...
*----------------------------------------------------------------------------------------------
mmmm...
This is how it works, but the value is not permanent, when changing back to
SET (_SET_CODEPAGE, "UTF8"), it remains the same ...


Si lo pongo al inicio del programa, funciona para los nombres pero cambia en otros lados...
*----------------------------------------------------------------------------------------------------------------
If I put it at the beginning of the program, it works for names but changes elsewhere ...


UTF8.jpg
UTF8.jpg (131.81 KiB) Viewed 28742 times
Andrés González López
Desde Guadalajara, Jalisco. México.
User avatar
andyglezl
Posts: 1461
Joined: Fri Oct 26, 2012 7:58 pm
Location: Guadalajara Jalisco, MX
Contact:

Re: Drop files from Explorer to HMG Control

Post by andyglezl »

Aquí la solución:
*-----------------------------
Here the solution:

Code: Select all

		CASE nMsg == WM_DROPFILES
			aFiles := DragQueryFileS( nWParam )
			SetProperty( "Win1", "EB_DropHere", "Value", Hb_Translate( aFiles[ 1 ], "DEWIN", "UTF8" ) )
			
			or
			
			hb_StrToUtf8( aFiles[ 1 ], "DEWIN" )

Andrés González López
Desde Guadalajara, Jalisco. México.
User avatar
AidTIC
Posts: 117
Joined: Mon Apr 22, 2013 8:29 am
DBs Used: DBF
Contact:

Re: Drop files from Explorer to HMG Control

Post by AidTIC »

AUGE_OHR wrote: Mon Mar 23, 2020 5:02 am hi,
andyglezl wrote: Mon Mar 23, 2020 2:03 am You can see this from EDK...
https://www.hmgforum.com/viewtopic.php? ... fix#p57451
thx for Tip, GREAT Sample
but it use DragDrop "inside" App while i try to get DragDrop from "outside".

most i use DragDrop for new Media-Files to drop them into Playlist.
it is a single Control in a Window so it is easy to find Control where i drop.
the Demo Sample just do that ...
! Note : this DragDrop Style only have a File-List of Media-Files NOT Media itself

but i think about next Step when have many Controls in a Window ...
under HMG i´m not able to restrict it on Control i want ( Xbase++ -> o:DropZone := .T. )

here Source Code i use
DROPFILE_Source.ZIP
Me funciona bien cuando arrastro un archivo guardado, pero cuando lo arrastro desde un correo (outlook) no me deja.
Como se podría implementar?

It works fine for me when I drag a saved file, but when I drag it from an email (outlook) it doesn't let me.
How could it be implemented?

Gracias / Thank you
Skydone Solutions
www.skydone.com
User avatar
AUGE_OHR
Posts: 2060
Joined: Sun Aug 25, 2019 3:12 pm
DBs Used: DBF, PostgreSQL, MySQL, SQLite
Location: Hamburg, Germany

Re: Drop files from Explorer to HMG Control

Post by AUGE_OHR »

hi.
AidTIC wrote: Wed Nov 29, 2023 4:08 pm It works fine for me when I drag a saved file, but when I drag it from an email (outlook) it doesn't let me.
How could it be implemented?
as i know DragAccept does not support OLE for DragDrop like Outlook Email

---

under Xbase++ there was a Trick to use a IE Window to drop anything you want. not sure if it still work with EDGE
have fun
Jimmy
Post Reply