Drag&Drop zwischen zwei cl_gui_textedit-Objekten

Die Objektorientierung mit ABAP®: Vererbung, Dynamische Programmierung, GUI Controls (u.a. ALV im OO).

Drag&Drop zwischen zwei cl_gui_textedit-Objekten

Postby Dana4867 » Mon Jan 05, 2004 10:05 am

Hallo,

Ich versuche schon seit Tagen erfolglos das folgende Problem zu lösen:

In meinem Dynpro befinden sich 2 Texteditoren. Zwischen diesen beiden Editoren kann man mittels drag&drop Texte austauschen. Nun möchte ich, daß der Event wenn man den Text in dem rechten Editor 'fallen' lässt abgefangen und behandelt wird. Als Programmiergrundlage habe ich das Beispielgprogramm RSDEMO_DRAG_DROP_EDIT_TREE benutzt.
Mein modifiziertes Coding sieht wie folgt aus:

---------------------------------------------------------------------*
CLASS dragdrop_receiver DEFINITION
---------------------------------------------------------------------*
........ *
---------------------------------------------------------------------*
class lcl_dragdrop_receiver definition.
public section.
methods:
drag for event on_drag of cl_gui_textedit.
drop for event on_drop of cl_gui_textedit.
endclass.

data editor1 type ref to cl_gui_textedit.
data editor2 type ref to cl_gui_textedit.

data container1 type ref to cl_gui_custom_container.
data container2 type ref to cl_gui_custom_container.

data behaviour_left type ref to cl_dragdrop.
data behaviour_right type ref to cl_dragdrop.

call screen 100.
*&---------------------------------------------------------------------

*& Module STATUS_0100 OUTPUT
*&---------------------------------------------------------------------

* text
*----------------------------------------------------------------------

module status_0100 output.
set pf-status 'START'.

endmodule. " STATUS_0100 OUTPUT
*&---------------------------------------------------------------------

*& Module test OUTPUT
*&---------------------------------------------------------------------

* text
*----------------------------------------------------------------------
module test output.

create object container1
exporting
container_name = 'CONTAINER1'.

create object editor1
exporting
parent = container1.

create object container2
exporting
container_name = 'CONTAINER2'.

create object editor2
exporting
parent = container2.

break-point.

data effect type i.
* Definition of drag drop behaviour

create object behaviour_left.

effect = cl_dragdrop=>move + cl_dragdrop=>copy.
call method behaviour_left->add
exporting
flavor = 'Drop'
dragsrc = 'X'
droptarget = ' '
effect = effect.

call method editor1->set_dragdrop
exporting dragdrop = behaviour_left.

create object behaviour_right.
effect = cl_dragdrop=>move + cl_dragdrop=>copy.
call method behaviour_right->add
exporting
flavor = 'Drop'
dragsrc = ' '
droptarget = 'X'
effect = effect.

call method editor2->set_dragdrop
exporting dragdrop = behaviour_right.

* registration of drag and drop events
data dragdrop type ref to lcl_dragdrop_receiver.
create object dragdrop.
set handler dragdrop->drag for editor1.
set handler dragdrop->drop for editor2.

endmodule. " test OUTPUT


*---------------------------------------------------------------------*
* CLASS DRAGDROP_RECEIVER IMPLEMENTATION
*---------------------------------------------------------------------*
* ........ *
*---------------------------------------------------------------------*
class lcl_dragdrop_receiver implementation.

method drop.
break-point.
endmethod.

method drag.
break-point.
endmethod.

endclass.


Es wäre schön, wenn jemand in diesem Forum eine Lösung für dieses Problem hätte. Vielen Dank für eure Hilfe im Voraus.
Dana4867
.
.
 
Posts: 2
Joined: Wed Jul 09, 2003 4:16 pm

Drag&Drop

Postby Christopher1784 » Thu Jan 08, 2004 4:22 pm

Hallo tlang,

in deinem Code hast du geschrieben:

Code: [Select all] [Expand/Collapse] [Download] (Untitled.txt)
  1. ...
  2. create object behaviour_left.
  3.  
  4. effect = cl_dragdrop=>move + cl_dragdrop=>copy.
  5. call method behaviour_left->add
  6. exporting
  7. flavor = 'Drop'
  8. dragsrc = 'X'
  9. droptarget = ' '
  10. effect = effect.
  11.  
  12. call method editor1->set_dragdrop
  13. exporting dragdrop = behaviour_left.
  14.  
  15. create object behaviour_right.
  16. effect = cl_dragdrop=>move + cl_dragdrop=>copy.
  17. call method behaviour_right->add
  18. exporting
  19. flavor = 'Drop'
  20. dragsrc = ' '
  21. droptarget = 'X'
  22. effect = effect.
  23. ...
GeSHi ©


wenn ich mich recht entsinne musst du sowohl für die linke, als auch für die rechte Seite bei dragsrc und bei droptarget ein 'X' setzen. Sonst definierst du explizit die eine Seite als Quelle und die andere als Ziel.

Ich hoffe dies klärt dein Problem.

Gwildor
Christopher1784
..
..
 
Posts: 26
Joined: Fri Mar 28, 2003 4:02 pm

Postby Christopher1784 » Thu Jan 08, 2004 4:52 pm

Hi tlang,

sorry, ich glaube ich hatte mich etwas versehen. Dies war ja gar nicht dein Problem :oops:
Aber ich habe trotzdem noch nen Tip für dich:

im PAI-Modul musst du noch folgendes einfügen:

Code: [Select all] [Expand/Collapse] [Download] (Untitled.txt)
  1. call method cl_gui_cfw=>dispatch.
GeSHi ©


Dies ist notwendig, damit der Server mit dem FFrontend auch abgeglichen wird!!!

Hoffe dies hilft dir weiter!![/code]
Christopher1784
..
..
 
Posts: 26
Joined: Fri Mar 28, 2003 4:02 pm

Postby Alva1590 » Fri Jan 09, 2004 8:31 am

Hallo Gwildor,

leider löst das nicht mein Problem, da durch das 'Droppen' des Texts nicht PAI ausgelöst wird. Trotzdem Danke für deine Hilfe.

Viele Grüße,

Thomas
Alva1590
.....
.....
 
Posts: 4387
Joined: Mon Dec 02, 2002 3:01 pm


Return to ABAP Objects®

Who is online

Users browsing this forum: No registered users and 8 guests