Mailinglist Archive: yast-devel (26 mails)

< Previous Next >
Re: [yast-devel] yast2-qt with Context Menus
  • From: Stanislav Visnovsky <visnov@xxxxxxx>
  • Date: Mon, 9 Mar 2009 13:58:25 +0100
  • Message-id: <200903091358.25857.visnov@xxxxxxx>
On Piatok 06 March 2009 17:36:39 Thomas Goettlicher wrote:
yast2-qt has support for context menus now.

Context menus are supported by almost all UI frameworks and most people got
used to them. Therefore it’s high time to provide context menus in the YaST
Qt UI as well. yast2-qt-2.18.6 offers this feature, packages are available
in my build service repository.

In four simple steps YCP programmers can benefit from this new feature:

Step 1:
Create a widget and tell via `opt(`contextMenu) that a ContextMenuActivated
Event should be emitted when the user right clicks the widget:

`SelectionBox( `id(`sport), `opt(`notify,`immediate, `contextMenu),
"Open a context menu:",
[
"Item1",
"Item2",
"Item3"
] );

Step 2:
Wait and analyze events:
event = UI::WaitForEvent( ... );
...
if ( event["EventReason"]:”" == “ContextMenuActivated” )
...

Step 3:
Open a context menu. The argument of OpenContextMenu() describes the menu
structure:

UI::OpenContextMenu( `menu(
[ `item(`id(`folder), "&Folder" ),
`menu( "&Document",
[ `item(`id(`text),
"&Text File" ),
`item(`id(`image),
"&Image" ) ]) ] ));

Step 4:
Analyze the returned `id and trigger an action. An example called
ContextMenu.ycp is included in the package yast2-ycp-ui-bindings.

Usability
A Context menu provides shortcuts to actions for a certain widget or item.
This features improves usability when it’s used properly. Application
programmers should avoid making certain features only using context menus
because users might not find them.
Please keep in mind that YaST ncurses doesn’t provide context menus. Each
operation that is only available via a context menu is useless in YaST
ncurses because the user cannot select it.


See: http://lizards.opensuse.org/2009/03/06/yast-qt-ui-with-context-menus/

Very nice!

Now we need ncurses and gtk support ;-)

Stano

--
To unsubscribe, e-mail: yast-devel+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: yast-devel+help@xxxxxxxxxxxx

< Previous Next >
Follow Ups
References