Creating the Widget
Next, launch Real Studio 2012r2 and create a new Web project.
- Create a new class called OlarkWidget with the Super set to WebControlWrapper
- Add a second constant to make the control appear in the tray instead of on the page:
Private Const ShowInTrayArea As Boolean = True
Private Const Code As String
- Add a SiteID property so users can set it in the IDE at design time:
Public Property SiteID as String
- Lastly, right-click on the SiteID property and select Property List Behavior. In this dialog, set the Width and Height default values to 32 (otherwise it'll look a little weird when you drag the control in) and check the box next to the SiteID property to make it visible in the WebPage editor. You can add a header by right-clicking in the property list and choosing "Add Header".
Using the Widget
Now go to WebPage1 and drag an instance of OlarkWidget to the page. It should automatically appear in the tray and if you select it, you'll notice that the SiteID property is visible. Copy and paste your SiteID into that field.
If you run the project, soon after the page loads, the default Olark widget should appear on the bottom right corner of the browser!
Next time we'll hook up some basic events!
This does NOT permit you to use AcmeControls or AcmeProducts without creating a separate namespace registration.
To request a root namespace registration, send an email to WebNamespace@realsoftware.com and tell us what root namespace you would like to use. You will receive an email from us confirming your namespace choice.
Namespaces will be registered on a first come first served basis. We reserve the right to deny a namespace request that infringes on the trademarks of another company or would be otherwise confusing or offensive.