Skip to main content


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] Thu, 20 June 2013 00:48 Go to next message
Jesse Weinstein is currently offline Jesse WeinsteinFriend
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: Thu, 20 June 2013 00:52]

Report message to a moderator

Re: Checkbox listener snippet? [message #1064583 is a reply to message #1064569] Thu, 20 June 2013 06:23 Go to previous message
Jagan mohan is currently offline Jagan mohanFriend
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: Fri Apr 26 08:34:02 GMT 2024

Powered by FUDForum. Page generated in 0.02489 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top