From 66df6b39c84cbfdbff91bb37fa25c93a36b18fa4 Mon Sep 17 00:00:00 2001 From: Pieter Hijma Date: Wed, 3 Sep 2025 11:27:53 +0200 Subject: [PATCH] Gui: Select the VarSet when clicking Std_VarSet To make clear which VarSet is being added to, the VarSet is being selected. --- src/Gui/CommandStructure.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/Gui/CommandStructure.cpp b/src/Gui/CommandStructure.cpp index e16fe3421c..2a83205824 100644 --- a/src/Gui/CommandStructure.cpp +++ b/src/Gui/CommandStructure.cpp @@ -183,6 +183,9 @@ void StdCmdVarSet::activated(int iMsg) VarSetName = getUniqueObjectName("VarSet"); doCommand(Doc,"App.activeDocument().addObject('App::VarSet','%s')",VarSetName.c_str()); + Gui::Document* docGui = Application::Instance->activeDocument(); + App::Document* doc = docGui->getDocument(); + // add the varset to a group if it is selected auto sels = Selection().getSelectionEx(nullptr, App::DocumentObject::getClassTypeId(), ResolveMode::OldStyleElement, true); @@ -190,11 +193,14 @@ void StdCmdVarSet::activated(int iMsg) App::DocumentObject* obj = sels[0].getObject(); auto group = obj->getExtension(); if (group) { - Gui::Document* docGui = Application::Instance->activeDocument(); - App::Document* doc = docGui->getDocument(); group->addObject(doc->getObject(VarSetName.c_str())); } } + + // select the new varset + Selection().clearSelection(); + Selection().addSelection(doc->getName(), VarSetName.c_str()); + commitCommand(); doCommand(Doc, "App.ActiveDocument.getObject('%s').ViewObject.doubleClicked()", VarSetName.c_str());