Kirix Support Forums

Navigation event

Please post all general questions, comments, bug reports, and any other wxWebConnect feedback here.

Navigation event

Postby ryanstd on Thu Mar 04, 2010 11:52 pm

Hi, I used the wxWebconnect. It's cool. Currently, I need to intercept the navigation event for clicking onthe hyperlinks or submit button to generate content dynamically in the local side. Any idea which event I should add event handler to? I tried the wxEVT_WEB_LOCATIONCHANGE event. But it seems to be generated after the navigation is performed. So when I add a handler for it and call the OpenURI method inside the handler, it ends up in endless loop.
Thanks~
ryanstd
Registered User
 
Posts: 2
Joined: Thu Mar 04, 2010 11:24 pm

Re: Navigation event

Postby Ben on Mon Mar 08, 2010 2:28 pm

Have you tried hooking onto the wxEVT_WEB_OPENURI event? You can intercept this event and, if you want, reject the URI the user clicked on, and then redirect the user using wxWebControl::OpenUri() to the page with your local content.

All the best,
Ben
Ben Williams
Kirix Support Team
User avatar
Ben
Kirix Support Team
 
Posts: 525
Joined: Mon Dec 19, 2005 6:29 am

Re: Navigation event

Postby ryanstd on Mon Mar 08, 2010 8:46 pm

Hi, Ben
Thanks for your reply. I tried the wxEVT_WEB_OPENURI event. If I use the OpenURI in the event handler, it's also an endless lopp and a stack overflow. Here is my code:
Code: Select all
m_browser = new wxWebControl(this, -1, wxPoint(-1,-1), wxSize(800,600));
Connect(m_browser->GetId(),wxEVT_WEB_OPENURI,wxCommandEventHandler(MyPanel::OnOpenURI));
void MyPanel::OnOpenURI(wxCommandEvent& evt)
{
   ...
   m_browser->OpenURI(wxT("http://www.kirix.com"));
}


Ben wrote:Have you tried hooking onto the wxEVT_WEB_OPENURI event? You can intercept this event and, if you want, reject the URI the user clicked on, and then redirect the user using wxWebControl::OpenUri() to the page with your local content.

All the best,
Ben
ryanstd
Registered User
 
Posts: 2
Joined: Thu Mar 04, 2010 11:24 pm

Re: Navigation event

Postby rbalean on Tue Oct 09, 2012 6:50 am

You can use wxEVT_WEB_LEFTDOWN to detect the mouse click. You will then need to check the node to make sure it is a button or link that was clicked. This method allows you to handle the event before you leave the current page.

Regards,
Robin
rbalean
Registered User
 
Posts: 4
Joined: Thu Sep 13, 2012 3:12 am

Return to wxWebConnect Questions, Thoughts & Feedback