ogl question

hi all,

i've got a probably simple ogl related question.

is it possible to add simple widgets like TextCtrl or other non-trivial
widgets into an ogl.ShapeCanvas or even better into an
ogl.CompositeShape. i need connectable widgets on a canvas with an
embedded text widget, and i guess, that's the easiest way.

any hints?

thanks, tim

···

--
tim@klingt.org ICQ: 96771783
http://www.mokabar.tk

Cheat your landlord if you can and must, but do not try to shortchange
the Muse. It cannot be done. You can't fake quality any more than you
can fake a good meal.
  William S. Burroughs

Attached is a sample of a text widget attached to an OGL object. It
doesn't work very well:

When you resize it smaller, you can't see the hint rect because it's
drawn on the canvas, which is clipped under the text control.

You can't move it, because you're clicking on the text control instead.

The first I'm not sure how to fix - I'm not an expert on OGL
internals. It's possible that you can override the hint rect drawing
from within the Shape class, and create a client DC for the "inner"
control instead.

The second could be fixed if you had a control that didn't need to
handle mouse events itself (you could redirect mouse clicks on the
text control, but you'd lose text selection).

So, for this specific purpose, I'd suggest using a standard OGL shape
with text, and add a double-click handler that uses the techniques in
the attached to position a newly created text control. You'll need to
add some other bindings to "vanish" the text control when you're done
(hitting return for single lines, loss of focus, clicking on the
canvas or another control point).

You could also extend the attached to place the text control in one
region of a multi-region control, and the shape could still be moved
by clicking on one of the other regions. The drawing problem still
exists, though.

t.py (2.46 KB)

···

On 2/22/07, Tim Blechmann <tim@klingt.org> wrote:

hi all,

i've got a probably simple ogl related question.

is it possible to add simple widgets like TextCtrl or other non-trivial
widgets into an ogl.ShapeCanvas or even better into an
ogl.CompositeShape. i need connectable widgets on a canvas with an
embedded text widget, and i guess, that's the easiest way.

any hints?

ah, thanks a lot ... it's a good example to show me how to start ...
will play around with it and adapt it to my needs ...

thanks, tim

···

On Thu, 2007-02-22 at 10:52 -0600, Chris Mellon wrote:

On 2/22/07, Tim Blechmann <tim@klingt.org> wrote:
> hi all,
>
> i've got a probably simple ogl related question.
>
> is it possible to add simple widgets like TextCtrl or other non-trivial
> widgets into an ogl.ShapeCanvas or even better into an
> ogl.CompositeShape. i need connectable widgets on a canvas with an
> embedded text widget, and i guess, that's the easiest way.
>
> any hints?
>

Attached is a sample of a text widget attached to an OGL object. It
doesn't work very well:

When you resize it smaller, you can't see the hint rect because it's
drawn on the canvas, which is clipped under the text control.

You can't move it, because you're clicking on the text control instead.

The first I'm not sure how to fix - I'm not an expert on OGL
internals. It's possible that you can override the hint rect drawing
from within the Shape class, and create a client DC for the "inner"
control instead.

The second could be fixed if you had a control that didn't need to
handle mouse events itself (you could redirect mouse clicks on the
text control, but you'd lose text selection).

So, for this specific purpose, I'd suggest using a standard OGL shape
with text, and add a double-click handler that uses the techniques in
the attached to position a newly created text control. You'll need to
add some other bindings to "vanish" the text control when you're done
(hitting return for single lines, loss of focus, clicking on the
canvas or another control point).

You could also extend the attached to place the text control in one
region of a multi-region control, and the shape could still be moved
by clicking on one of the other regions. The drawing problem still
exists, though.
---------------------------------------------------------------------
To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwidgets.org
For additional commands, e-mail: wxPython-users-help@lists.wxwidgets.org

--
tim@klingt.org ICQ: 96771783
http://www.mokabar.tk

Relying on the government to protect your privacy is like asking a
peeping tom to install your window blinds.
  John Perry Barlow