2 posts / 0 new
Last post
TSK's picture
Last seen: 8 months 3 weeks ago
Joined: 2011-06-28 02:06

Do anybody have a working example how to use BUTTON_VarArgs of the button gadget in SetGadgetAttrs call ?

salass00's picture
Last seen: 1 month 1 week ago
Joined: 2011-02-03 11:27
Re: BUTTON_VarArgs

Something like:

  1. ULONG args[2];
  2. args[0] = (ULONG)device_name;
  3. args[1] = unit_number;
  5. SetGadgetAttrs(button, window, NULL,
  6. BUTTON_VarArgs, args,
  7. GA_Text, "%s:%ld",
  8. TAG_END);

Because of how the GA_Text/BUTTON_VarArgs tags are currently implemented (either tag trigger VSNPrintf() to be called if the other has already been set) I would not necessarily recommend changing the number or type of varargs used this way as it can easily lead to DSIs unless you are careful (you would have to first set GA_Text to something safe like an empty string, then update BUTTON_VarArgs and then set GA_Text to what you want).

Also you may want to ensure that the args array stays valid as long as it is used by the gadget.

Log in or register to post comments