Re: HtmlWindow OnLinkClicked

Kevin Altis <[email protected]>
Newsgroups gmane.comp.python.pythoncard
Message-ID <[email protected]>
On Jun 13, 2007, at 12:12 PM, fabio natali wrote:

> hi guys,
>
> i have a htmlwindow component in my pythoncard script. i wish i could
> modify htmlwindow code the way i read in [0].
>
> unluckily it happens i'm not such a long time python programmer and
> i'm not able to do it. i don't know where i'm supposed to write
> def OnLinkClicked(self, link):
> and the following lines.
>
> (well, actually i could do the job if i modified the main htmlwindow
> file of my pythoncard bundle, but it sounds to be such a dirty way!)
>
> hope that someone will kindly help me.
>
> best regards,
> fabio.
>
> [0] http://aspn.activestate.com/ASPN/Mail/Message/PythonCard/1556758
>
> --  
> fabio natali

I'm not entirely sure why David McNab's suggestion wasn't adopted,  
though it appears it would need some tweaks to work with the various  
types of containers we support now. But in general I think the reason  
we never allowed for directly overriding the event is that  
OnLinkClicked just doesn't work like most wxWidgets events and we  
probably need to create our own wrapper event to do this properly.

Anyway, the solution for you is to create an appcomponents directory  
where you have your main application files. Copy the components/ 
htmlwindow.py file to that directory and modify OnLinkClicked in that  
file to do what you want. Alternatively, create an htmlwindow.py file  
in  the appcomponents directory and subclass the HtmlWindow component  
that only modifies the OnLinkClicked method.

The appcomponents directory is checked for components before  
PythonCard looks at PythonCard/components so that allows you to add  
your own components as well as override any of the defaults.

ka


-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.