Buttons and input fields don’t actually exist. Rather, a rectangle is drawn and text is drawn on top of that. Programming toolkits often hide this and making a button or text field from scratch involves more than just rectangles and text. The 11:50pm GitHub post shows on lines 267, 520, 585 – 648 only part of the effort involved in making a button or text field from first principles (Charles Petzold 1998 style).
Screen Layout with Text atop Widget Outlines
Each text label is in the proper place. After looking at the GitHub repository commit at the link above, anyone wanting to understand the techniques involved need look no further than Charles Petzold’s 1998 publication. Charles’ 1998 book, Programming Windows 5th Edition I read 8 – 10 years ago and found the tips within useful in building screens using raw C or C++. Rarely do the techniques apply when using easier to use kits like WPF, Swing, wxWidgets, Qt, or FLTK but when you need to drop to a more fundamental graphics programming level, his book remains relevant. If anyone is confused by the reference to Charles Petzold’s Windows book, the below application is written in pure standard C++ (not the Microsoft version) on the Fedora Operating System using gcc, gedit, and the command line using not Win32 but the Allegro video game programming library. Microsoft Visual Studio, Windows, and WPF are not the only ways to build a UI application. Anyway, text is now associated with the widget outlines.