Author Topic: Modifying palettes in workspaces  (Read 3356 times)

0 Members and 1 Guest are viewing this topic.

Bobby C. Jones

  • Swamp Rat
  • Posts: 516
  • Cry havoc and let loose the dogs of war.
Modifying palettes in workspaces
« on: December 15, 2006, 08:30:18 AM »
I'm working on a stand alone cui installer.  In it I create a new workspace.  I want to setup certain palettes in it, but when I access the DocakbleWindows collection of the workspace, it's allways empty.  Anyone know how to get it to populate?  This is my latest try, the Count is always a big fat useless 0.

Code: [Select]
      CustomizationSection mainCuiCs = this.MainCui;
      Workspace BobbysWorkSpace = new Workspace(mainCuiCs, "Bobby");
      BobbysWorkSpace.DockableWindows.PopulateFromRegistry();
      Console.WriteLine("Palettes.Count = {0}", BobbysWorkSpace.DockableWindows.Count.ToString());
Bobby C. Jones

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: Modifying palettes in workspaces
« Reply #1 on: December 15, 2006, 03:27:52 PM »
Hi Bobby,

Is "Bobby" pre-existing ?
I think the second argument in the constructor is 'Workspace to Duplicate'
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: Modifying palettes in workspaces
« Reply #2 on: December 15, 2006, 04:01:22 PM »
Nope ... I was wrong ..

The constructor just tests for the pre-existance, and changes the name if existing : ..
Code: [Select]
public Workspace(CustomizationSection parent, string name) : base(parent)
{
      this.ConstructorGuts(this.Parent);
      if (parent.Workspaces.IndexOfWorkspaceName(name) >= 0)
      {
            bool flag1 = false;
            for (int num1 = 1; !flag1; num1++)
            {
                  name = name + num1.ToString();
                  if (parent.Workspaces.IndexOfWorkspaceName(name) == -1)
                  {
                        flag1 = true;
                  }
            }
      }
      this.Name = name;
}

kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

Bobby C. Jones

  • Swamp Rat
  • Posts: 516
  • Cry havoc and let loose the dogs of war.
Re: Modifying palettes in workspaces
« Reply #3 on: December 15, 2006, 04:50:35 PM »
Hi Bobby,

Is "Bobby" pre-existing ?
I think the second argument in the constructor is 'Workspace to Duplicate'

Hey Kerry,
Nope, it's new.  This code will create the workspace.  I can add my toolbars and pop menus to it, but there's not a single palette to be set up.  So close, yet so far...

Bobby C. Jones