From: fcwilt
Hi,
Is it possible to alter the behavior of a command based on control/shift/alt being held down.
For example, could the line command use one of those keys to determine if the line is drawn in both directions from the starting point.
There is an checkbox that does this but it would be grand if control/shift/alt could achieve the same result
Thanks.
Frederick
From: Michael Gibson
Hi Frederick,
re:
> For example, could the line command use one of those keys to determine
> if the line is drawn in both directions from the starting point.
It is possible for a command to check if the control key was down when the point pick was finished.
There isn't currently a way for it to be checked on every mouse move though, just when it is done.
I've attached a modified version of the regular line command that will do a "both sides" line if the control key was held down for the 2nd point pick.
- Michael
Attachments:
Line.js
From: fcwilt
Hi Michael,
Thanks for the example.
Do you think this ability is generally worth incorporating into v5
Frederick
From: fcwilt
Hi,
Tried you code and it worked fine.
I was thinking that it might be able to check/uncheck the "Both Sides" box (and similar things) in the dialog by using/not using a key
Cannot be done?
Frederick
From: Michael Gibson
Hi Frederick,
re:
> I was thinking that it might be able to check/uncheck the "Both Sides" box (and
> similar things) in the dialog by using/not using a key
>
> Cannot be done?
A command can register a shortcut key and then do something when that key is pressed. See attached example where typing the B key works the same as clicking on "Both sides".
But it works like other shortcut keys under Options > Shortcut keys, you can't do something when the key is pressed and something different when the key is released.
- Michael
Attachments:
Line.js
From: fcwilt
Hi Michael,
So when the dialog is first display there is no point at which the state of the control/shift/alt key can be detected and check (or uncheck) a checkbox that is part of the dialog?
Thanks.
Frederick
From: Michael Gibson
Hi Frederick,
re:
> So when the dialog is first display there is no point at which the state of the
> control/shift/alt key can be detected and check (or uncheck) a checkbox that
> is part of the dialog?
Nope, not from script.
- Michael
From: fcwilt
Hi Michael.
Understood about the limitation of script.
I was thinking of my general windows programming tool and all mouse events report the state of the mouse buttons AND control/shift/alt.
Frederick