Coding a custom virtual keyboard under xcode

Discussion in 'Mac Programming' started by ayilm1, Dec 5, 2010.

  1. ayilm1 macrumors newbie

    Dec 5, 2010
    I've registered here hoping to receive more answers. Apple discussions proved to be a dead end so here it goes. My question is this. I have created a layout in IB for a virtual keyboard. It contains 5 rows of buttons and I want to assign a global character entry to each button. i.e. When a button is pressed, it outputs a character to any text box within OS X. So far the closest I've come to something that is even remotely related is the use of kVK's (Virtual Keycodes) in the HIToolBox framework (Events.h). Please don't tell me it's not possible because there are a stack of soft keyboards up for download. It's just that none of them appeal to what I want. Thanks in advance.
  2. subsonix macrumors 68040

    Feb 2, 2008
    It's indeed possible, os x already includes a keyboard viewer that does exactly what you describe. I'm not sure how you would create your own though.
  3. jared_kipe macrumors 68030


    Dec 8, 2003
    I'd suspect that the character viewer uses CGEventPost() or CGEventPostToPSN()

    So lookup CGKeyCode's and CGEventRef and CGEventCreateKeyboardEvent()

Share This Page