by developer2 · 10y ago · 0 comments
Welcome to the abysmal implementation of interactive controls. For some awful historical and technical reason, most standard UI controls - such as dropdown menus - are laid out on top of your application's window by the operating system. That UI control is not part of your application; it is implemented as a separate window by the operating system which positions it on top of your application window in the requested x/y location.
The screen capturing is designed to capture a single window, and so only captures your application without these separate windows that display elements like a dropdown menu. It really is a disgusting hack. In any reasonable implementation, these controls would be inlined within your application, not outsourced to the operating system.
This is the same reason why it took so long for browsers to support styling of form elements, such as changing the background color of a dropdown. The operating system simply provided no way to allow for this. I'm not sure if the modern browser implementation with styled form elements still works with the operating system, or if they are required to bundle their own controls in order to have full control over their rendering.
My Google-fu is failing me. Does anyone know why standard operating system controls are laid out by the operating system, rather than by the application using a standard library that keeps them inline to the app itself?