Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [platform-swt-dev] CheckBox MenuItem

Note that questions like this are better asked in the Eclipse newsgroup.

You can't add a checkbox item to a menu bar itself, but to a menu item that
descends from a menu bar:

public static void main(String[] args) {
      final Shell s = new Shell();
      final Display d = s.getDisplay();
      s.setBounds(100, 100, 100, 100);
      s.setMenuBar(new Menu(s,SWT.BAR));
      MenuItem mii = new MenuItem(s.getMenuBar(),SWT.CASCADE);
      mii.setText("Drop down");
      Menu m = new Menu(s.getMenuBar());
      mii.setMenu(m);
      MenuItem i1 = new MenuItem(m,SWT.CHECK);
      i1.setText("Checkmark item");
      s.open();
      while (!s.isDisposed()) {
            if (!d.readAndDispatch())
                  d.sleep();
      }
}

On a popup:

public static void main(String[] args) {
      Shell s = new Shell();
      Display d = s.getDisplay();
      s.setBounds(10,10,100,100);
      Table t = new Table(s,SWT.NONE);
      t.setBounds(10,10,80,60);
      Menu m = new Menu(t);
      MenuItem mi = new MenuItem(m,SWT.CHECK);
      mi.setText("Menu Item");
      t.setMenu(m);
      s.open();
      while(!s.isDisposed()) {
            if(!d.readAndDispatch()) d.sleep();
      }
}

Grant




|---------+---------------------------------->
|         |           "Jack R."              |
|         |           <radienssmgs2@hotmail.c|
|         |           om>                    |
|         |           Sent by:               |
|         |           platform-swt-dev-admin@|
|         |           eclipse.org            |
|         |                                  |
|         |                                  |
|         |           11/06/2002 04:42 PM    |
|         |           Please respond to      |
|         |           platform-swt-dev       |
|         |                                  |
|---------+---------------------------------->
  >----------------------------------------------------------------------------------------------------------|
  |                                                                                                          |
  |        To:      <platform-swt-dev@xxxxxxxxxxx>                                                           |
  |        cc:                                                                                               |
  |        Subject: [platform-swt-dev] CheckBox MenuItem                                                     |
  >----------------------------------------------------------------------------------------------------------|



All,

Is it possible to create CheckBox Menu Item in SWT? I don't see that is
being use in Eclipse itself, I am wondering if I can create an eclipse
plugins with CheckBox Menu Item on the menu bar and on the popup menu also.
If yes, can you tell me where I can find an example.

Thank you.
_______________________________________________
platform-swt-dev mailing list
platform-swt-dev@xxxxxxxxxxx
http://dev.eclipse.org/mailman/listinfo/platform-swt-dev






Back to the top