Consolidation of GETting/SETting Gadget attributes
Posted: Wed Apr 14, 2004 9:06 pm

This would allow us to get rid of a lot of gadget-specific functions and simplify and generalize things greatly. We wouldn't have to remember the large myriad of functions, just have handy a simple list of #PB_... constants.
These functions could be used to Get and Set ALL attributes (properties) for gadgets/windows/items, such as: XY coordinates, text, width, height, font, selected, checked, number of rows, alignment, hidden/shown, etc. etc.
A SMALL list of possibilities:
X = GetGadgetAttribute(#MyGadget, #PB_GadgetX)
RowSelected = GetGadgetAttribute(#MyListGadget, #PB_RowSelected)
Text = GetGadgetAttribute(#MyCheckbox, #PB_Text)
Visible = GetGadgetAttribute(#MyGadget, #PB_Visibility)
SetGadgetAttribute(#MyGadget, #PB_Text, "Gadget Text")
SetGadgetAttribute(#MyGadget, #PB_FontName, "Arial")
SetGadgetAttribute(#MyGadget, #PB_GadgetX, 123)
SetGadgetAttribute(#MyListGadget, #PB_Columns, 5)
SetGadgetAttribute(#MyGadget, #PB_Visibility, #TRUE)
Also, as new gadgets come along, just new gadget attribute constants would need to be added to support the new gadgets, not a set of specialized functions. Many PB functions are already generic across most gadgets, but many aren't and are specific to certain gadgets. We could get rid of functions like Set/GetGadgetState, Set/GetGadgetText, Set/GetGadgetFont, etc. etc.
Perhaps a total of 6 simple functions for Gadgets, Windows and "Items" and a consistent list of #PB_... constants would be all that is needed.
e.g.
SetWindowAttribute(#MyWindow, #PB_State, #PB_Minimized)
State = GetWindowAttribute(#MyWindow, #PB_State)
Thoughts?