Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    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
John Ormerod is currently offline John Ormerod
Messages: 39
Registered: January 2010
Member
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
Ralf Ebert is currently offline Ralf Ebert
Messages: 168
Registered: July 2009
Senior Member
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: Sun Apr 20 06:55:54 EDT 2014

Powered by FUDForum. Page generated in 0.01559 seconds