Skip to main content



      Home
Home » Eclipse Projects » Rich Client Platform (RCP) » How do I find out the style of an SWT part?(getStyle doesn't return the value set)
How do I find out the style of an SWT part? [message #526301] Fri, 09 April 2010 10:59 Go to next message
Eclipse UserFriend
Hello
I have a feeling that I will have one of those "duh!" moments when I see the answer.

I'm creating the UI from meta-data, so my code doesn't know one part from another. I want to find out if a Button is SWT.PUSH (rather than SWT.CHECK).

I assumed that getStyle() would work, but that returns a valuie of 50331656, whereas SWT.PUSH is 8. I don't OR this with any other style values, so I am at a bit of a loss as to why getStyle() doesn't return 8..

Likewise, I also need to distinguish a 'multi-line edit' Text box from a normal one. I have a feeling that getSyle() is not going to return me the result of SWT.BORDER | SWT.WRAP | SWT.MULTI.

Regards, John
Re: How do I find out the style of an SWT part? [message #526317 is a reply to message #526301] Fri, 09 April 2010 11:54 Go to previous message
Eclipse UserFriend
Hi John,

> I want to find out if a Button is SWT.PUSH (rather than SWT.CHECK).

These are bit-masks, SWT also adds default styles, use this to check for a style:

((btn.getStyle() & SWT.PUSH) > 0)

Greetings,

Ralf


--
http://www.ralfebert.de/blog/
http://twitter.com/ralfebert/
Previous Topic:Invalid Thread Access
Next Topic:[solved] Common Navigator Drag and Drop
Goto Forum:
  


Current Time: Fri Jun 13 19:43:29 EDT 2025

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

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

Back to the top