How to stop a left button mouse click?

My issue is, that a click to a dialogbox will also act inside the main window, which I like to avoid.
In my app the main window contains a wx.ClientDC() on which a user can create drawings. Once a user presses the left button, drawing will start (using wx.GetMouseState()).
If now a dialog box is open, moving this dialog box, clicking a button and any other activity, which requires to press the left mouse button, will also create drawings in the main window.
I am looking for a way to stop drawing while a dialog box is open. Any idea is more then welcome!
Many thanks for your comments in advance.

Can’t you just set a flag before dlg.ShowModal() that tells the mouse tracking code to not draw, regardless of button state?

Hi AndersMunch
Thank you - it worked.
And it’s so easy! (I searched for focussing on the dialog [which did not work, since SetFocus works only for wx.frame + will change only the keyboard focus], on manipulating the event loop [which did not work either, since wx.GetMouseState().LeftIsDown() is not an event], …)