Author Topic: Toolbar location manipulation  (Read 10670 times)

0 Members and 1 Guest are viewing this topic.

T.Willey

  • Needs a day job
  • Posts: 5251
Re: Toolbar location manipulation
« Reply #15 on: June 19, 2006, 05:26:46 PM »
I couldn't find anything lisp, so far.  But I did find something in the help, that makes it look like you can with VBA.
Quote from: Acad Help
To dock a toolbar, use the Dock method for the toolbar. The Dock method takes three parameters as input: Side, Row, and Column. The Side parameter specifies the side of the toolbar that you will be positioning in the docking maneuver. You can specify the top, bottom, left, or right side of the toolbar. The Row and Column parameters specify a number on the existing rows and columns of docked toolbars at which to dock the toolbar.

You can query a toolbar to see if it is docked by using the DockStatus property. The DockStatus property will return TRUE if the toolbar is docked and FALSE if the toolbar is floating.

Dock a toolbar
But you can't do it with ActiveX controls through lisp.
Quote from: Acad Command Line
Command: (VLA-DOCK (CADDR TBLIST) acToolbarDockTop 0 0)
; error: Too many actual parameters

Command: (vlax-invoke (caddr tblist) 'Dock acToolbarDockTop 0 0)
; error: Invalid number of parameters

Command: (vlax-invoke (caddr tblist) 'Dock acToolbarDockTop 0,0)
; error: Invalid number of parameters

Command: (vlax-invoke (caddr tblist) 'Dock acToolbarDockTop "0,0")
; error: Invalid number of parameters

Command: (vlax-invoke (caddr tblist) 'Dock acToolbarDockTop)
nil
Off to find some more good things.  If anyone wants to test this in VBA and let me know, that would be cool.  I don't think I would use it, as I know NOTHING in VBA, but just that it can or can't would be nice to know.

Thanks.
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

LE

  • Guest
Re: Toolbar location manipulation
« Reply #16 on: June 19, 2006, 05:37:41 PM »
Here is a sample (To test move the dimension toolbar to any place on your screen, then call the code below):

Code: [Select]
(setq toolbar "dimension")
(vla-dock
  (vla-item
    (vla-get-toolbars
      (vla-item
(vla-get-menugroups (vlax-get-acad-object))
"ACAD"))
    toolbar)
  acToolbarDockTop)

T.Willey

  • Needs a day job
  • Posts: 5251
Re: Toolbar location manipulation
« Reply #17 on: June 19, 2006, 05:49:50 PM »
Here is a sample (To test move the dimension toolbar to any place on your screen, then call the code below):

Code: [Select]
(setq toolbar "dimension")
(vla-dock
  (vla-item
    (vla-get-toolbars
      (vla-item
(vla-get-menugroups (vlax-get-acad-object))
"ACAD"))
    toolbar)
  acToolbarDockTop)
This works, but you can't specify the location you want that toolbar to be docked at.  At least I haven't found a way to do it yet.  When you run your code, it will bring it up. Then you move it, but when you dock it, it will always be on the top, and to the left.  Try placing it on the second row and be the second one to the left with code, and that is what I'm trying to do, and can't do yet.  I'm still trying though.  Hope that explains a little better what I'm trying to do.

Thanks.
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

Bob Wahr

  • Guest
Re: Toolbar location manipulation
« Reply #18 on: June 19, 2006, 05:58:29 PM »
Just a thought, make a list of all of the toolbars from bottom right to top left, then dock each toolbar to the top in order. It might work, probably won't though.  I'm guessing it will give one long row that goes off screen.  I don't have time now but will try VBA when I do if someone doesn't beat me.

LE

  • Guest
Re: Toolbar location manipulation
« Reply #19 on: June 19, 2006, 06:05:49 PM »
This works, but you can't specify the location you want that toolbar to be docked at.  At least I haven't found a way to do it yet.  When you run your code, it will bring it up. Then you move it, but when you dock it, it will always be on the top, and to the left.  Try placing it on the second row and be the second one to the left with code, and that is what I'm trying to do, and can't do yet.  I'm still trying though.  Hope that explains a little better what I'm trying to do.

Thanks.

I know... I was giving you the sample about how to call vla-dock....

As far all the test I just did, by calculating the pixels locations for the toolbar's it does not put them back to where they supposed to be placed... using the vla-put-top and vla-put-left...  no more time to play for now.

GDF

  • Water Moccasin
  • Posts: 2081
Re: Toolbar location manipulation
« Reply #20 on: June 19, 2006, 06:14:51 PM »
Tim

Look at the TBU routine enclosed. I have found that to get toolbars to dock where you want them using the toolbar command you have to do a little song and dance.

I could use a more elgant approach....

Gary
Why is there never enough time to do it right, but always enough time to do it over?
BricsCAD 2020x64 Windows 10x64

T.Willey

  • Needs a day job
  • Posts: 5251
Re: Toolbar location manipulation
« Reply #21 on: June 19, 2006, 06:18:21 PM »
Just a thought, make a list of all of the toolbars from bottom right to top left, then dock each toolbar to the top in order. It might work, probably won't though.  I'm guessing it will give one long row that goes off screen.  I don't have time now but will try VBA when I do if someone doesn't beat me.
Yup Bob, just one big line.

This works, but you can't specify the location you want that toolbar to be docked at.  At least I haven't found a way to do it yet.  When you run your code, it will bring it up. Then you move it, but when you dock it, it will always be on the top, and to the left.  Try placing it on the second row and be the second one to the left with code, and that is what I'm trying to do, and can't do yet.  I'm still trying though.  Hope that explains a little better what I'm trying to do.

Thanks.

I know... I was giving you the sample about how to call vla-dock....

As far all the test I just did, by calculating the pixels locations for the toolbar's it does not put them back to where they supposed to be placed... using the vla-put-top and vla-put-left...  no more time to play for now.

Okay, Thanks Luis.  I have search the web, and the help, and haven't found a way to do it with lisp yet.  I'm just about to give up on this one.

Thanks to everyone who particapted in this thread, or will.
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

T.Willey

  • Needs a day job
  • Posts: 5251
Re: Toolbar location manipulation
« Reply #22 on: June 19, 2006, 06:28:11 PM »
Tim

Look at the TBU routine enclosed. I have found that to get toolbars to dock where you want them using the toolbar command you have to do a little song and dance.

I could use a more elgant approach....

Gary
Thank Gary.  I just looked at your routine, and it looks like what I'm doing.  I have to use "comamnd" to place my toolbars in the right locations, but I use code to hide all the ones I don't want to see.

Code: [Select]
(defun HideAllToolbars ()

(vlax-for Menu (vla-get-MenuGroups (vlax-get-Acad-Object))
 (vlax-for TlBar (vla-get-ToolBars Menu)
  (vla-put-Visible TlBar :vlax-False)
 )
)
)
Then I turn on the ones I want to use.
Example:
Code: [Select]
(setq AcadObj (vlax-get-Acad-Object))
(setq MnGrp (vla-get-MenuGroups AcadObj))
(vla-put-Visible (vla-Item (vla-get-ToolBars (vla-Item MnGrp "ACAD")) "Workspaces") :vlax-true)
Then I float all the visible toolbars
Code: [Select]
(FloatToolbars (GetAllVisibleToolbars))


(defun GetAllVisibleToolbars (/ TbList)

(vlax-for Menu (vla-get-MenuGroups (vlax-get-Acad-Object))
 (vlax-for TlBar (vla-get-ToolBars Menu)
  (if (= (vla-get-Visible TlBar) :vlax-true)
   (setq TbList (cons TlBar TbList))
  )
 )
)
TbList
)

(defun FloatToolbars (TbList / Top Left)

(setq Top 50)
(setq Left 1100)
(foreach Tb TbList
 (vla-Float Tb Top Left (vla-get-Count Tb))
 (setq Top (+ Top 50))
)
(princ)
)
Then I use the "command" to place them.
Code: [Select]
(if (= ElectOpt "No")
 (progn
  (command "_.toolbar" "T-Standard" "_top" "0,0")
  (command "_.toolbar" "My-Layers" "_top" "1,0")
  (command "_.toolbar" "Workspaces" "_top" "2,0")
 )
 (progn
  (command "_.toolbar" "ACE:Main Electrical" "_top" "0,0")
  (command "_.toolbar" "ACE:Main Electrical 2" "_top" "1,0")
  (command "_.toolbar" "Workspaces" "_top" "2,0")
  (command "_.toolbar" "T-Standard" "_top" "0,1")
  (command "_.toolbar" "My-Layers" "_top" "1,1")
 )
)
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

sinc

  • Guest
Re: Toolbar location manipulation
« Reply #23 on: June 21, 2006, 08:45:07 AM »
So then is this whole problem being caused by the fact that your company is trying to use a "company-wide profile", that everyone shares?

That's incorrect usage of profiles, and it leads to huge headaches like this.  If your company started using profiles correctly, your problems would undoubtedly melt away, and no need for all this roundabout mumbojumbo.

T.Willey

  • Needs a day job
  • Posts: 5251
Re: Toolbar location manipulation
« Reply #24 on: June 21, 2006, 11:12:51 AM »
It just happened when we went to 2006.  The company provides profiles to start with, then we can change them to suite our needs, which worked fine in 2004.  They know about the problem, but it doesn't look like it is a high priority right now, which is why I did this work around.

To clarify.
Yes they use specific company wide profiles.
But one can change them, and in theory, have them remain changed until upgrade or you overwrite them back the the standard ones yourself.
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.