From my experience with other OOL it is generally a best practice to NOT use base classes directly, but to create your own subclasses for all base classes.
Is that recommended for Xojo as well?
If so, what is the most efficient method to create all of these subclasses?
I am very new to Xojo, so I apologize if this has been asked/answered already. I did do a Google search and a Google site search of the Forum, and a search of the Xojo documentation, but did NOT find an answer to this. A lot of other OOD: Classes info, but not how to subclass all base classes.
[quote=491593:@Jim Underwood]Well, I don’t know about “easier”.
I’d rather spend my time writing a script rather than having to set the properties each and every time I add a control to a window.[/quote]
I think subclassing window and in the open event iterating over the controls in a generic way to set your defaults is easier than writing a xojo script! You would not be setting them manually that way either and you only need to create one subclass.
[quote=491580:@Jim Underwood]From my experience with other OOL it is generally a best practice to NOT use base classes directly, but to create your own subclasses for all base classes.
Is that recommended for Xojo as well?[/quote]
No. It is not. You should only subclass when you find a real need. Xojo classes are fully functional out of the box.
It isn’t a question of whether the base classes are fully functional, or not – I’m sure they are.
It is a question of ease of global customization later on, after the app is fully developed, and even deployed.
For example, how you guys handle this: Many clients want and expect the ability to change certain UI features like font face and font size, across the entire app. So how would you provide this without using subclasses?
For that matter, the base classes for Labels, TextFields, TextAreas, etc do not have a property shown in the IDE for font face.
How would you provide a consistent font across the entire app if you did not want to use the “system” font?
It would be easier to follow Karen’s suggestion and subclass Window and put code in it to set the attributes of all the controls on the window. That said, there are several controls that I have subclassed to add additional functionality. But not all controls need it. I put them in an external module so I can share them between projects. I have code in my window subclass to set typeface and size, and to dynamically resize all the controls to achieve an “elastic” feel to the window.