Page 398 -
P. 398
custom widgets and classes
Group widgets together
Add a checkbox
If the interface were laid out with the checkbox for a track grouped Add a slider. Add a
alongside the volume slider for the same track, it would look better. checkbox...
Each track could then have a row of widgets associated with it. As long as you
know which widgets belong to which track, you can load a lot more tracks at
once without the checkboxes and sliders getting separated (and without your
users getting confused).
The program currently uses a function to add the checkboxes and sliders to
the interface one widget at a time. If you call the function several times, the
computer creates two more widgets with each call. But the widgets are not
grouped. So, how do you group widgets together in a GUI interface?
Create a new type of widget
What if you don’t just hand the computer a set of instructions? What if you
give it a brand new widget instead? The GUI
packer
If you create a new kind of widget that groups a checkbox with a slider,
you can add your new widget to the interface and then guarantee that the
checkbox and slider stay together:
Your new widget
“glues together”
the other widgets
so they always
stay grouped.
Your new widget becomes a new building block for your GUI interface.
So, how are new widgets created? And how do they work?
you are here 4 363