git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@59450
c3d73ce0-8a6f-49c7-b76d-
6d57e0e08775
+ void DoAddButton( wxWindow* button, const wxSize& sz );
+
int GenId( int id ) const;
wxArrayPtrVoid m_buttons;
int GenId( int id ) const;
wxArrayPtrVoid m_buttons;
if ( event.GetId() == buttons->GetButtonId(0) )
{
if ( event.GetId() == buttons->GetButtonId(0) )
{
- // Do something when first button is pressed
- return true;
+ // Do something when the first button is pressed
+ // Return true if the action modified the value in editor.
+ ...
}
if ( event.GetId() == buttons->GetButtonId(1) )
{
}
if ( event.GetId() == buttons->GetButtonId(1) )
{
- // Do something when second button is pressed
- return true;
+ // Do something when the second button is pressed
+ ...
}
if ( event.GetId() == buttons->GetButtonId(2) )
{
}
if ( event.GetId() == buttons->GetButtonId(2) )
{
- // Do something when third button is pressed
- return true;
+ // Do something when the third button is pressed
+ ...
}
}
return wxPGTextCtrlEditor::OnEvent(propGrid, property, ctrl, event);
}
}
return wxPGTextCtrlEditor::OnEvent(propGrid, property, ctrl, event);
if ( event.GetId() == buttons->GetButtonId(0) )
{
if ( event.GetId() == buttons->GetButtonId(0) )
{
- // Do something when first button is pressed
+ // Do something when the first button is pressed
wxLogDebug("First button pressed");
wxLogDebug("First button pressed");
+ return false; // Return false since value did not change
}
if ( event.GetId() == buttons->GetButtonId(1) )
{
}
if ( event.GetId() == buttons->GetButtonId(1) )
{
- // Do something when second button is pressed
- wxLogDebug("Second button pressed");
- return true;
+ // Do something when the second button is pressed
+ wxMessageBox("Second button pressed");
+ return false; // Return false since value did not change
}
if ( event.GetId() == buttons->GetButtonId(2) )
{
}
if ( event.GetId() == buttons->GetButtonId(2) )
{
- // Do something when third button is pressed
- wxLogDebug("Third button pressed");
- return true;
+ // Do something when the third button is pressed
+ wxMessageBox("Third button pressed");
+ return false; // Return false since value did not change
}
}
return wxPGTextCtrlEditor::OnEvent(propGrid, property, ctrl, event);
}
}
return wxPGTextCtrlEditor::OnEvent(propGrid, property, ctrl, event);
wxVariant pendingValue(selected->GetValueRef());
wxWindow* wnd = GetEditorControl();
wxVariant pendingValue(selected->GetValueRef());
wxWindow* wnd = GetEditorControl();
+ wxWindow* editorWnd = wxDynamicCast(event.GetEventObject(), wxWindow);
int selFlags = 0;
bool wasUnspecified = selected->IsValueUnspecified();
int usesAutoUnspecified = selected->UsesAutoUnspecified();
int selFlags = 0;
bool wasUnspecified = selected->IsValueUnspecified();
int usesAutoUnspecified = selected->UsesAutoUnspecified();
bool valueIsPending = false;
m_chgInfo_changedProperty = NULL;
bool valueIsPending = false;
m_chgInfo_changedProperty = NULL;
if ( !buttonWasHandled )
{
if ( !buttonWasHandled )
{
+ if ( wnd || m_wndEditor2 )
{
// First call editor class' event handler.
const wxPGEditor* editor = selected->GetEditorClass();
{
// First call editor class' event handler.
const wxPGEditor* editor = selected->GetEditorClass();
- if ( editor->OnEvent( this, selected, wnd, event ) )
+ if ( editor->OnEvent( this, selected, editorWnd, event ) )
{
// If changes, validate them
if ( DoEditorValidate() )
{
{
// If changes, validate them
if ( DoEditorValidate() )
{
- if ( editor->GetValueFromControl( pendingValue, m_selected, wnd ) )
+ if ( editor->GetValueFromControl( pendingValue,
+ m_selected,
+ wnd ) )
valueIsPending = true;
}
else
valueIsPending = true;
}
else
// Then the property's custom handler (must be always called, unless
// validation failed).
if ( !validationFailure )
// Then the property's custom handler (must be always called, unless
// validation failed).
if ( !validationFailure )
- buttonWasHandled = selected->OnEvent( this, wnd, event );
+ buttonWasHandled = selected->OnEvent( this, editorWnd, event );
}
// SetValueInEvent(), as called in one of the functions referred above
}
// SetValueInEvent(), as called in one of the functions referred above