[Gambas-devel] About drag & drop

Benoit Minisini gambas at ...1...
Mon Apr 12 21:31:34 CEST 2004


On Sunday 11 April 2004 15:53, Fabien Bodard wrote:
> Sorry i send that here because i don't know why my message never appear on
> gambas user mailing list
>
> How i can use the drag and drop feature?
>
> I don't understand why i can't drop anything directly on a form on other
> non textual object.
>
> I send my test
>
> Fabien

To start a drag
---------------

TheSource.Drag(TheData, [TheTextFormat])

TheSource is the control or the form that is the source of the drag.

TheData is a variant. Actually, text and picture are supported.

TheTextFormat allows you to specify the text MIME type. It must be 
"text/something".


To catch a drag
---------------

Set the Drop control property to TRUE. Be careful! Some controls already 
accept drops: TextBox, TextArea, ... Your drag & drop management may interfer 
with the QT one!

The Drag event is raised when the mouse enters the control. Call "STOP EVENT" 
to cancel it, and to tells the world that you don't want this drop.

In the next version, the Drag event will be sent repeatedly while the mouse 
moves inside the control. The event is stopped when you cancel it.

The Drop event is raised when the user releases the mouse button on the 
control (if the drag was accepted of course).


Getting information about dropped data
--------------------------------------

You get information with the Drag class, WHICH IS A STATIC CLASS, like 
Clipboard.

Drag.Icon: sets the picture you want to see while the mouse is dragged.

Drag.Data: the data dropped.
Drag.Type: the drag type as a constant: Drag.Text or Drag.Image
Drag.Format: the mime type as a string.
Drag.Action: which action the user wants: Drag.Copy, Drag.Link or Drag.Move
Drag.Source: the control source.
Drag.X & Drag.Y: the mouse coordinates inside the destination control.

Drag(Source, Data, Format) is an equivalent of Source.Drag(Data, Format)


The crash of Ron was due to the fact that it sends directly a class into an 
object variable. The interpreter didn't like and crashed. He should raise an 
error instead, shouldn't he ?

-- 
Benoit Minisini
mailto:gambas at ...1...




More information about the Devel mailing list