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 08:16  |
Eclipse User |
|
|
|
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 05:29   |
Eclipse User |
|
|
|
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 14:24  |
Eclipse User |
|
|
|
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
|
|
|
Goto Forum:
Current Time: Wed Jul 23 08:42:09 EDT 2025
Powered by FUDForum. Page generated in 0.32598 seconds
|