Kirix Support Forums

Problem with Paste Function

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

Problem with Paste Function

Postby miclus on Tue Nov 24, 2009 2:05 pm

Hi. On my right-click context menu in a wxWebControl, it always shows that I can paste even when I can't. Is there a way to fix this?
miclus
Registered User
 
Posts: 10
Joined: Sat Jul 18, 2009 8:56 pm

Re: Problem with Paste Function

Postby Aaron on Tue Nov 24, 2009 4:23 pm

First, create a context menu with "Paste" in an EVT_WEB_SHOWCONTEXTMENU event handler. Then, enable or disable the "Paste" item in this context menu using standard UI update events:

Code: Select all
evt.Enable(m_browser->CanPaste());


A full example of what you're trying to do is contained in the sample application, provided in the download. Here's an example for immediate reference:

Code: Select all
// event table
EVT_WEB_SHOWCONTEXTMENU(wxID_WEB, MyFrame::onShowContextMenu)
EVT_UPDATE_UI(ID_Paste, MyFrame::onUpdateUI)

// context handler
void MyFrame::OnShowContextMenu(wxWebEvent& evt)
{
   wxMenu menuPopup;
   wxString href = evt.GetHref();

   // build context menu ...
}

// update handler
void MyFrame::OnUpdateUI(wxUpdateUIEvent& evt)
{
   int id = evt.GetId();
   switch (id)
   {
       case ID_Paste:
           evt.Enable(m_browser->CanPaste());
           break;
   }
}
Aaron Williams
Kirix Support Team
User avatar
Aaron
Kirix Support Team
 
Posts: 120
Joined: Fri Dec 16, 2005 3:01 pm

Re: Problem with Paste Function

Postby miclus on Thu Nov 26, 2009 2:53 pm

Hi. I did that from the example application. But, it says I can paste when I can't. I will just right-click inside a page for example, and it lets me select paste.
miclus
Registered User
 
Posts: 10
Joined: Sat Jul 18, 2009 8:56 pm

Return to wxWebConnect Questions, Thoughts & Feedback