TheSwamp

Code Red => .NET => Topic started by: patrickcraig31 on August 27, 2018, 01:27:46 PM

Title: Having Trouble Positioning Custom Toolbars
Post by: patrickcraig31 on August 27, 2018, 01:27:46 PM
Hello,
I am trying to write a routine that loads custom toolbars into the AutoCAD workspace if they have not already been loaded. I was able to come up with some code for this task, however I need it to be done without disturbing the positions of the other visible toolbars. My team members all have different UI preferences in AutoCAD and I want the custom toolbars to load while keeping personalized toolbar positions.

I tried using the toolbar float method to position the toolbars, however I am using multiple monitors and the toolbars always float within my primary screen.

Can anybody help me with this ? I am out of ideas of how to get this simple task to work and there does not seem to be much functionality for positioning toolbars relative to each other.
Title: Re: Having Trouble Positioning Custom Toolbars
Post by: jmaeding on September 20, 2018, 12:00:38 PM
You may be out of luck, as the com api claims to be able to set a toolbar position, but it does not control the row correctly since adesk broke it in like 2013.
I had tools that saved toolbar locations, then could rearrange them to same spot like workspaces a couple years before workspaces were around.
THe advice I got from adesk is use the .net api and workspaces to control toolbar locations. Ugh.
Title: Re: Having Trouble Positioning Custom Toolbars
Post by: dgorsman on September 20, 2018, 02:47:54 PM
Hello,
I am trying to write a routine that loads custom toolbars into the AutoCAD workspace if they have not already been loaded. I was able to come up with some code for this task, however I need it to be done without disturbing the positions of the other visible toolbars. My team members all have different UI preferences in AutoCAD and I want the custom toolbars to load while keeping personalized toolbar positions.

I tried using the toolbar float method to position the toolbars, however I am using multiple monitors and the toolbars always float within my primary screen.

Can anybody help me with this ? I am out of ideas of how to get this simple task to work and there does not seem to be much functionality for positioning toolbars relative to each other.

Generally easier to define your UI content in a CUIx file and partially load it on-the-fly if it's not already loaded.  That way the user's workspace will drive the positions of the elements and free you up for the more difficult work.
Title: Re: Having Trouble Positioning Custom Toolbars
Post by: jmaeding on September 20, 2018, 04:03:37 PM
@dgorsman,
I think the OP is talking about how to control the toolbar position on first load. If you try to dock it, it pushes the others aside.
I might claim its not a big deal if just first load, but there are other reasons to want to control the location and row a toolbar gets docked to.
All that aside, I have never modified a workspace using .net. You would have to save the current config as a workspace, edit with API, then set current again I think.
Ever tried that?
Title: Re: Having Trouble Positioning Custom Toolbars
Post by: dgorsman on September 20, 2018, 06:12:41 PM
If is a "Hey, this is new and you need to have it, put it where you want" type of deal, I'd be sorely tempted to float them right in the middle of the drawing area.  That way the user is forced to dock/move/whatever it where they want without any extra messing around on the development side or complaints about their workspace being messed with.