Page 1 of 1

Drop EVERYTHING into your Xbase++ application

Posted: Fri Oct 01, 2021 8:10 am
by skiman
Hi,

Some time ago I was looking to drop an email attachment into my application. There was no solution found at that moment.

Now I have a solution where I can drop everything into my application. It is a very simple way by using dchtmlviewer. This way Windows will do all the hard work for you.

When you open the viewer and you navigate to a folder, Windows explorer is opened in the viewer with the folder already open. Now you can drop everything into this viewer. A file, an attachment of a mail, a complete mail, ... Since you have navigated to a folder of your choice, you have the possibility to 'scan' that folder, and get all the files from it.

Code: Select all

cFolder := "c:\yourfolder"
@ x,x DCHTMLVIEWER oDrop SIZE x,x, NAVIGATE cFolder 
This will give you a zone to drop all the files you want. And then you can process the files from your folder.

This is how I implemented it in my application. A user can see the list, can drop new files in it, and can also open files to process.

Image

Re: Drop EVERYTHING into your Xbase++ application

Posted: Mon Oct 04, 2021 9:19 am
by richardc
This is a great solution. Thanks for posting it.

Richard

Re: Drop EVERYTHING into your Xbase++ application

Posted: Mon Oct 04, 2021 1:13 pm
by Wolfgang Ciriack
Very nice !
Is there a possibility to show the content of the file in an extra frame, when selecting an file ?

Re: Drop EVERYTHING into your Xbase++ application

Posted: Tue Oct 05, 2021 5:42 am
by skiman
Wolfgang Ciriack wrote: Mon Oct 04, 2021 1:13 pm Is there a possibility to show the content of the file in an extra frame, when selecting an file ?
Since the list is using Explorer, selecting a file in it will open it with the default application according to the extention.

I'm doing it the following way:
- A button with an ondrop action.
- I can drag and drop a file from the list to that button.
- The action of the button navigates my htmlviewer to that file. The dchtmlviewer shows me the document in the same frame as the list
- I also have a button to return to the list in that frame.
- If the file can't be opened by the htmlviewer (example XLS) it will open Excel to show it.

Of course, you could have two frames on the screen.

Re: Drop EVERYTHING into your Xbase++ application

Posted: Tue Oct 05, 2021 8:45 am
by skiman
Hi,

Meanwhile I created a button in my main menu as a dropzone. You can drop any file into the rectangle of the button..

I changed the handler of the main menu, so I can detect when someone has dropped a file onto it. Then a popup appears to ask what you want to do with the file. In my application files can be attached to customers, suppliers, documents, products, ...

- The button is a dcpushbuttonxp with the STATIC clause. This way it has the same look as my other buttons.
- The black rectangle you see is a dcstatic.
- The inside of the black rectangle is my dchtmlviewer
- The dchtmlviewer is navigated to a specific folder.

I added this to my handler:

Code: Select all

IF Valtype(oXbp) = 'O' .and. oXbp:ClassName() = "DC_XbpHTMLViewer" 
	oThread:=Thread():new()
	oThread:start({||searchdropfile() ,dc_clearevents()})
endif
As soon as a file is dropped onto the dchtmlviewer, the function searchdropfile is called. It is called multiple times, but that's not a problem to solve. The searchdropfile does the processing of the file according to the user input, and then moves the file away.

Now I can drop an attachment as an invoice from my mail to my application. The searchdropfile dialog appears and I select the button 'incoming invoice'. So the invoice is saved in the correct folder, which will be processed by the accountant.

Re: Drop EVERYTHING into your Xbase++ application

Posted: Tue Oct 05, 2021 10:37 am
by Wolfgang Ciriack
It is a pity, that i can not see your jpg attachments. Can you send them to me as private post or as mail.
I like to see other solutions... :D