One thing I could use some help with if anyone is bored.... I try to 
draw a constant message overtop the FloatCanvas, which is always there 
and always in the same position (top left corner). I did not want to use 
a floatcanvas object for this as I (thought I?) would have to keep 
moving it's position... so my solution is below. It works but I have a 
very strange bug in my program where if you click a wx.Menubar then 
click the FC (which calls FC.Draw), my message disappears until the next 
draw... :(

The code is below... and is super-sloppy. I will work on trying to 
create a small sample with the original FC module that recreates the 
issue (it is probably 99% not a problem with FC). I investigated 
FC.OnPaint but that never seems to get called. For the longest time I 
thought that FC was a subclass of wx.Window ... and this issue made me 
realize the sheer amount of work Chris put in. Chris - cannot thank you 
enough for your effort!

(Code is not clean - ignore my self._options, that is my globals class 
for getting drawing attributes)

<code>

def DrawMessage(self,dc):
        #print "%s.DrawMessage: drawing message..." % (self)
        ScreenDC = dc
        Font = eval(self._options.Get(opt.OPT_WORKSPACE_FONT, dont_print = 
True))
        Font.SetPointSize(12)
        ScreenDC.SetFont(Font)
        ScreenDC.SetBackgroundMode(wx.SOLID)
        ScreenDC.SetBackground(self.BackgroundBrush)
        selection = self._options(opt.OPT_DISPLAY_BRANCH_RESULTS)
        if not selection: selection = 
self._options(opt.OPT_DISPLAY_NODE_RESULTS)
        msg = self.GetShowingText(selection)            
        ScreenDC.DrawText(msg,5,5)
        #Get text height
        w,h = ScreenDC.GetTextExtent('X')
        selection = self._options(opt.OPT_DISPLAY_BRANCH_RESULTS2)
        if not selection: selection = 
self._options(opt.OPT_DISPLAY_NODE_RESULTS2)
        msg = self.GetShowingText(selection)            
        if selection:
            ScreenDC.DrawText(msg,5,5+h)
            draw2 = True
        else:
            draw2 = False
        selection = self._options(opt.OPT_DISPLAY_BRANCH_RESULTS3)
        if not selection: selection = 
self._options(opt.OPT_DISPLAY_NODE_RESULTS3)
        msg = self.GetShowingText(selection)    
        if selection:
            if draw2: ScreenDC.DrawText(msg,5,5+h+h)
            else: ScreenDC.DrawText(msg,5,5+h)

</code>

Thanks,
Ben

_______________________________________________
FloatCanvas mailing list
[email protected]
http://paulmcnett.com/cgi-bin/mailman/listinfo/floatcanvas

Reply via email to