Re: Get MenuElem by name ?



On 3/22/07, schmirrwurst free fr <schmirrwurst free fr> wrote:
Hi,

I try to modify a program to add some features. I would like to add some
menu element...
Those elements are added that way :

 menu_partition .items() .push_back(
Gtk::Menu_Helpers::MenuElem( _("manage flags"),
 sigc::mem_fun( *this, &Win_GParted::activate_manage_flags ) ) );

So I've added my element with the same syntax
menu_partition .items() .push_back(
Gtk::Menu_Helpers::MenuElem( _("Make Image"),
 sigc::mem_fun( *this, &Win_GParted::on_make_image ) ) );

The Problem is that it is not appearing, I guess I have to .show it, but
in the code, it is done later, and with an ID number, and I don't know
it :

menu_partition .items()[ installer_mode ? 9 : 10 ] .show() ;

Is there a way to .show the item by name ? like
menu_partition .items()["Make Image"] .show();
???

Other question, I'm pretty new in gtkmm, can somebody explain me what
the sentense "installer_mode ? 9 : 10" means ??

_______________________________________________
gtkmm-list mailing list
gtkmm-list gnome org
http://mail.gnome.org/mailman/listinfo/gtkmm-list


After you build the menu, you can just call show_all_children on the
window that contains it.  This will recursively call show on all
widgets contained in the window.  This saves you from needing to
remember to call show on every single widget.

bool-expression ? expression-if-true : expression-if-false

Is a conditional operator.  Basically its shorthand for:

if( bool-expression )
{
  expression-if-true ;
}
else
{
  expression-if-false ;
}

But you can inline it into function calls and what not.

Its part of C++ and also appears in at least C and Java and probably
others as well. It can be confusing at first, but comes in handy in a
few places.

HTH,
Paul Davis



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