Using SWT, what is the common way to indicate that a menu item (from a taskbar menu) is the currently active selection? Checkmark? Bold? How is this done with code?
Use the CHECK style during instantiation:
MenuItem menuItem = new MenuItem(menu, SWT.CHECK);
Use getSelection to check status:
boolean isSelected = menuItem.getSelection();
org.eclipse.swt.widgets.MenuItem setSelection(true) / getSelection()
The style of the selection depends on the style of the menu item: CHECK, CASCADE, PUSH, RADIO, SEPARATOR, as in:
(source: developpez.com)
(source: developpez.com)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With