Author Topic: Possibilities for menu, dynamic buttons  (Read 9701 times)

hanslammerts

  • Member
  • *
  • Posts: 38
Possibilities for menu, dynamic buttons
« on: November 09, 2016, 02:39:39 PM »
Hi
I was wondering it would be possible to programm a menu in Autocad that act similar to the entity snap toolbar in Bricscad. Because autocad doesn't support dynamic toolbars <state> this could only be done with a menu that 'stays open'.. Can this be done with opendcl?
Thanks upfront hans

https://www.bricsys.com/bricscad/help/en_US/V13/UsrGui/source/01_User_Interface/Art/01_Toolbar10_Entitysnaps.png
« Last Edit: November 09, 2016, 02:41:14 PM by hanslammerts »

Peter2

  • Sr. Member
  • ****
  • Posts: 470
Re: Possibilities for menu, dynamic buttons
« Reply #1 on: November 10, 2016, 01:59:44 AM »
For OpenDCL - yes, it is a standard feature to create "something" (palette, modeless dialogue) which stays open and displays different icons for different states.

For AutoCAD - a "simple workaround" could be that you take the "zoom" toolbar, modify it to "my zoom" and change every icon to a flyout which different icons - one icon enables the zoom option, the other one disables it. The visual result is the same, the usage needs the click to open the flyout.

I think that there are menucommands in Cuix which does the command you need and can change the displayed icon. But I'm not sure ... :-\
Peter
ODCL 8.1.... German, AutoCAD 2017 - 2018, Win 7 x64, Win 10

hanslammerts

  • Member
  • *
  • Posts: 38
Re: Possibilities for menu, dynamic buttons
« Reply #2 on: November 11, 2016, 12:10:11 AM »
Thanks for your reply peter,
Modifing any existing AutoCAD toolbar isn't going to do what i would like the toolbar to (not a fan of flyout buttons) but i thought opendcl could do just that. Thanks for your reply anyway!

I have made a simple form to illustrate the idea. *EDIT* I figured out it should be a modeless dialog..
These buttons i thing have a "event when clicked", change appaerance and should trigger command that i called.
The lisps have the code to to this.

(set_os_end)
(set_os_mid)
(set_os_cen)

- how to activate the lisp in the opendcl dialog.
- how to load a .odcl. file ?

Thanks for some helping out..


 
« Last Edit: November 11, 2016, 07:30:02 AM by hanslammerts »

roy_043

  • Sr. Member
  • ****
  • Posts: 369
Re: Possibilities for menu, dynamic buttons
« Reply #3 on: November 12, 2016, 12:47:37 PM »
Edit:
Version 20180417:
Two checks have been added to the code.
Version 20170129:
The position of the form is now stored relative to the top left corner of the CAD window.
Version 20170125:
If the stored position of the form would cause it to be (partially) outside the CAD window, the form is centered.
Version 20170118:
Several improvements for the 20170117 code.
New function c:Osnaps-Toggle: Toggles the osnaps and changes the display of the form to match.
Version 20170117:
For every workspace the position and state (hide/show) of the form is saved/restored separately.
New function c:Osnaps-FormToggle: Toggles the form.
Version 20161126:
Added OZ (OSNAPZ) button.
The form now has KeepFocus set to false.
Version 20161116B:
Event handlers for INT and APP were not correct.
Version 20161116:
Updated code to hide GCE button.
Revised event handlers. Behavior now matched that of the BricsCAD toolbar.
Modified the ODCL: flat buttons 30x30.
Version 20161114:
Added X button (switch OSMODE to zero).
(dcl-Sendstring) is no longer used.

My suggestion:
« Last Edit: April 17, 2018, 03:25:12 AM by roy_043 »

Peter2

  • Sr. Member
  • ****
  • Posts: 470
Re: Possibilities for menu, dynamic buttons
« Reply #4 on: November 12, 2016, 01:40:40 PM »
 8)
Peter
ODCL 8.1.... German, AutoCAD 2017 - 2018, Win 7 x64, Win 10

hanslammerts

  • Member
  • *
  • Posts: 38
Re: Possibilities for menu, dynamic buttons
« Reply #5 on: November 13, 2016, 02:05:03 PM »
Thanks for this amazing good work!!  Highly effective and will same a lot of clicking.
I'm allmost there where i would want it to be.

The big wish i still have is to have a 'clear osnap' button to work.
I called it 'btnCln' in the same fashion as the other buttons are called.
btnCln would be the one that would make them all red, a hard osnap=0 value.

Here is my code ..for revision & idea's..

« Last Edit: November 27, 2016, 02:40:18 PM by hanslammerts »

roy_043

  • Sr. Member
  • ****
  • Posts: 369
Re: Possibilities for menu, dynamic buttons
« Reply #6 on: November 14, 2016, 12:23:05 AM »
Thanks for this amazing good work!!  Highly effective and will same a lot of clicking.
Thanks.

The big wish i still have is to have a 'clear osnap' button to work.
Have you tried the existing 'ON' button? This will not set the OSMODE to zero but does disable all osnaps.

roy_043

  • Sr. Member
  • ****
  • Posts: 369
Re: Possibilities for menu, dynamic buttons
« Reply #7 on: November 14, 2016, 01:00:50 AM »
@hanslammerts:
I notice that you have changed the existing button event handlers.
Does this mean that:
Code: (autolisp) [Select]
(dcl-Sendstring "'_endpoint ")does not work on AutoCAD?

roy_043

  • Sr. Member
  • ****
  • Posts: 369
Re: Possibilities for menu, dynamic buttons
« Reply #8 on: November 14, 2016, 03:25:33 AM »
I have update the code anyway. See reply #3.

hanslammerts

  • Member
  • *
  • Posts: 38
Re: Possibilities for menu, dynamic buttons
« Reply #9 on: November 15, 2016, 02:34:43 PM »
Mucias gratias.

.. A few remarks after testing and doing my things.

1. shouldn't hide the gce button (>AutoCAD 2017 has gce), i turned it this off ;   (dcl-Control-SetVisible Osnaps/Main/btnGce nil)
2. i cannot figure out how to set osmode = 0 seems some kind of bug that this will automaticly turn it on/off instead of resetten it all (to red buttons)
3. strange thing that the toolbar is shortening everytime i active it..(?) Why is this..? so i have set the 'enable resize button' : on
   (the button aligenment need some fixing, i can do that :) But what about the strange behaviour of the shortening at start up ??

.. still, this is amazing stuff.. :) Thanks!
Fun to do some testing / programming on a multi-platform basis..

https://youtu.be/mvAVqWTVKAI
« Last Edit: November 15, 2016, 02:39:48 PM by hanslammerts »

roy_043

  • Sr. Member
  • ****
  • Posts: 369
Re: Possibilities for menu, dynamic buttons
« Reply #10 on: November 16, 2016, 02:07:03 AM »
1.
Actually AutoCAD >=2016 has the GCE snap. I'll revise my code accordingly.
2.
If you press the 'X' button all buttons to the left of it should turn red and the 'X' button itself should turn green.
The 'ON/OFF' button has three states:
- ON+white: Osnap is on and one or more osnaps are active.
- OFF+black: Osnap is off and OSMODE is zero.
- OFF+gray: Osnap is off but OSMODE is not zero.
3.
I do not see misaligned buttons. You have to be more specific.
The resizing bug you see is caused by your own modifications of the code.

roy_043

  • Sr. Member
  • ****
  • Posts: 369
Re: Possibilities for menu, dynamic buttons
« Reply #11 on: November 16, 2016, 06:07:55 AM »
See reply #3 for the updated version.

hanslammerts

  • Member
  • *
  • Posts: 38
Re: Possibilities for menu, dynamic buttons
« Reply #12 on: November 16, 2016, 12:21:35 PM »
Awsome!!!!! Will get back to you after testing and working with it. The way you code this makes me feel a bit like a fool.. But i am very happy this will save a bunch of useless shift clicking through stupid autocad menus.

roy_043

  • Sr. Member
  • ****
  • Posts: 369
Re: Possibilities for menu, dynamic buttons
« Reply #13 on: November 16, 2016, 01:49:16 PM »
See reply #3 for the updated version. ;D

hanslammerts

  • Member
  • *
  • Posts: 38
Re: Possibilities for menu, dynamic buttons
« Reply #14 on: November 17, 2016, 12:41:38 PM »
General question..
i keephaving the issue that the toolbar is shrinking every time i close and re-open it?
Tried to prevent it by setting min width and working with a frame around the buttons. No effect :(
Is this only in AutoCAD happening?