How handle drag & drop between 2 list box ? #4
-
Hi Vincent, do you have a sample how manage d&d between listboxes? i.e. how refuse a drop during drop over (aka $0:=-1 in the old way) Regards |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments
-
Hello,
One important thing I'm discovering that you need to know is that it must be the object's method that returns 0 or -1. It can't be the class. That's the purpose of the “dropableWidgetMethod”. And since you ask, I'll do a demo as soon as possible. Regards |
Beta Was this translation helpful? Give feedback.
-
Hi Vincent thank you for the information. Regards |
Beta Was this translation helpful? Give feedback.
-
I somebody is looking for: #DECLARE()->$result : Integer
var $o : Object
$o:=New object("f"; Formula(dropableWidgetMethod))
$result:=$o.f() And in your class you need a function Function _listbox_targetManager($e : cs.ui.evt)->$result : Integer
$result:=0
var $data_bl : Blob
var $data_o : Object
var $c : Collection
Case of
: ($e.code=On Drag Over)
GET PASTEBOARD DATA("appmaker.action.source"; $data_bl)
If (BLOB size($data_bl)>0)
$data:=BLOB to text($data_bl; UTF8 text without length)
$data_o:=JSON Parse($data; Is object)
// Accept or reject the drag event
If (($data_o.value%2)=0)
$result:=0
Else
$result:=-1
End if
End if
: ($e.code=On Drop)
GET PASTEBOARD DATA("appmaker.action.source"; $data_bl)
If (BLOB size($data_bl)>0)
$data:=BLOB to text($data_bl; UTF8 text without length)
$data_o:=JSON Parse($data; Is object)
$c:=This.listbox_target.source
$c.push($data_o)
This.listbox_target.setSource($c)
End if
End case |
Beta Was this translation helpful? Give feedback.
-
In fact, this mechanism is already implemented in a bit more generic way in the component: You have a shared method called “dropableWidgetMethod”.
The mechanism is equivalent to the one you have proposed. There are also other shared methods, for subforms for example... I really have to provide HDIs for these very specific cases. |
Beta Was this translation helpful? Give feedback.
In fact, this mechanism is already implemented in a bit more generic way in the component: You have a shared method called “dropableWidgetMethod”.
“ _<form object name>Manager”
The mechanism is equivalent to the one you have proposed.
There are also other shared methods, for subforms for example...
I really have to provide HDIs for these very specific cases.