wx.INVERT issues

Hi all,

I recently was informed about the SetLogicalFunction(wx.INVERT) in
order to draw a line on the screen and have it follow the cursor and
then delete the last known line coords. It works excellent except I run
into a problem with the wx.INVERT when I use certain built in functions
of wxpython. For example if I call self.Refresh() this will act as a
call to wx.INVERT and I will lose my tracking of the procedure thus
drawing a random line and it not being erased. Is there a way to turn
it off unless you are within the function using it?
Thanks
-cole

Cole Harris
Enterasys Networks
Phone: 978-684-1652
Email: coharris@enterasys.com
www. http://www.enterasys.com

···

-----Original Message-----
From: Will McGugan [mailto:willmcgugan@gmail.com]
Sent: Thursday, September 08, 2005 11:00 AM
To: wxPython-users@lists.wxwidgets.org
Subject: Re: [wxPython-users] Open a URL with the default browser from
an HtmlWindow?

Peter L. Buschman wrote:

I'm not sure if I'm using the wrong control here, but I have a dialog
that contains some simple
formatted HTML using an HtmlWindow and want to include a hyperlink
that, when clicked, opens
the URL in the user's default web browser.

Is this possible with an HtmlWindow? So far, the only effect I am
able to produce is that of the URL
being loaded within the HtmlWindow itself...

You need to catch the click then get the link. Derive from an htmlwindow

and define OnLinkClicked.

eg.

     def OnLinkClicked(self, link):

          href = link.GetHref()
          App.OnLink(href)

Here's what I use to launch the browser..

        if href.startswith("http") or href.startswith("mailto:"):
            wx.BeginBusyCursor()
            import webbrowser
            webbrowser.open(href)
            wx.EndBusyCursor()

You can do whatever you want with the link, its an excellent way to
create dynamic interfaces..

Will McGugan
--

---------------------------------------------------------------------
To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwidgets.org
For additional commands, e-mail: wxPython-users-help@lists.wxwidgets.org

Harris, Cole wrote:

Hi all,

I recently was informed about the SetLogicalFunction(wx.INVERT) in
order to draw a line on the screen and have it follow the cursor and
then delete the last known line coords. It works excellent except I run
into a problem with the wx.INVERT when I use certain built in functions
of wxpython. For example if I call self.Refresh() this will act as a
call to wx.INVERT and I will lose my tracking of the procedure thus
drawing a random line and it not being erased. Is there a way to turn
it off unless you are within the function using it? Thanks
-cole

Probably best is to put a call to GetLogicalFunction() at the start of your function to draw the rubber-band, and then restore it when done .....

e.g.
def rubberBand(... DC, ...):
    initialMode = DC.GetLogicalFunction()
    DC.SetLogicalFunction(wxINVERT)
   ......
   // whatever you do for the rubber band ..
   ....
    DC.SetLogicalFunction(initialMode)
    return

You could cheat and simply restore it to wxCOPY (the default), and ensure that any other places which change the mode also restore to wxCOPY - but I prefer the above.

···

--
Alex Tweedly http://www.tweedly.net

--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.344 / Virus Database: 267.10.19/93 - Release Date: 08/09/2005