Operator_Convert

Operator_Convert is a very handy method to implement on a lot of classes. It not only lets you create a mechanism to make your classes convert themselves into other types but it also lets you create new instances FROM other data types.

So let’s start with the simple forms of operator_convert – the “convert TO” forms.… Read the rest

Downgrade 2019.R2 to 2019.R1.1

It had to happen sooner or later. But now questions about how to do this are appearing. And the answer is “it depends”.

ALWAYS use a copy or have a backup copy of your entire project JUST in case something goes wrong.

IF you have a license that permits you to save as text (Xojo Project) save your project as a text project.… Read the rest

Prepared Statements

Often you’ll hear people say you should use prepared statements to avoid sql injection issues. They’re not wrong. But there can be other reasons to use them.

In some db’s when you create a prepared statement and use it over & over you can avoid a fair amount of a speed hit.

When you initially create a prepared statement many db engines will actually do some work to figure out what the optimal mechanism, or query plan, is to access the data in a table.… Read the rest

Extension methods

Sometimes you run into a situation where you want to add functionality to an existing data type. It might be a string, integer, array or perhaps one of the built in classes that you want to add new functionality to.

Exactly how do you do this ?

You can’t just edit the framework and add new methods to the String type.… Read the rest

Moving to 2019r2

2019r2 changes a LOT of things.

Some of the things it changed are subtle and search and replace may NOT be the best approach to updating these.

For instance string method like Mid changed from being a 1 based offset for the starting position to a 0 based offset.

If all you do is change mid to middle you will inadvertently cause an off by one error because the start is now 0 based not 1 based.… Read the rest

Spot the bug

You might run into this one from time to time. I know it has bitten a LOT of people and it’s not intuitive at all.

In a new desktop app add a new Class. The default name of Class1 will work fine. And create a new subclass of this. Again the default of CustomClass1 will work fine.… Read the rest

About incremental compilation

There are ways to see what is / isnt being recompiled

Its one of those many temporary files xojo creates

First thing you need is the PID of the specific instance of xojo you’re interested in.
It makes life simpler IF you just run one version at a time
Once you start Xojo you can look in Activity Monitor & get its PID

If you find the dir referred to by SpecialFolder.Temporary… Read the rest

About Events

Seems there is some lack of clarity about event handlers and event definitions and how this affects 2019r2.

Lets start with event handlers and event definitions.

When you take a control, like a push button, and drag one onto a layout you are creating an instance of a button on that layout. And you can add event handlers to that control.… Read the rest

ByVal and ByRef

A recent thread on the forums made it clear there is some lack of clarity about ByVal and ByRef

So here’s yet another attempt.

Value types are ones that the data assigned to them is stored right IN the memory location the compiler set aside for them.

A statement like

dim i as integer

reserves a spot in memory when you compile.… Read the rest