Re: Get MenuElem by name ?
- From: "schmirrwurst free fr" <schmirrwurst free fr>
- To: Paul Davis <pjdavis engineering uiowa edu>
- Cc: gtkmm-list gnome org
- Subject: Re: Get MenuElem by name ?
- Date: Tue, 27 Mar 2007 14:42:47 +0200
Many thanks for your explanations,
In fact I also realised that in the latest source (I hadn't it), the way
to deal with elements is different : Now it is incrementing an index
variable each time the code add an element :
menu_partition .items() .push_back(
Gtk::Menu_Helpers::StockMenuElem( Gtk::Stock::COPY,
sigc::mem_fun(*this, &Win_GParted::activate_copy) ) );
MENU_COPY = index++ ;
allowing to use the variable then, in place of the item number... :
void allow_make_image( bool state ) {
toggle_item( state, MENU_MAKE_IMAGE ) ; }
It was easyer to understand what's happening ! So I achieved to add my
Item !
Thank U !
Le jeudi 22 mars 2007 �4:31 -0500, Paul Davis a �it :
> 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]