Skip to main content



      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
Eclipse UserFriend
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] by Moderator

Re: Checkbox listener snippet? [message #1064583 is a reply to message #1064569] Thu, 20 June 2013 02:23 Go to previous message
Eclipse UserFriend
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: Thu Jul 03 07:03:56 EDT 2025

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

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

Back to the top