tom@ssd.csd.harris.com (Tom Horsley) (03/04/90)
I have been trying to get my mind twisted around the model of programming that X widgets use, but my recent attempts have convinced me that I need more help than the opaque (but thick) documentation that comes with the Xaw library provides. Here is what I want to do: I want to make a new widget that has the Xaw List widget as its superclass. I want to inherit practically everything from the List widget, but I want to automatically provide the data for the list itself from some special information derived from one of my new resources (if you need a concrete example, think of a directory name being passed in as a resource, and the list being created from the contents of the directory --- this is NOT what I am doing, but if I could do this, I could also do the more complex task my application requires). To me, this seems like a perfect example of what the inheritance mechanism is all about in the first place, but I cannot figure out how to make it work. If I try to write an initialize() procedure for my widget, it gets called after the List widget has already had its initialize procedure called. But the List widget is the one that needs to do the initialization after I provide the list. If I try and use the XtListChange() procedure from within my initialize procedure it dies because it only seems to work right if the widget is already realized, but it certainly has not been realized since I am still in the initialization stage. Am I simply confused, or is such a simple task really impossible? I am using X11 R3. Could I simply be encountering yet another problem with the much maligned List widget in R3 which will go away when we get R4 up and running? (R4 will be up real soon now...) Is there is book that is actually in print now describing Xaw toolkit programming in a less opaque fashion than the stuff that comes with the release? (especially things like writing new widgets). I could certainly just make a copy of the whole List widget and add some junk to the initialize() procedure, but that sort of thwarts the whole object oriented business, doesn't it? -- ===================================================================== domain: tahorsley@ssd.csd.harris.com USMail: Tom Horsley uucp: ...!novavax!hcx1!tahorsley 511 Kingbird Circle or ...!uunet!hcx1!tahorsley Delray Beach, FL 33444 ======================== Aging: Just say no! ========================
kit@EXPO.LCS.MIT.EDU (Chris D. Peterson) (03/06/90)
> If I try to write an initialize() procedure for my widget, it gets called > after the List widget has already had its initialize procedure called. But > the List widget is the one that needs to do the initialization after I > provide the list. If I try and use the XtListChange() procedure from within > my initialize procedure it dies because it only seems to work right if the > widget is already realized, but it certainly has not been realized since I > am still in the initialization stage. 1) You could always call the List widget's initialization procedure again. 2) You could just perform the initialization stuff by rewriting that code w/o rewriting the entire list widget. I believe that the problems with XawListChange(XtListChange in R3) have been solved, but don't remember for sure. Chris D. Peterson MIT X Consortium Net: kit@expo.lcs.mit.edu Phone: (617) 253 - 9608 Address: MIT - Room NE43-213