diff --git a/src/visual_tool_drag.cpp b/src/visual_tool_drag.cpp index 22f8a5ed8..f2a3ea6fb 100644 --- a/src/visual_tool_drag.cpp +++ b/src/visual_tool_drag.cpp @@ -59,7 +59,7 @@ VisualToolDrag::VisualToolDrag(VideoDisplay *parent, agi::Context *context) void VisualToolDrag::SetToolbar(wxToolBar *tb) { toolbar = tb; toolbar->AddSeparator(); - toolbar->AddTool(-1, _("Toggle between \\move and \\pos"), ICON(visual_move_conv_move)); + move_pos_button = toolbar->AddTool(-1, _("Toggle between \\move and \\pos"), ICON(visual_move_conv_move))->GetId(); toolbar->Realize(); toolbar->Show(true); @@ -76,8 +76,7 @@ void VisualToolDrag::UpdateToggleButtons() { if (to_move == button_is_move) return; - toolbar->SetToolNormalBitmap(toolbar->GetToolByPos(1)->GetId(), - to_move ? ICON(visual_move_conv_move) : ICON(visual_move_conv_pos)); + toolbar->SetToolNormalBitmap(move_pos_button, to_move ? ICON(visual_move_conv_move) : ICON(visual_move_conv_pos)); button_is_move = to_move; } diff --git a/src/visual_tool_drag.h b/src/visual_tool_drag.h index d869d37e8..a5537b4f9 100644 --- a/src/visual_tool_drag.h +++ b/src/visual_tool_drag.h @@ -39,6 +39,7 @@ class wxToolBar; class VisualToolDrag final : public VisualTool { /// The subtoolbar for the move/pos conversion button wxToolBar *toolbar; + int move_pos_button; /// The feature last clicked on for the double-click handler /// Equal to curFeature during drags; possibly different at all other times /// nullptr if no features have been clicked on or the last clicked on one no