Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!csd4.milw.wisc.edu!bionet!ames!pasteur!cory.Berkeley.EDU!dheller From: dheller@cory.Berkeley.EDU (Dan Heller) Newsgroups: comp.windows.x Subject: Varargs interface to widget routines Message-ID: <12473@pasteur.Berkeley.EDU> Date: 16 Apr 89 00:42:22 GMT Sender: news@pasteur.Berkeley.EDU Reply-To: dheller@cory.Berkeley.EDU (Dan Heller) Organization: University of California, Berkeley Lines: 56 I've had lots of good feedback from X11 users with respect to the WidgetWrap routines that are in the X11R3 distribution and I am now tempted to query the X "powers" about providing the same or a similar interface to the Widget routines as part of the toolkit intrinsics. Briefly, the WidgetWrap library allows you to create widgets, set attributes and get attributes of widgets using variable argument lists (which are NULL terminated) and thus obsoleting macros and functions such as XtSetArg(), XtGetArg(), XtCreateManagedWidget() and XtCreateWidget(), etc... Code is much more simplified and easier to read as a result. Source and binaries are even smaller because you no longer need static arrays of structures, local pointers, and even some constant string values (because you may pass NULL as the "name" of a widget if it is no concern). For example, to create a form with a command widget in it: ... Widget form, button; form = WidgetCreate("formWidget", formWidgetClass, parent, XtNbackground, BlackPixelOfScreen(XtScreen(parent)), XtNdefaultDistance, 5, NULL); button = WidgetCreate(NULL, commandWidgetClass, form, XtNlable, "Push Me", XtNborderWidth, 2, NULL); ... WidgetSet(button, XtNsensitive, False, XtNborderWidth, 1, NULL); ... I have made some more enhancments to the WidgetWrap routines and will make them available as soon as I can. But the point to this aritcle is to request that such an interface be incorporated into the intrinsics somehow -- I'm not concerned with whether or not my code is used because I may have overlooked some design consideration that others may deem necessary (of course, those should be pointed out to me, but none have yet to date). My WidgetWrap libraries use the XtSetArg and XtWidgetCreate functions and macros to implement the varargs interface, but the beauty of it is to hide such messiness from the programmer. I invite discussion about this from the X community in the hopes that everyone's work will be much more simplified as a result. Again, the WidgetWrap directory is in the R3 contrib directory. Newer versions can be obtained from me by email and I will try to post the newer version when I can. Dan Heller