Re: Some questions
- From: Dennis Craven <arker rogers com>
- To: Mattos <ozharu yahoo com>
- Cc: gtkmm-list gnome org
- Subject: Re: Some questions
- Date: Wed, 12 Jan 2005 20:17:48 -0500
On Wed, 2005-01-12 at 15:38 -0800, Mattos wrote:
> im programming an aplication that when i push a button
> a new dialog should appear asking to the user for his
> name, address and age. I connect the click signal to a
> function that create a new dialog. But how can i add
> the information that i get from the dialog to my class
> user_information created in main.cc ?
>
If you created a class for your dialog by inheriting from Gtk::Dialog,
then you can define member functions in that class that return the
required information. For example, if your dialog has a Gtk::Entry that
the user inputs their name into, then
Glib::ustring MyDialog::Name()
{
return iNameEntry->get_text();
}
would work (or something like that). Basically, you would create and run
the dialog like this:
MyDialog dlg;
if (dlg.run() == Gtk::RESPONSE_OK) {
dlg.hide();
Glib::ustring name(dlg.Name());
}
Then the variable "name" contains the user's name. I never tried to
compile this code, but on a quick scan it looks reasonable.
Have a look here ( http://tinyurl.com/5shsr ) for more info on using
Dialogs. The FileChooser example gets the file name chosen by the user
via the get_filename() function.
HTH,
~djc
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]