Re: Adding a St.Entry to a PopupMenu



I bumped into something like this. I ended up disabling events to handle it: Like this:

this._promptMenuItem.disconnect(this._promptMenuItem._activateId);
this._promptMenuItem.disconnect(this._promptMenuItem._activeChangeId);
this._promptMenuItem.disconnect(this._promptMenuItem._sensitiveChangeId);

here _promptMenuItem is a menu item with an St.Entry in it.

Hope this helps. I'll be following this to see what people who are more knowledgeable than me recommend.

Dave

On Sat, Dec 17, 2011 at 12:24 PM, Alessandro Crismani <alessandro crismani gmail com> wrote:
Hi all,

I am trying to write an extension that adds a Popup menu to the top
panel. I would like to add an St.Entry to the Popup menu to input a
search term. I've tried with:

       this._searchEntry = new PopupMenu.PopupMenuItem("");
       this._search = new St.Entry({ name: 'searchEntry',
                                    hint_text: _("Type to search..."),
                                    track_hover: true,
                                    can_focus: true });
       this._text = this._search.clutter_text;
       this._text.connect('text-changed', Lang.bind(this,
this._onKeyPress));
       this._searchEntry.addActor(this._search, { align:
St.Align.End });
       this.menu.addMenuItem(this._searchEntry);

This adds the search entry to the Popup Menu, but when I click on it the
menu closes (as if I clicked a standard menu item) instead of giving
focus to the entry.

What is the right way to add a St.Entry as a menu item?

Cheers,
Alessandro




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



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