Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.

  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Chapter 10 User Interface Programming > More Control Properties

MORE CONTROL PROPERTIES

There are some additional properties you can attach to controls, mostly to give the player a more flexible and informative interface. These properties include hot keys, tooltips, context-sensitive help, draggability, sounds, and animation.

Hot Keys

An excellent property to attach to any control on a desktop game is a hot key. As players become more familiar with the game, they’ll want to ditch the pointer control in favor of pressing a single key on the keyboard. It’s faster, which makes hard-core players really happy. You can distinguish between a hot key command and a normal keyboard input by checking the keyboard focus. The focus is something your screen class keeps track of itself, since it is an object that moves from control to control. Let’s assume that you have a bunch of button controls on a game screen, as well as a chat window. Normally, every key down and up event will get sent to the controls to see if any of their hot keys match. If they do match, the OnControl() method of the screen will get called. The only way to enable the chat window is to click it with the mouse or provide a hot key for it that will set the keyboard focus for the screen.


  

You are currently reading a PREVIEW of this book.

                                                                                                                    

Get instant access to over $1 million worth of books and videos.

  

Start a Free 10-Day Trial


  
  • Safari Books Online
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint