Tuesday, December 15, 2009

4 advices to start creating your User Control

Of all the new features included in GeneXus X and the new Evolution 1, one of the most moving, and certainly the most visually appealing to the final user, is the inclusion of User Controls.

User Controls (or UC, for short) are wrappers that GX uses to communicate with interface objects written in different languages. Because of that wrapper, GX can invoke those objects to show whatever the developer wants to show, and those objects can reply back to our applications. Web interface veterans know that we can embed JavaScript code inside GX objects for some time now, but those solutions were often hard to maintain, extremely limited and seemed out of place inside the GX code. It is the versatility, potency, transparency and ease of use that makes UC more a necessity than just a new commodity.

GeneXus has a pretty extensive library of UC (available here) that grows daily thanks to user communit, with examples for almost every need. But even then, you may need something particular for your application, a new UC or an modification of a UC to fit your needs. Here are some pieces of advice for you to start in the journey on the User Controls’ world. Hope it helps.

1- Get used to the development interface. This is the User Control Designer. Even when the user control files can be opened with a standard text editor (save for very particular, advanced modifications), that is not the recommended approach. In this easy to use application, you can find anything you may need, from a properties definition interface, to a JavaScript editor. The application can be found in the GeneXus’ installation folder, and if you are going to modify User Controls regularly, we also advise you to create a shortcut on your desktop.

2- Start from the beginning. When exploring a new technology, it is important to start with simple examples and move all the way to the top. With this, as with anything in GX, we recommend an incremental model of development. Here you can find the classic “Hello World” example of UC. It is a pretty deep example on how to start writing a UC from the ground up. After you complete it, try to change something simple, like adding a property to set the message.

3- Research for solutions. Internet is such a rich repository of JavaScript or flash solutions, that you are likely going to find something for your need out there. Integrating a JavaScript solution to a UC is really easy, and can be both a good way of learning, and a solution to your problems. However, we do not endorse piracy, so please ask for permission before using the code, and include the proper copyright notes in your code.

4- Share your success and problems. The GeneXus forums and gallery is a growing community that benefits for every active user. There are some forums in English and other languages specific for user controls, both geared toward the use and development. If you have any problem feel free to ask, as that is how the UC GX Community will grow. So starting developing your UC today, and we look forward to seeing your solutions in the gallery.

No comments:

Post a Comment