Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » Setting a color of an OLE-Control
Setting a color of an OLE-Control [message #452022] Sun, 13 March 2005 13:16 Go to next message
Boris Munivrana is currently offline Boris MunivranaFriend
Messages: 23
Registered: July 2009
Junior Member
Hi there,

I haven't figured out yet how to pass a valid color value to an active-x
control encapsulated via swt.ole.win32. As an example, the type library of
a MSComCtl2.MonthView says the following about its ForeColor-Method
(property put):

"[id(0xfffffdff), propput, helpstring("Returns/sets the foreground color
used to display text and graphics in an object."), helpcontext(0x00035c25)]
void ForeColor([in] OLE_COLOR rhs);"

Browsing through the type library with snippet81 "browse the typelibinfo
for a program id", it says:

"PROPERTY PUT (id = -513) : int ForeColor([in] UserDefined pclrForeColor)"

Which value do I have to pass, which datatype/class is required, any help
on that would be strongly appreceated!

Thank you,

Boris
Re: Setting a color of an OLE-Control [message #452077 is a reply to message #452022] Mon, 14 March 2005 10:29 Go to previous messageGo to next message
Tiberiu Caprita is currently offline Tiberiu CapritaFriend
Messages: 68
Registered: July 2009
Member
Hi,
1. You have to read the SWT help about OLes/Activex. There is described
also how to set a property (mainly you have to obtain a OleAutomation, get
the ID of property, and use setProperty()).
2. According to the MSDN help for MonthView
( http://msdn.microsoft.com/library/default.asp?url=/library/e n-us/cmctl298/html/vbpromonthbackcolorproperty.asp),
it is enough to give as Param a valid RGB Color: that is you have to call
setProperty() with a Variant(int).

3. For RGBs, you can take a look on:
http://msdn.microsoft.com/library/default.asp?url=/library/e n-us/gdi/colors_8bvm.asp

then also on the swt implementation of RGB (org.eclipse.swt.graphics).
You'll see that the macro RGB() in SDK is 1To1 with RGB.hashCode(), so
that you can use it to get the int value you have to set.

Grüße,
Tiberiu


Boris Munivrana wrote:

> Hi there,

> I haven't figured out yet how to pass a valid color value to an active-x
> control encapsulated via swt.ole.win32. As an example, the type library of
> a MSComCtl2.MonthView says the following about its ForeColor-Method
> (property put):

> "[id(0xfffffdff), propput, helpstring("Returns/sets the foreground color
> used to display text and graphics in an object."), helpcontext(0x00035c25)]
> void ForeColor([in] OLE_COLOR rhs);"

> Browsing through the type library with snippet81 "browse the typelibinfo
> for a program id", it says:

> "PROPERTY PUT (id = -513) : int ForeColor([in] UserDefined pclrForeColor)"

> Which value do I have to pass, which datatype/class is required, any help
> on that would be strongly appreceated!

> Thank you,

> Boris
Re: Setting a color of an OLE-Control [message #452249 is a reply to message #452077] Tue, 15 March 2005 19:24 Go to previous message
Boris Munivrana is currently offline Boris MunivranaFriend
Messages: 23
Registered: July 2009
Junior Member
Thanks Tiberiu, you were a great help! Haven't expected it to be this
simple.

Cheers,

Boris

Tiberiu Caprita wrote:

> Hi,
> 1. You have to read the SWT help about OLes/Activex. There is described
> also how to set a property (mainly you have to obtain a OleAutomation, get
> the ID of property, and use setProperty()).
> 2. According to the MSDN help for MonthView
>
( http://msdn.microsoft.com/library/default.asp?url=/library/e n-us/cmctl298/html/vbpromonthbackcolorproperty.asp),
> it is enough to give as Param a valid RGB Color: that is you have to call
> setProperty() with a Variant(int).

> 3. For RGBs, you can take a look on:
>
http://msdn.microsoft.com/library/default.asp?url=/library/e n-us/gdi/colors_8bvm.asp

> then also on the swt implementation of RGB (org.eclipse.swt.graphics).
> You'll see that the macro RGB() in SDK is 1To1 with RGB.hashCode(), so
> that you can use it to get the int value you have to set.

> Grüße,
> Tiberiu


> Boris Munivrana wrote:

>> Hi there,

>> I haven't figured out yet how to pass a valid color value to an active-x
>> control encapsulated via swt.ole.win32. As an example, the type library of
>> a MSComCtl2.MonthView says the following about its ForeColor-Method
>> (property put):

>> "[id(0xfffffdff), propput, helpstring("Returns/sets the foreground color
>> used to display text and graphics in an object."), helpcontext(0x00035c25)]
>> void ForeColor([in] OLE_COLOR rhs);"

>> Browsing through the type library with snippet81 "browse the typelibinfo
>> for a program id", it says:

>> "PROPERTY PUT (id = -513) : int ForeColor([in] UserDefined pclrForeColor)"

>> Which value do I have to pass, which datatype/class is required, any help
>> on that would be strongly appreceated!

>> Thank you,

>> Boris
Previous Topic:Dynamic selection of columns
Next Topic:Display timerexec delay limits
Goto Forum:
  


Current Time: Tue Oct 15 21:40:25 GMT 2019

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

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

Back to the top