Link to home
Start Free TrialLog in
Avatar of Tolgar
Tolgar

asked on

How to create a check box in the toolbar in SWT?

Hi,
How can I create a check box in the toolbar by using SWT?

I am sending an screen shot in the attachment to give a better idea?

Thanks,
check-box.png
Avatar of Valeri
Valeri
Flag of Bulgaria image

the ToolItem could be of type check box. You can have a custom tool bar "Filtering", but the items should be in a row, not in a column.
In the previous code I have added for you one check box item in the first tab /the last one, the one with name item_2_3/. It is not real check box, but you can change the icon / icon checked | icon not checked /. This is the only way you can implement the check box in the tool bar. Click on "item_2_3". If you choose the right icon, then it's check box. for example see the eighth icon in Eclipse, it's like checkbox.

item12_111 = new ToolItem(custToolBar12.getToolBar(), SWT.CHECK);
Avatar of Tolgar
Tolgar

ASKER

I put the following lines for the checkbox.

        //3rd group
        CustomToolbar custToolBar333 = new CustomToolbar(compTB3, SWT.BORDER, "Filtering");
        
        item3333 = new ToolItem(custToolBar333.getToolBar(), SWT.CHECK);
        item3333.setImage(image_floppy_disk); item3333.setText("Filtering"); item3333.setToolTipText("Filter the results below");
        item3333.addListener(SWT.Selection, toolBarListener);

Open in new window


Obviously, I didn't you the right icon but when when I click on the icon it shows like selected but not like a check box. It's more like a selected button and not selected button.

How can I do it as it is in the attachment that I sent in the first post of this questions?
ASKER CERTIFIED SOLUTION
Avatar of Valeri
Valeri
Flag of Bulgaria image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Tolgar

ASKER

Perfect solution!