Re: wxEuphoria: how can I INTERCEPT html link clicks?

new topic     » goto parent     » topic index » view thread      » older message » newer message
ghaberek said...

Okay, I got it now... grin

From wxHtmlWindow docs:

[quote=wxWidgets] Called when user clicks on hypertext link. Default behaviour is to emit a wxHtmlLinkEvent and, if the event was not processed or skipped, call LoadPage and do nothing else. Overloading this method is deprecated; intercept the event instead. [/quote]

So we must do this instead:

procedure on_link_click( atom this, atom event_type, atom id, atom event ) 
 
    atom link 
    sequence href, target 
     
    link = get_link_event_info( event )  -- wxHtmlLinkInfo object 
    href = get_link_href( link )         -- clicked url href 
    target = get_link_target( link )     -- target frame, unused 
     
    -- if the event was not processed or skipped, 
    -- call load_html_page and do nothing else 
     
    load_html_page( html, href ) 
     
end procedure 
set_event_handler( html, get_id(html), wxEVT_COMMAND_HTML_LINK_CLICKED, routine_id("on_link_click") ) 


I had to update wxEuphoria to support this. I've made some other addtions/revisions as well. I'll try to push out a new version ASAP. I guess one release per month wouldn't be too bad... getlost

-Greg

Very good! And thanks a lot! But I gotta ask:
it looks to me that what you've done is to make sure that the event handler
properly handles a click on a link, whereas previously the handler was being
ignored (?), but was nonetheless jumping to the link?

Now, the fix you've made, will that allow, if the jumping to the link stuff is deliberately
not included in the event handler, that something else can programmatically be caused to
occur on clicking on a link?? That's what I'm wanting to be able to do. Maybe
I'm not understanding the action correctly?

(What I mean is, since the jumping to the link DID occur before, even though the
event handler wasn't what was making that happen, will that jump still happen
if I try to intercept the action from within the event handler, with alternative
code? I want the alternative code to act, not the "accidental" jump.)

Dan

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu