[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Newsgroup Home]
|
[news.eclipse.newcomer] Re: Paint events in Composite
|
- From: Ric Wright <riwright@xxxxxxxxx>
- Date: Thu, 16 Apr 2009 10:05:39 -0700
- Newsgroups: eclipse.newcomer
- Organization: EclipseCorner
- Thread-index: Acm+s6rB5aYcF1+KNU6wfdWAj1s6TAAAeZj5
- Thread-topic: Paint events in Composite
- User-agent: Microsoft-Entourage/12.15.0.081119
I am reposting to the SWT list as that looks like a more appropriate place.
Sorry for the noise. Of course if anyone does have the answer... :-)
On 4/16/09 9:52 AM, in article C60CB043.2727C%riwright@xxxxxxxxx, "Ric
Wright" <riwright@xxxxxxxxx> wrote:
> I am writing a program that has a rather elaborate "editor" akin to the PDE.
> I have most of it working and am working on the last part of the UI. I have
> a FormPage which hosts a TabFolder which has one or more TabItems in it.
> That all works fine. Now I want to have various kinds of widgets hosted in
> the Tabs. One of them is my JOGL OpenGL view. Normally I simply host it in
> a ViewPart and then instantiate it thusly:
>
> // we can't use the default Composite because using the AWT bridge
>
> // requires that it have the property of SWT.EMBEDDED
>
> Composite composite = new Composite(parent, SWT.EMBEDDED);
>
> // set the layout so our canvas fills the whole control
>
> composite.setLayout(new FillLayout());
>
>
> // create the special frame bridge to AWT
>
> java.awt.Frame glFrame = SWT_AWT.new_Frame(composite);
>
>
> // we need the listener so we get the GL events
>
> this.canvas.addGLEventListener(this);
>
>
> // finally, add our canvas as a child of the frame
> glFrame.add(this.canvas);
>
> This all works fine. I created a new class that subclasses Composite to
> create a GLComposite. I then create an instance of that:
>
> CTabItem viewItem = new CTabItem(tabFolder.SWT.NULL);
> Composite composite = new Composite(tabFolder, SWT.NONE);
> GLComposite glView = new GLComposite(composite);
> ViewItem.setControl(composite);
>
> This all "works" fine - there are no exceptions thrown and I can debug
> through my GL routines, but nothing gets painted on the tab. And my GL
> render only gets called if I explicitly call redraw on the glView object.
>
> So... Any suggestions? What is the proper approach to this? I'll keep
> poking at it, but any suggestions are welcome.
>
> TIA, Ric
>