Path: utzoo!utgpu!news-server.csri.toronto.edu!rutgers!cs.utexas.edu!yale!mintaka!bloom-beacon!eru!luth!sunic!mcsun!ukc!harrier.ukc.ac.uk!rlh2 From: rlh2@ukc.ac.uk (Richard Hesketh) Newsgroups: comp.windows.x Subject: Re: Grabbing the AsciiWidget scrollbar. HELP. Message-ID: <5145@harrier.ukc.ac.uk> Date: 21 Jul 90 10:03:18 GMT References: Reply-To: rlh2@ukc.ac.uk (Richard Hesketh) Distribution: comp Organization: Computing Lab, University of Kent at Canterbury, UK. Lines: 54 Summary: Expires: Sender: Followup-To: In article roy@neptune.iex.com (Roy Cantu) writes: >AsciiTextScroll(widget) >AsciiWidget widget; >{ > Widget v_bar; > > v_bar = XtNameToWidget(widget, "vScrollbar"); > XawScrollbarSetThumb(v_bar, 0.5, -1.0); >} >This looks good on paper to me, but when I check >to see if v_bar has a value, it turns out to be >NULL. Obviously not a good sign. The inspiration >for the name to widget argument "vScrollbar" comes >from line 380 of Text.c. I have also tried "vbar" >instead of "vScrollbar", but to no avail. XtNameToWidget() can only search the children of composite parents and popup shells. "vScrollbar" is created as an unmanaged child of the Text widget (which is not a composite parent). This is perfectly legal as long as the child is not managed and is explicitly mapped. However XtNameToWidget() cannot find it by just searching the child lists of composite parents. >Any suggestions or better ways of doing this will >be greatly appreciated. I hate to keep bugging >people about this, but it is REALLY important. Either there should be additional resources in the TextWidgetClass; XtNvertScroll & XtNhorizScroll both XtCReadOnly and XtRWidget. That gives the programmer access to the widget ids. via GetValues. Or you need to write your own routine that picks it straight out of the TextWidgetClasses structure: #include #include Widget TextScrollbar(tw, vertical) TextWidget tw; Boolean vertical; { return (vertical ? tw->text.vbar : tw->text.hbar); } >roy cantu I think that it is probably a good idea for all widget writers to allow (atleast) read-only access to sub-widget members, for just this sort of occasion. We really don't know all the possible uses someone may have for a widget class so we need to add simple hooks in the classes to allow unforeseen uses to be developed. Richard