Sometime when you’re debugging your application you run into a situation where you get funky behaviour.
You might do something like Javier mentioned in his recent blog post on Xojo’s blog :
Dim ASource() As Integer = Array(1,2,3,4,5,6,7,8)
Dim ATarget() As Integer
ATarget = ASource
And, as he noted, you cant figure out why when you change one array you also appear to alter the other.… Read the rest
A question I was asked recently posed an interesting question about exceptions and the cost of using them as a general error handling mechanism.
Xojo uses whats know as “zero cost exception handling”. Essentially at runtime there is no penalty for having exception handling in place. It imposes no runtime overhead when NO exceptions are encountered.… Read the rest
On the forum there was a suggestion that a person should use a container control that had a few controls embedded in it at design time. And then when using that container control that they should skip providing an API that the container presented and just reach inside the container and manipulate the controls it contain directly.… Read the rest
Windows have two sets of properties that all relate to positioning a window.
However, they are not all quite created equally.
There are, of course, the typical top, left, width and height properties. And also the “bounds” property which is a Rect.
If you examine the bounds property for a Document window, and the top, left, width and height you will find that the Bounds.top… Read the rest
Suppose you have the need to create a custom control like I did recently
One of the things that you should do so people do not get confused about using your control is to “implement” any events in whatever you use as your base class that should not be exposed to end users of your control.… Read the rest
If you’ve ever used a container control on a layout and then tried to manipulate the controls at runtime with code like
For i As Integer = 0 To Self.ControlCount - 1
Dim ctrl As Control = Self.Control(i)
// now manipulate this control or call its methods
you’ve probably run into the EmbeddedWindowControl
Its what you get when you use a Container Control on a layout either by placing one at design time or dynamically adding one at runtime.… Read the rest
Interesting question from a dev I’ve know for a long time.
If I have a property that’s an enum, how do I tell that it’s not been set?
And this is a good question.
Because an enum is, at its core, an integer when you declare one and run its always initialized to the default value for an integer – 0.… Read the rest
Interfaces are one of those things in Xojo, and many other computing languages, that can really help you make your code more reusable and generic.
For instance, suppose you need a class that is a “List”. You could write a single class, called list, that you could add items to, remove items from, and generally manipulate in a “list like way”.… Read the rest
Kind of an oxymoron. A constant should be .. well .. constant.
However there are times you want that constant to be permanent, or constant, and unchangeable but it needs to be computed at compile time.
And it turns out that in Xojo you can do that IF you define a constant in code like :
Const foo = 123
Const bar = 345
Const foobar = foo + bar
If you assigned these constants to variables so you could inspect them like
Dim iFoo As Integer = foo
Dim iBar As Integer = bar
Dim iFooBar As Integer = foobar
you would see that iFoo, iBar and iFooBar have the values 123, 345, and 468 as expected.… Read the rest
A few threads on the forums have commented that the URLConnection isnt quite as easy to use as many might expect. In particular there are comments about having to know what error codes a platform might return makes it harder to use than it should be.
Normally Xojo hides this level of detail from us.
I was thinking about this problem and have come up with something of a solution that makes it possible to both know the specific error code and yet still write code that is portable.… Read the rest