Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Drag and drop Files on CL_GUI_PICTURE

adrianos_campanhola
Participant
0 Kudos

Hello,

I've been trying to implement a drag and drop file feature on the CL_GUI_PICTURE, just like the event FILEDROP on CL_GUI_TEXTEDIT. That is, drop a file on a picture from your desktop/computer/etc and make the SAPGUI recognize it(at least recognize the FCODE).

First, I inherited CL_GUI_PICTURE, created a new event FILEDROP and redefined the methods DISPATCH and SET_REGISTERED_EVENTS to handle the new event. Inside the constructor I've tried to use the method SET_PROPERTY to register the filedrop( As far as I understood the cl_gui_textedit mechanism, that's the main method to generate the sy-ucomm %_GC<ID><EV><Cargo> response from the sapgui when the file is dropped).

When I try to run my program, I'm getting a message type X short dump because of the FMAC_FLUSH_CALL returning a sy-subrc = 3 ( property_set_error ). Debugging a little more I reached the FM OLE_FLUSH_CALL.. and that's a dead end since it does a RFC with the sapgui.

Maybe there is a easier way to do all of this and any help is appreciated!

Best regards,

Adriano SC

1 ACCEPTED SOLUTION

naimesh_patel
Active Contributor

All GUI controls are based on ActiveX controls. Like for ALV Grid (CL_GUI_ALV_GRID), the ActiveX control is SAPGUI.GridViewCtrl.1, and for HTML Viewer (CL_GUI_HTML_VIEWER) , the ActiveX Control is SAP.HTMLControl.1.

All the methods, which are ultimately exposed via SET_ methods by GUI based classes, are the actual methods available in the ActiveX control. E.g. method SET_3D_BORDER of CL_GUI_ALV_GRID calls the method Set3DBorder of the ActiveX Control. You can check the available methods of the an object, using a program ActiveXplorer - View and document OCX/DLL files to browse through the methods of the ActiveX controls.


If you want to leverage any method or property, it has to be available in the ActiveX control. Since you are trying to add the new method in the GUI Class but that method is not available in the ActiveX control, you are getting the error during FMAC_FLUSH_CALL

Thanks,
Naimesh Patel

6 REPLIES 6

former_member201275
Active Contributor
0 Kudos

Looking at sample report SAP_PICTURE_DEMO_DRAG_DROP maybe it will help?

0 Kudos

Thanks for the program Glen, but the kind of event used in that program is internal(as in, from sap gui to sap gui) only as far as I understood. Just like the drag and drop events from cl_gui_alv_tree and similar classes.

former_member258330
Participant
0 Kudos

Fala Adriano. Estes objetos fazem referência com seu comportamento no kernel. É o kernel que dá a resposta para como eles se comportam. Se tentar utilizar um evento que o kernel não está preparado para resolver, ele vai devolver este exception ou erro pra vc.

As redefinições dos métodos vão até este limite. O que depender do kernel já era.

Já tentou fazer isso com o container html? Talvez essa redefinição funcione com ele.

De qualquer forma, é um ótimo desafio.

0 Kudos

Thanks Rapha! that is very interesting

Rough translation to whoever is interested:

Hi Adriano. These objects have their behaviour referenced on the kernel. It is the kernel who responds to how they behave. If you try to use an event that the kernel isn't ready to solve, it will give you an exception or error.

The methods redefinition go to that limit. What depends on the kernel is not good.

Have you tried a HTML container? Maybe this redefinition works with it.

Anyways, this is a good challenge.

naimesh_patel
Active Contributor

All GUI controls are based on ActiveX controls. Like for ALV Grid (CL_GUI_ALV_GRID), the ActiveX control is SAPGUI.GridViewCtrl.1, and for HTML Viewer (CL_GUI_HTML_VIEWER) , the ActiveX Control is SAP.HTMLControl.1.

All the methods, which are ultimately exposed via SET_ methods by GUI based classes, are the actual methods available in the ActiveX control. E.g. method SET_3D_BORDER of CL_GUI_ALV_GRID calls the method Set3DBorder of the ActiveX Control. You can check the available methods of the an object, using a program ActiveXplorer - View and document OCX/DLL files to browse through the methods of the ActiveX controls.


If you want to leverage any method or property, it has to be available in the ActiveX control. Since you are trying to add the new method in the GUI Class but that method is not available in the ActiveX control, you are getting the error during FMAC_FLUSH_CALL

Thanks,
Naimesh Patel

0 Kudos

Hi Naimesh, thanks for the answer!

I've found this blog post from Thomas Jung about using ActiveX in SAP, maybe it can be done! I'll give it a go 😃

http://scn.sap.com/people/thomas.jung/blog/2005/05/11/using-classic-activex-controls-in-the-abap-con...