Modular Design for Multiple Windows
Most GUI programs will work with more than one window. When you're used to traditional text-based programming, it can be a little tricky to get your head around the logic of making windows come and go in an event-driven environment, but if you organize your code using the trick you are about to learn, it should begin to make perfect sense.
Window Subclasses and Test Code
When designing a window, we never write code to create a Gtk::Window directly; instead we write a subclass of Gtk::Window and instantiate that subclass. (The same idea applies when working with other Gtk classes, as you'll see.) This involves just a little extra overhead, compared to what we've been doing. Each new class will go in a file that ...
Get Sams Teach Yourself Ruby in 21 Days now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.