The Xojo docs about delegates are quite sparse about what you can or cannot do with them and whether they can or cannot take certain kinds of parameters. What they do say is that
A Delegate data type is an object representing a specific method. It is a function pointer with a method signature.
I was recently asked if a delegate that did not make use of any external dynamic library could take an object parameter.… 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
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
App Battles ! Winner takes all. Last man standing and all that !
No – nothing quite so fun (although it can be a lot of fun)
This has to do with the App class at design time vs the App METHOD (yes it’s a method) at runtime.
The app class at design time can be renamed however you want.… Read the rest
When using the “factory” pattern you should only be able to get a valid instance from the factory and NO other way. Thats kind of the point of the pattern – to reduce the number of points at which instances can be created. Normally in Xojo you might have a module with a method that can create instances, and its the only one allowed to do this.… Read the rest
An interesting question came up on the forums the other day about how to mimic “Unions” from C.
Turns out I had answered this some time ago – its close but not exactly the same as in C. But it is close enough to be functional and close enough for most uses.
And it’s not mentioned anywhere in the Xojo docs.… Read the rest
A recent feedback case made me think that there may be a real lack of information about attributes.
A lot of people believe that attributes are key value pairs that must have a valid identifier as the NAME and ALWAYS have a quoted string for a value.
This is incorrect.
Attribute name can be quoted strings – meaning you can, by using a quoted string for the name – have names that include spaces that would normally be invalid.… Read the rest