On Mon, 12 Oct 2015, Moviga Technologies wrote: > Your example works.... I realise now that the problem was that I called > Test() from within the class, but you are calling it from the outside. I > guess the ScrollArea was not properly instantiated. Is there any way to > test if the class has been properly created from within the .Class file? > (It really doesn't matter any more now with my current project, but > perhaps for the future.)
If you run code (which is not in a Static procedure) from the class, it must be executed in the context of an object of that class. Therefore: whenever you execute code, the object *is* ready[*]. >From what you're saying, I can only conclude that you didn't understand how the Draw event works. You can only paint on a ScrollArea during its Draw event. Naturally this event is caught not by the ScrollArea itself but by another object (like the Form the ScrollArea lives on or a UserControl which embeds the ScrollArea). You could, nevertheless, catch your own events using an Observer, but your current solution with the UserControl is much better. Regards, Tobi [*] The object constructor, _new(), plays a special role here. The object cannot raise events before its constructor finishes. -- "There's an old saying: Don't change anything... ever!" -- Mr. Monk ------------------------------------------------------------------------------ _______________________________________________ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user