Hello Thomas,
> is it possible to enable or disable a key/mouse definition with
> a script or a command?
> And how can I remap the state (enable/disable) to a button?
I guess that means you want the button to show whether the
hotkey is currently on or off.
No need for a script, you can fit this into the command entry
dialog for two items on a menu or bar's command list.
Name: CAD hotkey ON
Command: Exec
Action: Hotkeys
Enter on off or reverse: on <hot key name>
"Enter more commands":
cl.SetBackColor("bar1","KeysIndicator","0 255 0")
Name: CAD hotkey OFF
Command: Exec
Action: Hotkeys
Enter on off or reverse: off <hot key name>
"Enter more commands":
cl.SetBackColor("bar1","KeysIndicator","192 0 0")
You will need to edit where I wrote <hot key name>
for example if your hotkey is Win+h change it to:
Enter on off or reverse: on Win+h
Also change from "bar1" to your bar's command list name.
For the button which you want to use as your indicator,
add an ID after the name, for example:
Name: CAD hotkey ON<id=KeysIndicator>
Or if it doesn't have any text label (an icon only button)
Name: <id=KeysIndicator>
Notes:
I set the button's background to red or green to indicate
the on/off state of your hotkey.
Instead you could change its text label or even its icon
for example:
cl.SetLabel("bar1","KeysIndicator","ON")
or:
cl.SetIcon("bar1","KeysIndicator","c:\shells\powerpro\myicons\on.ico",0)
See Help "CL functions for setting item attributes"
Alternatives:
I wrote the above suitable for using one bar button or menu item
to turn on the hotkey and one item to turn it off.
You could use the Left click and Right click commands of a single button.
Set a tooltip to remind you Left is for on and Right is for off.
OR:
if you want a left click on a single button or menu item
to act as a toggle, make it run a script:
Name: Toggle CAD hotkey<id=KeysIndicator>
Command: .ToggleCADkey
;;------- save this as ToggleCADkey.powerpro ---------------
static CADkeyOFF = not CADkeyOFF
;; that switches the variable between 1 and 0
if(CadkeyOFF)do
Exec Hotkeys on W+h
cl.SetBackColor("bar1","KeysIndicator","0 192 0")
else
Exec Hotkeys off W+h
cl.SetBackColor("bar1","KeysIndicator","192 0 0")
endif
quit
;;-------------------------------------------
You could add this to the Stop commands of your timer:
cl.SetBackColor("bar1","KeysIndicator","192 0 0")
[or whatever you use as your OFF indicator]
Attention: PowerPro's Web site has moved: http://www.ppro.org
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/power-pro/
<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/