Re: modifiable dialog button labels?








________________________________
From: Roger Davis <rbd soest hawaii edu>
To: gtk-app-devel-list gnome org 
Sent: Wednesday, March 7, 2012 7:59 PM
Subject: modifiable dialog button labels?


Hi all,

I am trying to code some reusable GtkDialogs (i.e., create them only once,
then hide and reuse them later as necessary rather than destroying and 
recreating every time). I need numerous dialogs which ask a simple question
and then have two buttons for the user to choose between, e.g.,

    Favorite drink? Wine/Beer
    Which way? North/South

(Poor examples maybe, but you get the idea.) Seems like a waste to create
a bunch of different dialogs that are all using the same basic structure,
I would prefer to just create one and then modify its elements as needed.

I can see how to change a text label inserted into the dialog's content area
to alter my question text, but so far have discovered no way to alter the
text labels used in the buttons which I supply at creation time to
gtk_dialog_new_with_buttons(). Seems like this ought to be an easy thing
to do, but I can see no way to retrieve any pointer to the dialog's button
objects nor any way to explicitly set their labels after the dialog
has been created. Any ideas?  

Thanks!

Roger Davis
_

you can use gtk_get_action_area() to get the GtkBox that that is the action area, that itself contains the 
buttons.  I believe you can then get all the child widgets, which would be the GtkButtons.

The  docs for GtkDialog describes it some, but doesn't talk about getting the buttons.  I think you would 
have to go to the page for GtkBox for how to get the children.

-lsd






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