Re: Icon click event



Hey,

I'm CC'ing gnome-shell-list, which is probably a better place for this
question.

On Fri, 2011-06-24 at 01:02 +0430, behrooz shafiee wrote:
> i have an icon:
> let Icon = new St.Icon(icon_prop);
> and i want to bind on it a clicked or button-release-event, like a
> button!
> i dont know if it's possible or not!!

It is, but in order to receive events, an actor has to be
"reactive" (blame Clutter, not gnome-shell ;-)

To achieve that, just add
  reactive: true
to icon_prop.

Though a better approach would probably be something like the following:

let icon = new St.Icon(iconProps);
let button = new St.Button({ child: icon });

button.connect('clicked', Lang.bind(this, this._onButtonClicked));


Florian




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