Enhancing BASIC+ Part 5: Go For Launch

In this series of articles, we’ve been exploring how a precompiler can be used to enhance the BASIC+ language. We’ve shown how the precompiler makes writing services and commuter modules more pleasant than ever. It’s time to let you get your hands on our hard work, but first, one more feature we think will greatly improve your quality of life.

#Window

The SRP PreCompiler supports one more custom keyword: #window. This compiler directive actually gets ignored during compilation. It’s purpose is to tell the SRP Editor which window is associated with your commuter module.

For starters, somewhere in your commuter module, add the #window keyword and press space:

windowdirectivedropdown

You will get a drop down of all known windows in the system. Select one to complete your directive. For example:

#window MY_WINDOW

So, what did that little line of code get you? More drop downs. When the SRP Editor sees that line of code, it queries SYSREPOSWINEXES for your window and caches that information. Now the SRP Editor knows about all the controls and events you are likely to access in your commuter module.

Adding Events Faster

If you recall, in Enhancing BASIC+ Part 3, we said that all events must adhere to a special naming convention: Control.Event. The reason should become quite clear. Watch what happens when we add an Event keyword and press space:

eventcontrolsdropdown

Immediately, the SRP Editor presents us with a list of all controls. We no longer have to Alt+Tab back to the Form Designer for reference. Everything is at our fingertips. Select a control and press Enter to autofill that control name.

Now, press the period:

eventsdropdown

Since the SRP Editor control knows that MY_EDITBOX is an EDITBOX control, it knows what events it supports. So, we can browse a convenient list and press Enter. As soon as we do, that event’s parameters are automatically filled in:

eventautofill

You never have to go back to the Programmer’s Reference help file. You don’t even have to go to our Wiki, since the SRP Editor will also auto-populate all SRP ActiveX Control events.

eventsrpautofill

If you want a window event, choose WINDOW instead of a specific control. Once again, press period to get the list of Window events:

windoweventsdropdown

Caching window information is key enhancing our productivity, and it would not have been possible without a PreCompiler to strip away the #window directive during compile (else we get compiler errors). To ensure you never lose productivity, the SRP Editor refreshes the cache every time you make changes to your window in the Form Designer and save (thanks to the BASIC+ hooking technique documented here). You’ll never have to restart the SRP Editor to ensure your drop downs are up to date.

Liftoff!

We hope this series of articles has made you excited for the productivity we are bringing to OpenInsight programmers. Stop writing common everyday boiler plate code and let the precompiler do the work for you. You can try the SRP PreCompiler and #window directive today by downloading and installing SRP Editor 2.9. Let us know what you think in the comments below.

Leave a Reply