Announcement

Collapse
No announcement yet.

Use the keyboard to execute actions

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Use the keyboard to execute actions

    Is there a way to have a key stroke execute an action. I would like it when the user hits the esc key, the application will end.

  • #2
    Re: Use the keyboard to execute actions

    very easy.
    any button (visible or not) has a hotkey feature. If you want just the hotkey, make the button (can be a hotspot) 1 pixel big so it cannot be seen.
    Good luck
    Yossi

    Comment


    • #3
      Re: Use the keyboard to execute actions

      You can even move the hotspot outside of the page boundaries if you don't even one the 1pixel x 1 pixel element to be clickable. The Shorcut for the projecthotspot will still work.

      Comment


      • #4
        Re: Use the keyboard to execute actions

        Great thanks for your help. I figured it out. I always wondered what that did. I have a problem though. I want to be able to hit escape and have the app quit. When I click in the shortcut box and hit escape, the properties window closes. Can esc be used as a shortcut?

        Comment


        • #5
          Re: Use the keyboard to execute actions

          Yes but you will need to edit the XML .AM4 file in WordPad or a text editor.

          Find your object in the code by searching for the object name and change the virtual key number to 27. This is the Decimal Virtual Key number that represents the Esc key.

          Here is an example of a hotspot named "Hotspot1" that I changed the key to ESC:

          <Name>Hotspot1</Name>
          <VisibleAtDesignTime>1</VisibleAtDesignTime>
          <VisibleAtRunTime>1</VisibleAtRunTime>
          <Locked>0</Locked>
          <LockSize>0</LockSize>
          <ToolTip/>
          <Cursor>1</Cursor>
          <Coordinates>
          <Top>259</Top>
          <Bottom>309</Bottom>
          <Left>358</Left>
          <Right>458</Right>
          </Coordinates>
          <Hotkey>
          <VirtualKey>27</VirtualKey>

          For a list of the decimal representations of the virtual keys you can check out this site.

          http://www.delphicollection.com/publ...KeyCodes.shtml

          Make sure you look at the decimal number and not the hexadecimal.

          Comment

          Working...
          X