Thanks Ricargo, that's what I've done I think.
Here is my code if you can drop an eye that would help a lot!
Cheers
Raphael
class BlackboardWindow(wx.Window):
maxThickness = 16
def __init__(self, parent, window, ID, appliClass, id):
wx.Window.__init__(self, parent, ID,
style=wx.NO_FULL_REPAINT_ON_RESIZE, size=(450,405))
self.window = window
self.appliClass = appliClass
self.textMode = False
self.textDialog = False
dt = InputFileDropTarget(frame = self)
self.SetDropTarget(dt)
self.erase = False
self.SetCursor(wx.StockCursor(wx.CURSOR_PENCIL))
# hook some mouse events
self.Bind(wx.EVT_LEFT_DOWN, self.OnLeftDown)
self.Bind(wx.EVT_LEFT_UP, self.OnLeftUp)
self.Bind(wx.EVT_RIGHT_UP, self.OnRightUp)
self.Bind(wx.EVT_MOTION, self.OnMotion)
# the window resize event and idle events for managing the buffer
self.Bind(wx.EVT_SIZE, self.OnSize)
self.Bind(wx.EVT_IDLE, self.OnIdle)
# and the refresh event
self.Bind(wx.EVT_ERASE_BACKGROUND, self.OnEraseBackground)
# When the window is destroyed, clean up resources.
self.Bind(wx.EVT_WINDOW_DESTROY, self.Cleanup)
def Cleanup(self, evt):
if hasattr(self, "menu"):
self.menu.Destroy()
del self.menu
def InitBuffer(self):
"""Initialize the bitmap used for buffering the display."""
size = self.GetClientSize()
self.buffer = wx.EmptyBitmap(max(1,size.width), max(1,size.height))
dc = wx.BufferedDC(None, self.buffer)
dc.SetBackground(wx.Brush(self.GetBackgroundColour()))
dc.Clear()
self.DrawLines(dc)
self.reInitBuffer = False
def OnLeftUp(self, event):
"""called when the left mouse button is released"""
if not self.textMode:
if self.HasCapture():
self.lines.append(
(self.colours[self.appliClass.getColour()], self.thickness, self.curLine) )
if self.colour == "White":
self.appliClass.Communications.sendDrawing([self.id, 0,
self.curLine])
else:
self.appliClass.Communications.sendDrawing([self.id,
self.thickness, self.curLine])
self.curLine =
self.ReleaseMouse()
else:
if not self.textDialog:
self.SetCursor(wx.StockCursor(wx.CURSOR_ARROW))
textDialog = wx.TextEntryDialog(self.window.panel, "type in
the text to insert", "type in the text to insert")
self.textDialog = True
if textDialog.ShowModal() == wx.ID_OK:
text = textDialog.GetValue()
self.write(text, self.pos, None,
self.colours[self.appliClass.getColour()])
self.appliClass.Communications.sendDrawing([self.id, 'T',
str(self.pos.x) + ";" + str(self.pos.y) + ";" + text ]) # we use the format
as for a line to make things easy
self.textDialog = False
self.SetCursor(wx.StockCursor(wx.CURSOR_IBEAM))
···
----- Original Message -----
From: "Ricardo Pedroso" <ricardo.pedroso@netvisao.pt>
To: <wxPython-users@lists.wxwidgets.org>
Sent: Thursday, August 25, 2005 7:48 PM
Subject: Re: [wxPython-users] Dialog over Window
On Wed, 2005-08-24 at 10:55 +0100, Raphael Arbuz wrote:
> ----- Original Message -----
> From: "Ricardo Pedroso" <ricardo.pedroso@netvisao.pt>
> To: <wxPython-users@lists.wxwidgets.org>
> Sent: Wednesday, August 24, 2005 3:39 AM
> Subject: Re: [wxPython-users] Dialog over Window
>
>
> > On Tue, 2005-08-23 at 17:02 +0100, Raphael Arbuz wrote:
> > > Hello,
> > >
> > > When I open a textEntryDialog above a blackboard window, where the
> > > EVT_LEFT_DOWN has been binded, when I click in the dialog box,
wxpython
> > > considers that I clicked in the window behind.
> > >
> > > Does anyone have a clue?
> > >
> >
> > Are you using Show() or ShowModal() to open the TextEntryDialog?
> >
> > Ricardo
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwidgets.org
> > For additional commands, e-mail:
wxPython-users-help@lists.wxwidgets.org
> >
> I have tried both, with sadly the same result.
I don't understand what really is your problem, so I attached a small
sample. See if it's the behavior you want.
Ricardo
----------------------------------------------------------------------------
----
---------------------------------------------------------------------
To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwidgets.org
For additional commands, e-mail: wxPython-users-help@lists.wxwidgets.org