Mailinglist Archive: yast-devel (26 mails)

< Previous Next >
[yast-devel] yast2-qt with Context Menus
  • From: Thomas Goettlicher <thomas.goettlicher@xxxxxxx>
  • Date: Fri, 6 Mar 2009 17:36:39 +0100
  • Message-id: <200903061736.39459.thomas.goettlicher@xxxxxxx>
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:",
] );

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

UI::OpenContextMenu( `menu(
[ `item(`id(`folder), "&Folder" ),
`menu( "&Document",
[ `item(`id(`text),
"&Text File" ),
"&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.

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.



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

< Previous Next >
Follow Ups