views:

28

answers:

1

I am playing a little with drag and drop under gtk#. When calling

protected virtual void OnDragDataGet (object o, Gtk.DragDataGetArgs args)
{
 byte[] data = GetSomeData();
 args.SelectionData.Set(args.Context.Targets[0], 0, data);
}

an error occurs:

Gtk-CRITICAL **: _gtk_selection_request: assertion `(data.format >= 8) && (data.format % 8 == 0)' failed

however setting the format to 8 works fine:

protected virtual void OnDragDataGet (object o, Gtk.DragDataGetArgs args)
{
    byte[] data = GetSomeData();
    args.SelectionData.Set(args.Context.Targets[0], 8, data);
}

I have found some examples on drag and drop, all use 8 as the format for sending the data. (Using 0 was acually a typo.) However I have not found what this format does, or why 8 works, whereas 0 does not.

Can someone explain what "fomat" does ?

A: 

From

http://www.go-mono.com/docs/index.aspx?link=M%3aGtk.SelectionData.Set%28Gdk.Atom%2cSystem.Int32%2cSystem.Byte%5B%5D%29:

format (number of bits in a unit) - set this to 8 and encode your data as UTF-8

Ian Kemp
ok, missed that one. But do you know what it means ?
Nils