VE and Custom-Widgets [message #76815] |
Fri, 14 January 2005 10:56  |
Eclipse User |
|
|
|
Hi,
Is it possible to use custom widgets in VE. The problem I'm facing is
that SWT-Widget should not be subclassed and that's why I'm going to
layout my classes in the following manner:
--------------------8<--------------------
Object
+ AbstractSwtWidget
+ SingleValueField (uses an org.eclipse.swt.Text)
+ TextField
+ NumberField
+ DateField
+ FormattedField
+ MultiValueField
+ DropDown (uses an org.eclipse.swt.Combo)
+ ListBox (uses an org.eclipse.swt.List )
--------------------8<--------------------
All of these fields have at least these constructors:
* TextField() // not really useful but without its not a been
* TextField(Composite parent, int style) // same than all SWT-Widgets
Can I use something like that in VE out of the box (I assume not)?
What has to done to use something like that in VE?
Can there be done at all?
Does this also suffer from the problem but there is a solution to this
problem? I think this is the preferred way in SWT to create your own
widget if I have understood the docs appropiately.
----------------8<----------------
Object
+ DateField (uses an org.eclipse.swt.Text)
+ NumberField (uses an org.eclipse.swt.Text)
----------------8<----------------
Are there any known problem regarding eclipse-3.1M4 and VE because on
eclipse 3.0.1 everything is working as expected but eclipse 3.1M4 I get
a ClassCastException
Tom
|
|
|
|
|
|
|
|
|
Re: VE and Custom-Widgets [message #77345 is a reply to message #77331] |
Mon, 17 January 2005 09:54  |
Eclipse User |
|
|
|
Originally posted by: richkulp.us.NO_SPAM.ibm.com
That's a good question. We've never tested it, so I don't know. Give it
a try, but make sure you have a constructor of
public TextColumn (Table parent, int style)
Tom Schindl wrote:
> Ok. I have now rethought my Object-Structure and use a MVC. One more
> question what when it comes to table-controls. Can I also have a:
>
> TextColumn (extends TableColumn) and use it in the VE?
>
> Tom
>
> Rich Kulp wrote:
>
>> No, I meant in addition. You need the right constructor and you need
>> to inherit from Composite or Canvas.
>>
>>
>>
--
Thanks,
Rich Kulp
|
|
|
Re: VE and Custom-Widgets [message #604431 is a reply to message #76815] |
Fri, 14 January 2005 11:19  |
Eclipse User |
|
|
|
Tom Schindl wrote:
> Hi,
>
> Is it possible to use custom widgets in VE. The problem I'm facing is
> that SWT-Widget should not be subclassed and that's why I'm going to
> layout my classes in the following manner:
>
> --------------------8<--------------------
> Object
> + AbstractSwtWidget
> + SingleValueField (uses an org.eclipse.swt.Text)
> + TextField
> + NumberField
> + DateField
> + FormattedField
> + MultiValueField
> + DropDown (uses an org.eclipse.swt.Combo)
> + ListBox (uses an org.eclipse.swt.List )
> --------------------8<--------------------
>
> All of these fields have at least these constructors:
>
> * TextField() // not really useful but without its not a been
> * TextField(Composite parent, int style) // same than all SWT-Widgets
Rich or somebody please correct me if I'm wrong, but I don't believe
this will work in VE because it does not inherit from anywhere in the
SWT class hierarchy.
The way SWT itself does this sort of thing is to subclass either Canvas
or Composite and draw or embed the other control inside. See CLabel,
CCombo, etc. (the classes that begin with an extra 'C'.
If you subclass Composite, you can even use VE to design your new
control. :-)
Once you have your custom control written, you can use the "Choose Bean"
button on the tool bar to place it on your form.
Or read any of several recent threads about how to add your control to
the palette.
Regards,
Dave Orme
--
Visual Editor Project leader
db4objects Senior Engineer (www.db4o.com)
Essential Data Project maintainer (essentialdata.sf.net)
|
|
|
Re: VE and Custom-Widgets [message #604441 is a reply to message #76832] |
Fri, 14 January 2005 11:39  |
Eclipse User |
|
|
|
David Orme wrote:
>
> The way SWT itself does this sort of thing is to subclass either Canvas
> or Composite and draw or embed the other control inside. See CLabel,
> CCombo, etc. (the classes that begin with an extra 'C'.
>
> If you subclass Composite, you can even use VE to design your new
> control. :-)
>
> Once you have your custom control written, you can use the "Choose Bean"
> button on the tool bar to place it on your form.
>
So this would work?
-------------------8<-------------------
Object
+ AbstractSwtWidget (extends org.eclipse.swt.Composite)
+ SingleValueField (uses an org.eclipse.swt.Text)
+ TextField
+ NumberField
+ DateField
+ FormattedField
+ MultiValueField
+ DropDown (uses an org.eclipse.swt.Combo)
+ ListBox (uses an org.eclipse.swt.List )
-------------------8<-------------------
> Or read any of several recent threads about how to add your control to
> the palette.
>
>
> Regards,
>
> Dave Orme
|
|
|
Re: VE and Custom-Widgets [message #604454 is a reply to message #76864] |
Fri, 14 January 2005 13:43  |
Eclipse User |
|
|
|
Originally posted by: richkulp.us.NO_SPAM.ibm.com
As long as your constructor is
xyz(Composite parent, int style)
Then we should be able to handle it.
Tom Schindl wrote:
> David Orme wrote:
>
>>
>> The way SWT itself does this sort of thing is to subclass either
>> Canvas or Composite and draw or embed the other control inside. See
>> CLabel, CCombo, etc. (the classes that begin with an extra 'C'.
>>
>> If you subclass Composite, you can even use VE to design your new
>> control. :-)
>>
>> Once you have your custom control written, you can use the "Choose
>> Bean" button on the tool bar to place it on your form.
>>
>
> So this would work?
>
> -------------------8<-------------------
> Object
> + AbstractSwtWidget (extends org.eclipse.swt.Composite)
> + SingleValueField (uses an org.eclipse.swt.Text)
> + TextField
> + NumberField
> + DateField
> + FormattedField
> + MultiValueField
> + DropDown (uses an org.eclipse.swt.Combo)
> + ListBox (uses an org.eclipse.swt.List )
> -------------------8<-------------------
>
>> Or read any of several recent threads about how to add your control to
>> the palette.
>>
>>
>> Regards,
>>
>> Dave Orme
>
>
>
--
Thanks,
Rich Kulp
|
|
|
Re: VE and Custom-Widgets [message #604528 is a reply to message #76911] |
Sun, 16 January 2005 08:06  |
Eclipse User |
|
|
|
Hi Rich,
do you mean that I could use the structure without deriving my
widget from a composite?
Tom
Rich Kulp wrote:
> As long as your constructor is
>
> xyz(Composite parent, int style)
>
> Then we should be able to handle it.
>
> Tom Schindl wrote:
>
>> David Orme wrote:
>>
>>>
>>> The way SWT itself does this sort of thing is to subclass either
>>> Canvas or Composite and draw or embed the other control inside. See
>>> CLabel, CCombo, etc. (the classes that begin with an extra 'C'.
>>>
>>> If you subclass Composite, you can even use VE to design your new
>>> control. :-)
>>>
>>> Once you have your custom control written, you can use the "Choose
>>> Bean" button on the tool bar to place it on your form.
>>>
>>
>> So this would work?
>>
>> -------------------8<-------------------
>> Object
>> + AbstractSwtWidget (extends org.eclipse.swt.Composite)
>> + SingleValueField (uses an org.eclipse.swt.Text)
>> + TextField
>> + NumberField
>> + DateField
>> + FormattedField
>> + MultiValueField
>> + DropDown (uses an org.eclipse.swt.Combo)
>> + ListBox (uses an org.eclipse.swt.List )
>> -------------------8<-------------------
>>
>>> Or read any of several recent threads about how to add your control
>>> to the palette.
>>>
>>>
>>> Regards,
>>>
>>> Dave Orme
>>
>>
>>
>>
>
|
|
|
Re: VE and Custom-Widgets [message #604542 is a reply to message #77101] |
Sun, 16 January 2005 16:12  |
Eclipse User |
|
|
|
Originally posted by: richkulp.us.NO_SPAM.ibm.com
No, I meant in addition. You need the right constructor and you need to
inherit from Composite or Canvas.
--
Thanks,
Rich Kulp
|
|
|
Re: VE and Custom-Widgets [message #604589 is a reply to message #77143] |
Mon, 17 January 2005 09:30  |
Eclipse User |
|
|
|
Ok. I have now rethought my Object-Structure and use a MVC. One more
question what when it comes to table-controls. Can I also have a:
TextColumn (extends TableColumn) and use it in the VE?
Tom
Rich Kulp wrote:
> No, I meant in addition. You need the right constructor and you need to
> inherit from Composite or Canvas.
>
>
>
|
|
|
Re: VE and Custom-Widgets [message #604595 is a reply to message #77331] |
Mon, 17 January 2005 09:54  |
Eclipse User |
|
|
|
Originally posted by: richkulp.us.NO_SPAM.ibm.com
That's a good question. We've never tested it, so I don't know. Give it
a try, but make sure you have a constructor of
public TextColumn (Table parent, int style)
Tom Schindl wrote:
> Ok. I have now rethought my Object-Structure and use a MVC. One more
> question what when it comes to table-controls. Can I also have a:
>
> TextColumn (extends TableColumn) and use it in the VE?
>
> Tom
>
> Rich Kulp wrote:
>
>> No, I meant in addition. You need the right constructor and you need
>> to inherit from Composite or Canvas.
>>
>>
>>
--
Thanks,
Rich Kulp
|
|
|
Powered by
FUDForum. Page generated in 0.05560 seconds