Re: popup menu not grabbing focus problems



[SOLVED!!]

Going through the sources, in perticular panel.js, I found that all the
buttons on the panel had their menus registered to the PopupMenuManager
of the panel menu. (Main.panel._menus.addMenu(button.menu);)

Mine didn't, so I tried to do:

	for (let category in this.items) {
            if (this.items[category].length > 0) {
                
                let directory = this.directories[category];
                let appInfo =
			Gio.DesktopAppInfo.new_from_filename(directory);
		if (!appInfo) { global.log('App for desktop
			file ' + directoryPath
			+ ' could not be loaded!'); return;
                }
                
                let button = new QuickLaunchButton(appInfo);
                
                this.actor.add(button.actor);
                
                let item = this.items[category];
                for (let i = 0; i < item.length; i++) {
                    this._addAppItem(item[i], button.menu);
                }
                Main.panel._menus.addMenu(button.menu);
            }
        }
        Main.panel._leftBox.insert_child_at_index(this.actor, 1);


And it worked, all works as should.

Thanks Florian and Jasper for your attention with this.
Probably till soon, with some next problem... :-)

-- 
(o_
//\  Regards, Groeten,
V_/_ Bas Burger.


On Wed, 20 Jun 2012 23:09:32 +0200
Yaa101 <yaa101 xs4all nl> wrote:

> First of all, hello to all, this is my first message to this mailing
> list.
> 
> I am trying to write a gnome shell extension and got into trouble that
> I can't solve, there is so little documentation about the overview of
> how things are connected in the gnome shell.
> 
> Maybe somebody can help me here, I hope so.
> 
> Here goes:
> 
> I am writing an extension that is a variation to both quicklaunch
> extensions, mine is a buttonbar that collects the XDG category of
> a .desktop file and defines a button for each found Main XDG category,
> when clicked on the button a popup menu becomes visible with all
> the .desktop files that carry the category.
> 
> This is where things go rough on me, I am able to show a quicklaunch
> bar, I am able to show each button, I am able to populate the menu
> that is connected to the button, and I am able to open the right
> popup menu when clicking a button.
> 
> But that point is where things go stuck for me, clicking the button
> brings up the menu but the menu does not want to grab the focus and
> sits there, when clicking on the menu, anything that is under it will
> be activated but not the items on the menu.
> 
> I have tried anything in my power to make it grab focus, somehow I
> cannot make the mental picture where I left out a connection or where
> the click event of the button only makes the menu appear without it
> grabbing focus.
> 
> I tried the button being a PanelMenuButton.prototype, I tried the
> buttons without a container, I tried defining my own button with the
> menu connection, none works beyond my current status, all got stuck at
> the same point.
> 
> Can somebody help me on my way?
> Although I am a long time programmer, Javascript does not come natural
> to me so forgive me if I may not understand any directions immediatly.
> 
> 
> Thanks on front.
> 



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