Wondering how to create a nice and dynamic user interface? Typically when a form is resized, the form objects whose horizontal sizing or vertical sizing properties are set to move or grow, are automatically resized. In some cases (e.g., finer user interface management), developers choose to manage form object size and position by programming. To do so, they check the “on resized” event which is triggered within the form method. But what happens when the form contains one or more subforms? On many levels? This blog post gives you the answers!
subforms and sub-subforms and…
Managing subform objects when a “parent” subform object is resized might seem complicated, but it’s not! It can be done either using the Execute method in subform command or by modifying the associated value of the subform object, followed – inside the subform- by managing the generated on bound variable change event.
Starting with 4D v18, it’s even simpler! You can directly manage the on resize event in the subform method! Much more convenient, logical, and easy! This event will be triggered each time the size of the subform object is modified in the main form. This may happen when:
- the main form is resized (as well as the subform object). This is the most obvious case.
- a splitter modifies the height or the width of the subform object. Not quite as obvious, but worth mentioning.
- a subform object’s size is modified by programming using the OBJECT SET COORDINATES command. This case is even less obvious, don’t forget it 🙂
Conclusion
If you already manage these kinds of scenarios in your application, you may consider simplifying your code (Or not! “If it ain’t broke, don’t fix it”). But for future developments, you’ll appreciate this simplification of event management!