dheller@cory.Berkeley.EDU (Dan Heller) (04/16/89)
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 <island!argv@sun.com>
bzs@bu-cs.BU.EDU (Barry Shein) (04/17/89)
I find the WidgetWrap routines very helpful, it seems like a small enhancement at first glance but for some reason it seems to turn typical application prototyping from hunt-and-peck with some head-scratching to just a typing-speed exercise. Particularly the WidgetSet/Get routines tho WidgetCreate is also very handy. Most importantly, it seems to really speed up the time it takes to explain how to write a simple application to an experienced programmer just wading into the X waters, more intuitive I guess (tho I hate explanations which end like that!) Granted it's an evolutionary step towards something even more sophisticated but it's here, it's useful, it's defined in a straightforward manner. I'd urge blessing it. -- -Barry Shein, Software Tool & Die There's nothing more terrifying to hardware vendors than satisfied customers.
asente@decwrl.dec.com (Paul Asente) (04/18/89)
In article <29710@bu-cs.BU.EDU> bzs@bu-cs.BU.EDU (Barry Shein) writes: >I find the WidgetWrap routines very helpful... If we were starting again from scratch, we almost certainly would add varargs versions of the routines that take arg lists. As it is, the current climate is to only change the intrinsics to address problems that cannot currently be solved. I think the right place for the WidgetWrap routines is in the Xmu (miscellaneous utility) library. MIT comments? -paul asente asente@decwrl.dec.com decwrl!asente