For activated Classic Workspaces, the Ribbonstate=0
For activated Ribbon Workspaces, the Ribbonstate=1
How do we find this type of Workspace before the Workspace is activated?
I've tried the Toolbar Count and Tabs Count but that's not identifying the differences.
Thanks for any help.
[CommandMethod("WS")] public void GetWorkspaces() { Document dwg = Application.DocumentManager.MdiActiveDocument; Editor ed = dwg.Editor; CustomizationSection custSection; string cuiPathname = (string)Application.GetSystemVariable("MENUNAME"); cuiPathname += ".cuix"; custSection = new CustomizationSection(cuiPathname); WorkspaceCollection workspaces = custSection.Workspaces; var workspaceNames=new List<string>(); foreach (Workspace ws in workspaces) workspaceNames.Add(ws.Name); workspaceNames.Sort(); workspaceNames.ForEach(n => ed.WriteMessage("\n{0}", n)); PromptIntegerOptions getWsNrPrmt = new PromptIntegerOptions("\nEnter nr: "); getWsNrPrmt.LowerLimit=0; getWsNrPrmt.UpperLimit=workspaceNames.Count-1; PromptIntegerResult getWsNr = ed.GetInteger(getWsNrPrmt); if (getWsNr.Status != PromptStatus.OK) return; Workspace workspace = workspaces[getWsNr.Value]; WSRibbonRoot workspaceRR = workspace.WorkspaceRibbonRoot; WorkspaceToolbarCollection tbars = workspace.WorkspaceToolbars; ed.WriteMessage("\n{0} Toolbars", tbars.Count); WorkspaceRibbonTabCollection rTabs = workspace.WorkspaceRibbonRoot.WorkspaceTabs; ed.WriteMessage("\n{0} Tabs", rTabs.Count); }
Solved! Go to Solution.
Solved by Virupaksha_aithal. Go to Solution.
Hi,
Try reading system variable WSCURRENT. This variable holds the name of current workspace
Hi,
Any specific reasons you want to find this state?
Even in classic workspace, users can bring the ribbon by issuing command “ribbon”. The Ribbonstate variable will be 1.
w'll change Workspaces based on usersettings, but the ribbonstate doesn't get changed accordingly.
Changing the Ribbonstate based on the type of Workspace would solve this issue.
This is a Ribbon Workspace example
[General] UserFullname=Anton van Buiten Paraaf=AVB LoginName=avb [Plot] Location=PDF [Setvars] WSCURRENT=Infra Ribbon CMD_RIBBON= Enable ribbon menu OSMODE=4647 CMD_Modelspace=(command "tilemode" 1)
This is a Classic Workspace example
[Setvars] WsCurrent=INFRA MenuBar=0 NavBarDisplay=0 ;CMD_RIBBONCLOSE=Sluit het ribbon menu
In order to correctly display a Classic or Ribbon Worspace the lines WSCURRENT,CMD_RIBBON and MENUBAR are coupled together.
So if the program can detect the type of Workspace (Classic|Ribbon) BEFORE making it active, then the calls to CMD_RIBBON and MENUBAR can be made implicit -- no need to add them to the usersettings.
The main question was asked because for some reason the screen update after a change of Workspace from within VBA was not performed correctly.
For instance changing from Ribbon back to Classic did not close the Ribbon.
The (obvious) solution is to do this in .NET:
Application.SetCurrentWorkspace(workspace.Name);
Thanks for any help
A number of verticals no longer have the "classic" workspace, same with some allied products. Probably a good time to start leaving it behind as well. It will simplify your development and support process to boot.
I know and you know it, but a lot of our users disagree.
The switch makes them less productive for a short period.
But they will, eventually.