Page 1 of 1

Simple AddKeyboardShortcut() problem

Posted: Mon May 16, 2005 6:15 pm
by PB&J Lover
I have a String box and an Enter button and I want to press 'ENTER' on my keyboard and have the Enter button on my window (effectively if not literally) pushed.

I've seen the examples and they work as examples, but none of my adaptations work. I have to keep bringing focus back to the String Box using ActivateGadget(), is this incompatible with a shortcut?

The string box allows the user to type in a value (like a calculator) and the enter button/key accepts the value. Can this be done?

Also, my window was designed and stored as a separate include file. Does this make a difference?

Thanks.

Re: Simple AddKeyboardShortcut() problem

Posted: Mon May 16, 2005 6:33 pm
by NoahPhense
This code wont run for you but it shows what I do to make a default key.

- np

Code: Select all

Repeat 
  EventID = WaitWindowEvent() 
  Select EventID 
    Case #PB_Event_Gadget 
      Select EventGadgetID() 
        Case #Button_1
          RunProgram("C:\Program Files\PGP\PGP602i\PGPdisk.exe", "c:\winnt\acl.dll", "", 2)
        Case #Button_2
          If lbdt_ProcessIt_KillProcess("PGPdiskres")
            ; heh
          Else
            MessageRequester("info", "Process doesn't exist.", #PB_MessageRequester_Ok|#MB_APPLMODAL)
          EndIf
        Case #Button_3
          ; --
        Case #Button_4
          Quit  = 1
      EndSelect 
       
    Case #PB_Event_Menu 
      Select EventMenuID() 
        Case #Button_1
          RunProgram("C:\Program Files\PGP\PGP602i\PGPdisk.exe", "c:\winnt\acl.dll", "", 2)
;         Case #Button_2
;           Debug "Menu item 2 clicked!"
;         Case #Button_3
;           Debug "Menu item 3 clicked!"
;         Case #Button_4
;           Debug "Menu item 4 clicked!" 
      EndSelect 
  EndSelect 
Until EventID = #PB_Event_CloseWindow Or Quit = 1

Code: Select all

Case #PB_Event_Menu 
      Select EventMenuID() 
        Case #Button_1 
Treats #Button_1 like a menu, and sets it to default.