Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to catch Left and Right brackets event? 1

Status
Not open for further replies.

pierrotsc

Programmer
Nov 25, 2007
358
US
I would like to be able to catch the left and right bracket keystroke anywhere in my code. Not just when i click on a form.

I am trying to increase of decrease the size of a painting brush like in photoshop. I have been able to use the left or right arrow but i have to click first in the drawing area. I would like to be able to do that without clicking on the drawing area (where i have the onkeydown event).

Thanks.
PO
 
Couldn't you do this within a global OnKeyDown form event? This should initiate when the whole form is active. Or am I missing the point of what you're trying to do?

What is the exact problem that you are encountering that would keep you from doing this?

Measurement is not management.
 
Be sure to set the forms KeyPreview property to True.

If KeyPreview is True, keyboard events occur on the form before they occur on the active control.

If KeyPreview is False, keyboard events occur only on the active control.

Navigation keys (Tab, BackTab, the arrow keys, and so on) are unaffected by KeyPreview because they do not generate keyboard events.

Aaron
 
Thanks. How do I handle the capture of [ and ]? do I handle that like if it was an ASCII character just like the letter A?
I do not see and vk_leftbracket variable.
Thanks.
PO
 
Yes, Handle it just as you would any other character.
 
Thanks...I made it to work...
Appreciated...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top