I’ve started to implement my own ‘standard’ interface method for any gadgets.
As I wrote, the main problem with gadgets it the lack of a UNIQUE way to changes parameters (Value and Range are only for SliderGadget for example).
So the first step it’s to classify all gadgets (proxygadgets included): I’m extended the method Class() for know any proxygadgets, adding GADGET_ICONGADGET, GADGET_LISTMANAGER, GADGET_FILEPICK and so on to MaxGUI consts.
The second step is choosing the way to ‘communicate’ with gadgets.
I’ve abandoned the (over-complicated) idea to use reflections/callbacks to follow instead a simpler way: a function and a bunch of Select/case instructions. It’s more readable, lighter and it should work without ‘breaking’ anything else.
At the moment I’ve implemented SendGadgetMessage(gadget,message$) – where gadget is (of course) the gadget, and message is a string containing the ‘commands’ and the ‘parameters’. Each commands is separated by a semicolon (;)
It supports (for now) the following ‘instructions’:
- enable
- disable
- hide
- show
- fcolor=x,y,z
- bcolor=x,y,z
- title=x
- range=x,y
- value=x
of course range has effect only on a GADGET_SLIDER/GADGET_SPINNER, title only on gadget that show some text, and so on.
You can simply write something like
SendGadgetMessage button,"title=Hallo;fcolor=200,10,10;disable"
to change the gadget text in ‘Hallo’, changing the foreground color to 200,10,10 and to disable the gadget. Only with one command.