Adding a St.Entry to a PopupMenu



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






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