Tuesday, January 22, 2013

Key Events with Class Cocoa Controls in Real Studio (Xojo)


The coolest part of using Real Studio is access to all the controls for each platform. Some of these controls are not built-in by default but are still available to use by using declares or Plugins (Like Monkey Bread Software, Complete Plugin or the Mac OSLib (free by the way.) to name an few.). Whatever you choose its up to you.

This however can present some interesting coding challenges to add support for certain events that are available to similar built in controls. Such as the text field keydown event can use an return key to preform an action. There is no keydown event however for an non built-in control, instead one needs to get creative and figure another way around this.

Lucky enough anything is possible by code. This is an simple look at getting an NSSearchField on OSX to search on clicking the Return or Enter key press. This without an event that supports keydown or keyup events.

The reason for this video is there no documentation, I could find to tell us how to do such. It was hours of trial and error to figuring it out. However I believe such information should be shared.

Here an simple video to show how this is done. I showing this off using OSX based controls, because I currently on mac. But should be similar on other platforms.


No comments:

Post a Comment