Possibilities for menu, dynamic buttons

Started by hanslammerts, November 09, 2016, 02:39:39 PM

Previous topic - Next topic

hanslammerts

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

Peter2

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

#2
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..



roy_043

#3
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:

Peter2

Peter
ODCL 8.1.... German, AutoCAD 2017 - 2018, Win 7 x64, Win 10

hanslammerts

#5
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..


roy_043

Quote from: hanslammerts on November 13, 2016, 02:05:03 PM
Thanks for this amazing good work!!  Highly effective and will same a lot of clicking.
Thanks.

Quote from: hanslammerts on November 13, 2016, 02:05:03 PM
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

@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

I have update the code anyway. See reply #3.

hanslammerts

#9
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

roy_043

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


hanslammerts

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


hanslammerts

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?