imagination and GUI design

Started by Johan Klassen, December 16, 2025, 06:34:27 AM

Previous topic - Next topic

Johan Klassen

it is said that Nikola Tesla's imagination was his most powerful invention tool; he could construct, test, and perfect entire machines in his mind with vivid, detailed visualizations, sometimes experiencing them so strongly he couldn't tell them apart from reality, allowing him to skip early prototyping and develop groundbreaking tech like the AC motor and radio using intense mental simulation before ever touching a physical component. He used powerful mental imagery and lucid dreams, treating his mind as a virtual lab, seeing wear and tear on imagined parts as if they were real.

but for people that don't have such a gifted imagination, how do you program a GUI without a designer?
I am interested in the steps that SDK programmers take to design a GUI and it's components

Paul Squires

Interesting question.

A lot of times when I'm creating a new program, I research existing applications with similar functionality. I create a folder of screenshots containing main screens, data entry screens, etc. I save pictures of traditional desktop applications and newer web based applications. I also take note of colors and themes, not just control layouts.

The physical act of coding the GUI in code is not that difficult. It just involves ensuring that spacing and sizing of the controls is correct and that entails a lot of trial and error and compile after compile to chekc your progress. However, once you've created a button, listbox, etc, then a quick copy/paste and changing the positioning parameters is easy.

Usually resizing a window and repositioning all of the controls within that window is a tedious task when done from WM_SIZE, but José has already taken care of that within the AfxNova library via his positioning rules.

I think, like everything, the more you code GUI's via code, the easier it becomes. In my programming lifetime, I have used both visual designers and hand coding. Each has it's pluses and minuses. Coding by hand certainly ensures and reinforces that you understand the underlying code whereas sometimes with visual designers you become too reliant on the black box magic that the visual designer is pumping out for you. I will say though that the older I get, the more I use hand coding. It tends to future proof your code because the code is no longer tied to a specific visual designer.
 
Paul Squires
PlanetSquires Software

José Roca

I only used a visual designer once, just for trying. I prefer to code by hand: it takes more time to design the gui, but I have absolute control. I have writen small templates for each control. They allow me to remember its particularities. They are like notes, but with working code. CWindow is a class on top of CreateWindowEx that simplifies several boring tasks of SDK programming, like registering classes, providing default styles for the controls, resizing, colors and scaling according the DPI. It also provides a default message pump that is useful in most cases, but it is optional: you can use your own message pump. Most of the features of CWindow are optional. You can use AddControl or you can use CreateWindowEx; you can anchor the controls for automatic resizing or you don't and do it in WM_SIZE; you can set colors for static controls, or you don't and process the CTL_XXX messages, etc. That is, you aren't forced to use all its features, only these that you wish. For the rest, you can use your own progeamming style instead of being forced to follow the rules of the visual designer (this is the part that I don't like of them).

Johan Klassen