AutoCAD steals my F keys

AutoCAD steals my F keys

Anonymous
Not applicable
870 Views
5 Replies
Message 1 of 6

AutoCAD steals my F keys

Anonymous
Not applicable

Hi,

in my forms, i use the F keys as shortcuts for some operations, but even if the key is pressed on the form, AutoCAD still processes it.

For example, i use F12 to temporarily hide the forms, so the user can look in the drawing, but with pressing F12 AutoCAD turns the Dynamic input on, same with F3, F11, F6, but not with F5 or F7

 

is there some workaround or setting to disable AutoCAD functions for F keys while a modeless form is shown?

0 Likes
871 Views
5 Replies
Replies (5)
Message 2 of 6

chiefbraincloud
Collaborator
Collaborator

I think you just handle the KeyPress event from whatever control you are watching for F keys, and set the e.Handled property to true if it is a key you are handling.

Dave O.                                                                  Sig-Logos32.png
Message 3 of 6

Anonymous
Not applicable

are you sure about this? because KeyPress event is not handling F keys, from what i have read, it only catches printable characters

 

and when i set e.Handled to True in KeyDown or KeyUp, it's still processed by AutoCAD

0 Likes
Message 4 of 6

norman.yuan
Mentor
Mentor

How do you use the F keys? I assume you place a menu bar on the form and assign a Function key to some menu items.

 

It works correctly with my Acad2009/2011 as expected. That is:

 

1. if the form is shown as MODAL form, press F key, corresponding code with particular menu item runs. Because it is modal form, AutoCAd does not respond no matter what F key you press, only the F keys you used in the nodal form react.

 

2. If the form is modeless, the F keys used in the form ONLY react when the form has FOCUS, in the same way as if the form is modal form. If the form does not have focus (that means AutoCAD is currently having the focus!), then press F keys, AutoCAD responds instead of your form.

 

So, I guess, your form is shown as modeless form (or PaletteSet?) and the form/paletteset does not have focus when you press F keys. That is the way how things work.

Norman Yuan

Drive CAD With Code

EESignature

Message 5 of 6

Anonymous
Not applicable

mu use of the F keys is different

i use them to trigger different user input, for example F3 starts the user interaction (ed.StartUserInteraction) and then user picks a point, then the controls on the form are updated acording to that picked point

 

your example works fine, when I'm not hiding the form for user interaction, AutoCAD doesn't react to the F key

 

i think i missed this important information in my first post 🙂

0 Likes
Message 6 of 6

Anonymous
Not applicable

I will sum it up. I use F keys to initiate user input from a modeless form, but AutoCAD also processes that F keys

so if I press F3 to get a point from the drawing, AutoCAD turns off osnap

 

how can i solve this?

0 Likes