I'm constructing a diagram editor using OGL. I'm getting the initial
drawing working fine. However, I have a node-editing function that
modifies the text of a particular shape that is giving me problems.
It works fine if the diagram has not been scrolled around, but doesn't
draw correctly if the image has been scrolled. Here is what I do
to edit the text of a shape:
dc = wxClientDC(self.parent);
shp.Erase(dc);
shp.ClearText();
shp.txt = text;
shp.AddText(shp.txt);
(w, h) = dc.GetTextExtent(shp.txt);
shp.SetSize(w+20, h+5);
shp.Draw(dc);
# the next line is a kludge required to get the initial drawing
# of the line correct
shp.Move(dc, shp.GetX(), shp.GetY());
The redrawn shape is drawn in the wrong position. Subsequently
though, when I scroll around more, causing the corrupt areas to
be redrawn, they are redrawn correctly.
I must be missing something in the setup of the canvas and
diagram. I used the code in the wxPython demo as the template,
and can't see anything obviously missing though.
Any help, as ever, greatly appreciated!
···
-------------------------------------------------------------------------------------
Jeff Kotula Systems Architecture Manager
Vital Images jkotula@vitalimages.com
Although the module is mathematically correct, the solution
is physically impossible. Either that, or you have actually
created mass and I will apologize for underestimating
your power.
-- Things to Tell Programmers,
Dilbert Short List