[fpc-pascal] gtk-file-chooser-button

Michalis Kamburelis michalis at camelot.homedns.org
Sun Jun 4 13:45:00 CEST 2006


Koenraad Lelong wrote:
> Hi,
> I wanted to use a gtk_file_chooser_button, but I couldn't because
> gtk_file_chooser_button_new doesn't exist (v2.0.3 and svn-version). So I
> added it (and some others) in gtkfilechooser.inc (see enclosed diff). Is
> this the right place ? 

I think it should go to separate file gtkfilechooserbutton.inc, to
follow C header convention: it's defined in gtk/gtkfilechooserbutton.h.
You should add this file to gtkincludes.inc somewhere under {$IFDEF
HasGTK2_6} --- for example right after the line {$include
gtkfilechooserentry.inc}.

> I still have to find out how to get the file-name
> out of the control.

You just use the functions of GtkFileChooser, because
GtkFileChooserButton implements GtkFileChooser interface. Translating to
Pascal small example from
[http://developer.gimp.org/api/2.0/gtk/GtkFileChooserButton.html]:

{ Example 6. Create a button to let the user select a file in /etc }
var
  button: PGtkWidget;
begin
  button := gtk_file_chooser_button_new ('Select a file',
                                        GTK_FILE_CHOOSER_ACTION_OPEN);
  gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (button),
                                       '/etc');
end;

So you should be able to just cast "button" to GtkFileChooser and use
all gtk_file_chooser_xxx functions, see
[http://developer.gimp.org/api/2.0/gtk/GtkFileChooser.html].

Michalis



More information about the fpc-pascal mailing list