Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » Checkbox listener snippet?
Checkbox listener snippet? [message #1064569] Wed, 19 June 2013 20:48 Go to next message
Jesse Weinstein is currently offline Jesse Weinstein
Messages: 44
Registered: July 2012
Member
I'm trying to toggle the visibility of a Control based on whether or not a checkbox is checked. This seems like something that should be obvious, but I can't find any snippet or example that shows the preferred way to achieve this. Once I find out, I'd like to submit one.

My investigation found that a SWT.Selection listener is fired when the box is checked or unchecked, I can use getSelection() to tell if it is checked, and if the button is final, it can be accessed in the listener, so that works, but I'm not at all sure if this the preferred way to do it. Thoughts?

[Updated on: Wed, 19 June 2013 20:52]

Report message to a moderator

Re: Checkbox listener snippet? [message #1064583 is a reply to message #1064569] Thu, 20 June 2013 02:23 Go to previous message
Jagan mohan is currently offline Jagan mohan
Messages: 8
Registered: December 2010
Junior Member
how did u create checkbox?

new Button(parent, SWT.Check);

you can get the source from event and then typecast it to button and u can getselection from that.

otherwise u can directly use the variable for button by making it final or field variable for getting selection

-Jagan
Previous Topic:Getting the 'Application' property of a Word OleClientSite returns null
Next Topic:change table backroung colors
Goto Forum:
  


Current Time: Sun Apr 20 18:09:20 EDT 2014

Powered by FUDForum. Page generated in 0.06988 seconds