Suppress User Keypress Momentarily

Suppress User Keypress Momentarily

Matthew_Policelli
Advocate Advocate
147 Views
2 Replies
Message 1 of 3

Suppress User Keypress Momentarily

Matthew_Policelli
Advocate
Advocate

I have an iLogic that does some handy things with the revision table to automate removing revision tags and adding a new revision.

 

At the end of the iLogic, I open the revision table and use SendKeys to navigate to the description cell of the new revision row so that the user can fill that in.

 

However, if the user starts typing too quickly, their input will get put in the (1,1) cell of the revision table (i.e. the revision letter of the furthest back revision in the table) and overwrite it accidentally, which if they don't catch that can cause problems.

 

Is there a way I can temporarily suppress key inputs until the sendkeys has completed? Or perhaps a better way to get to the cell other than using SendKeys?

 

oCommandMgr.ControlDefinitions.Item("DrawingRevisionTableEditCtxCmd").Execute2(False)	'open the rev table for editing
SendKeys.SendWait("{DOWN}{DOWN}{RIGHT}")    'press down down right arrow keys to position user on description cell of current rev (works with both 2 and 3 rev lines)

  

P.s. - I am aware that I could just use an inputbox to get the description text without ever opening the revision table, but sometimes other columns need to be filled in. While I could create a custom form that would meet my needs, I'd prefer to see if there's a way I can just prevent the user from typing until the cursor is moved to the correct cell before going that route.

0 Likes
148 Views
2 Replies
Replies (2)
Message 2 of 3

WCrihfield
Mentor
Mentor

Hi @Matthew_Policelli.  That is getting into some 'gray area' for me, but some things I might suggest for testing purposes would be:

using the following method after

UserInterfaceManager.DoEvents 

and/or setting the following property to True for a short period of time, then back to False.

UserInterfaceManager.UserInteractionDisabled 

Just guesses though.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes
Message 3 of 3

Michael.Navara
Advisor
Advisor

Hi @Matthew_Policelli 

Your requested behavior is impossible because method SendKeys.SendWait() puts a message to MessageQueue of the application. The same does key press. You can't block this message queue because you need to process your input.

 

I recommend you to implement your own edit control for revision table. For example you can use DataGridView control for displaying values.

0 Likes