Skip to content

Author: Norman Palardy

Supporting Multiple Cores

With today’s multi-core CPU’s it seems that an application made with Xojo running on a single core is somewhat restricting. If you have a lot of data to process, large images to manipulate or other things that could happen in the background, it would seem that with a multi-core machine you could do this faster “if only Xojo would make threads preemptive”. We get a lot of requests for preemptive threads so that people can take advantage of multiple cores.

Comments closed

Control Subclass Constructors

A constructor is a special method that is used to initialize a class. They are very handy, but when you use them with control subclasses you have to be aware of how a control’s properties are initialized. Perhaps you’ve run into this situation:

“I have a constructor on my control and the values that I set in the constructor don’t stick.”

Comments closed

Aren’t those Xojo keywords?

Many times we get bug reports or feature requests about issues with keywords not highlighting or being colorized in the code editor. But are those words actually language “keywords” or reserved words in Xojo?

In reality none of the intrinsic types are reserved words. They’re just types in the global namespace. Xojo knows where a type name is required and it will only look for types in that context. The opposite holds true as well. In effect, the types are treated as if they live in their own namespace.

Comments closed

Raise Your Events The Right Way

The other day I was asked: “Dumb question of the day! An Event Definition can have a Return Type defined. What is the syntax for RaiseEvent to make use of the Return Type?”

But this isn’t a dumb question at all since there are actually two valid ways to do this. I find one more obvious than the other. Here are both solutions so you can decide for yourself:

Comments closed

Using a Property as a Constant

Wikipedia says:

In computer programming, a constant is a value that cannot be altered by the program during normal execution, i.e., the value is constant.

In Xojo we have constants that can be defined in code or added to modules, classes, etc. What you’ll notice about Wikipedia’s definition of “constant” is that it’s a behavior, not a specific type.

There is another way to define a “constant” or “a value that doesn’t change throughout the run of your application”.

Comments closed

Tip: Pass Values Between Windows with an API

A question on the Xojo Forum got me thinking that it may not be obvious how to avoid having to reach inside another window (or dialog etc.) to access its controls to get and set values. I’m sure we all have done this at one time or another but it really is something you should avoid. Here’s a small app to demo how to make an API instead:

Comments closed

Do you still ASCII?

From time to time we get code that illustrates a problem a user is having when they rely on old-school ASCII. This problem can occur when using the Chr function to create a character.

One example we see reasonably frequently is code to create a string that contains a quote like:

 dim someString as String = chr(34) + "someValue" + chr(34)

This style is not necessary and may give unwanted results if you have an unusual string encoding. Instead, you can write this without the use of the Chr function. Here’s how:

Comments closed