Widget support

Widget support – Drops handled on different widget types

Natively supported widgets

By default, the dropped files are displayed in the widget, e.g. if you drop a file over a GtkEntry, the text value of the widget will be overwritten to the filename.

As not all widgets have such simple values, Gtk2_FileDrop has built-in support for a number of widget classes and acts different on different types.

Widget support
Widget class Action taken
GtkEntry Entry value is replaced with first file
GtkLabel Label text is replaced with first file
GtkButton Label text is replaced with first file if the first and only child is a GtkLabel
GtkToggleButton Label text is replaced with first file if the first and only child is a GtkLabel
GtkRadioButton Label text is replaced with first file if the first and only child is a GtkLabel
GtkCheckButton Label text is replaced with first file if the first and only child is a GtkLabel
GtkCombo The entry text is replaced with the first file. The list is not affected.
GtkFileSelection File name of the file dialog is set to the first dropped file. The directory is changed to the directory name of the file, and the file name (without directory) is set in the file name entry.
GtkList Every accepted file is appended at the end of the list.

Beside the automatic actions, you can specify a callback as the third parameter of the attach function which is called with the widget itself and an array of accepted files as parameters.

Why using Gtk2_FileDrop? (Previous) How to use Gtk2_FileDrop (Next)
Last updated: Sat, 16 Feb 2019 — Download Documentation
Do you think that something on this page is wrong? Please file a bug report.
View this page in:
  • English

User Notes:

There are no user contributed notes for this page.