I was needing the right click event to feed the position as well as property... which most likely could have been done by going the long way and hooking right click of propery grid subclass wxwindow, but instead I modified code a little... here is what I changed
//changed Send event to take a wxPoint
bool SendEvent( int eventType, wxPGProperty* p, wxVariant* pValue = NULL, unsigned int selFlags = 0 , wxPoint pnt = wxPoint(0,0));
adding the following to wxPropertyGridEvent
/** Returns Position of Click for Left Click and Right Click Events */
const wxPoint& GetPosition() const
{
wxASSERT( GetEventType() == wxEVT_PG_RIGHT_CLICK || GetEventType() == EVT_PG_DOUBLE_CLICK);
return m_point;
}
as well as private
wxPoint m_point;
then i changed code in the following function in prop.cpp
bool wxPropertyGrid::HandleMouseRightClick( int WXUNUSED(x), unsigned int WXUNUSED(y),
wxMouseEvent& event )
{
....
// Send right click event.
SendEvent( wxEVT_PG_RIGHT_CLICK, p, NULL, 0, event.GetPosition() );
...
}
bool wxPropertyGrid::SendEvent( int eventType, wxPGProperty* p, wxVariant* pValue, unsigned int WXUNUSED(selFlags), wxPoint pnt )
{
// Send property grid event of specific type and with specific property
wxPropertyGridEvent evt( eventType, m_eventObject->GetId() );
evt.SetPropertyGrid(this);
evt.SetEventObject(m_eventObject);
evt.SetProperty(p);
//added this to support right clicking
//*****************
evt.m_point = pnt;
//*****************
if ( pValue )
{
evt.SetCanVeto(true);
evt.SetupValidationInfo();
m_validationInfo.m_pValue = pValue;
}
wxEvtHandler* evtHandler = m_eventObject->GetEventHandler();
evtHandler->ProcessEvent(evt);
return evt.WasVetoed();
}
i am not real familar with producing patches so i thought i would just post it here :).. not sure everyone would want to do this anywho... but here is how i used it
//editProp is a property grid and event is a wxPropertyGridEvent
editProp->PopupMenu(fieldsMenu,event.GetPosition());
Logged In: YES
user_id=2208223
Originator: YES
i did forget to update other click functions... but they would be similar to RightClick one i posted
Logged In: YES
user_id=1193883
Originator: NO
Hi,
Is there some problem with using ::wxGetMousePosition()?
Jaakko