Let's write a toy UI library
7 comments
·December 16, 2025null
ctoth
Which of these 24 parts cover accessibility?
Ah, this one:
> That said, you could add a description string to the common element header that screen readers could use, but accessibility concerns are out of scope for this toy UI library.
I love it when tutorials teach people to ignore people like me.
Am I being harsh? Well where's the tutorial that teaches people how to do it properly? Where do people actually learn the right way if not here?
Mikhail_Edoshin
Seems to be exactly what I was looking for. Somehow it's not that easy to find a good explanation of these techniques. I tried old graphic programming books, but their sections on GUI are tiny.
formerly_proven
If you don't keep it as a toy, it can get out of hand quickly. For example, here's the partial implementation of QWidget, almost 500k of code: https://github.com/qt/qtbase/blob/dev/src/widgets/kernel/qwi...
cosmic_cheese
I haven't yet written a UI library so it's not something I can state confidently, but based on adjacent work I've done, I imagine that a significant deal of complexity can be avoided by somewhat paradoxically embracing complexity early on and designing for all the eventualities.
UI frameworks are one place where outside of toy projects, YAGNI doesn't really apply as much, and so things like focus systems and accessibility affordances should be factored in from day one. If you go in with the attitude of writing something "elegant", you're going to end up bolting these things on after the fact and writing contorted code to make it all fit together. It's like finding out that you need a skyscraper after building foundations and framing for a cottage.
self_awareness
It looks like WinAPI Window Management via CreateWindow / SetWindowText / SendMessage.
imvetri
is it an application builder?