Skip to main content


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 14:59 Go to next message
John Ormerod is currently offline John OrmerodFriend
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 15:54 Go to previous message
Ralf Ebert is currently offline Ralf EbertFriend
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: Fri Apr 26 01:39:21 GMT 2024

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

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

Back to the top