Closed MikeLorenz closed 5 months ago
Hi Mike! Thanks for the feedback and for using NAppGUI.
The IP-Input control works the way you describe. The editboxes, buttons, and logic are encapsulated in a Panel object, which is itself an individual control (or widget) that can be linked to any window.
Panel *ip_input(void);
If you want to get rid of the buttons, and keep only the 4 editboxes and the '.''s, you should remove the buttons and the layout(1,3)
in ipinput.c
.
You have a more advanced example in layoubind.h/.c
where data structures are also linked within the panel itself
Panel *layoutbind(void);
Custom rehusable Panel
On the other hand, if what you are looking for is a "custom control" that allows you to draw whatever you want and have control of the mouse and/or keyboard, take a look at listbox.h/.c
. This control uses a generic View
and internally manages all the logic and drawing of the control. A more advanced example of a Custom Control would be tableview.h/.c
.
Custom Control
I hope I've helped Greetings.
How would I go about creating a reusable custom control? For instance, if I wanted to take the "IP Address" sample and wrap those 4 textboxes, character filtering, and error checking into a single control that could be added to a window in a single step, how would I do that?