Re: gnomemm-list digest, Vol 1 #266 - 3 msgs
Daniel Pixley <[email protected]> 07 Mar 2004 15:36:39 -0800
| Newsgroups | gmane.comp.gnome.gnomemm |
|---|---|
| Message-ID | <[email protected]> |
On Sun, 2004-03-07 at 09:00, [email protected] wrote: > --sdtB3X0nJg68CQEu > Content-Type: text/plain; charset=us-ascii > Content-Disposition: inline > Content-Transfer-Encoding: quoted-printable > > Newbe question: > > Is it possible to do the equivalent of gnome_request_dialog > from gnomemm or gtkmm? I basicly want to ask a question expecting > a text answer.=20 > > Thank You. I too am new to Gtkmm and am working on doing this same thing. Here is where I am at: I am using Glademm to generate the basic GUI outline. I used a 'Dialog Box' (in the Glade tools) to create my popup dialog window. The window is Modal, since the user needs to take care of the popup dialog before anything else happens. An interesting problem I had with Glade is that it is supposed to allow you to create the outline of a signal. A _glade file is created that creates virtual functions to represent your signals. The actual class you use for the signals is inherited from the _glade file. The entire philosophy behind Glade is that the programmer doesn't touch the _glade files, but only the files inherited from the _glade files. But with the 'Dialog' windows created in Glade (basically this allows you to customize your input window with text entries and such), the signals do not get created in the _glade files. I had to break the Glade philosophy by manually inserting the callbacks. This fixed the problem, but still breaks the Glade philosophy. Anyway, now I have a dialog class that I can create in the main program like this: quick_dialog *quick_dialog = new class quick_dialog(); I then run the dialog like so: quick_dialog->run(); At this point, I do the switch statement to decide what was clicked: int result = quick_dialog->run(); switch(result) { case(Gtk::RESPONSE_OK): { //do somemthing (get contents of input) break; } case(Gtk::RESPONSE_CANCEL): { //do something break; } default: { break; } } delete quick_dialog; My problem at this point is writing a function for saving what is in the text entry box when the user clicks the OK button (this is separate than what happens in the above switch statement The above switch statement will have a getInput() function that will return the contents of input to the main program. So, the above switch statement is inside the main program, which creates a quick_dialog object. The quick_dialog object has a signal for the cancel and ok buttons when pressed. This is described below. After the Ok button is clicked, and input is stored, the above switch statement needs to get the contents of input.) I have this so far for: void quick_dialog::on_quick_okbutton1_clicked() { input = *quick_input->get_text(); } Where 'input' is a const gchar*. I get an error saying that the compiler cannot convert a ustring to a gchar, however. I'm not sure why I am getting this error since get_text() is supposed to return a pointer to a gchar, not a ustring. How do I use get_text() to store what is in an entry into a local variable? This post is probably a bit confusing, and I apologize for this. I may also be taking a more difficult route to this problem. If anyone can post some insight, particularly to my problem of returning the result of get_text() to a local variable, please reply. Thanks, Dan