Re: how to use gtk::filechooserbutton with gtkmm



On 3/28/07, schmirrwurst free fr <schmirrwurst free fr> wrote:
Thank You for your answer, but I'm not sure to have understood
everything...

You mean I should change like this  :
filechooserb = ( new Gtk::FileChooserButton( "Select Target File",
GTK::FILE_CHOOSER_ACTION_OPEN));
??
I don't use GTK namespace, because in the project I'm modifying, a
specific namespace is used...

Can you explain me what you mean with the header file, is somewhat in it
that should not be ??

the FILE_CHOOSER_ACTION_OPEN enum value is defined inside the Gtk
namespace (note: not GTK), so you must specify the namespace when you
use it.  This is unrelated to which namespace your new code is placed
in.  It's the same reason you need to prefix HBox and VBox with the
namespace Gtk::

Milosz's comment also mentioned that you can avoid prefixing it with
Gtk:: if you add the following line to your source code:
using namespace Gtk;

But it's generally good practice not to add 'using' lines to your
header files because then anybody that includes your header file
automatically has the global namespace 'polluted' with everything
defined in the Gtk namespace.  (This is mostly important for library
headers, not as important for application headers that other people
aren't going to be using, but it's still good practice).
So there's nothing wrong with your header as it is currently, he was
just advising you not to add a 'using' line to the header file (add it
to the .cpp file if you really want to add it).

--
jonner



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]