Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!ames!apple!bbn!husc6!genrad!slp From: slp@genrad.uucp (Stephen L. Peters) Newsgroups: comp.windows.x Subject: Re: Re: XtConvert & SetValues for floats Message-ID: <24061@genrad.UUCP> Date: 27 Jul 89 20:47:41 GMT References: <8907270952.AA01762@tub.UUCP> Sender: news@genrad.UUCP Reply-To: slp@genrad.genrad.COM (Stephen L. Peters) Organization: GenRad, Inc., Concord, Mass. Lines: 32 In article <8907270952.AA01762@tub.UUCP> net@TUB.BITNET (Oliver Laumann) writes: >> Now perhaps you can understand why there are no examples of widgets >> which use float resources. :-( > >When float resources are used, a pointer to a float is stored into the >argument value instead of a literal float. The Xaw scroll bar widget at >least (which has XtRFloat resources) works quite well. > >Or am I missing something? Alas, you're missing something. Or more to the point, the people who didn't check that floats didn't work missed something. The float resource will not automatically be converted to a pointer. No way, no how. If you want to do this, you have to do it explicitly (something that I ended up doing when I ran across this problem) by giving the pointer to XtSetArg, and having your widget expect pointers to floats. The Xaw scroll bar widget does not work. I looked closely at what was happening with it myself when I started having problems with my widgets. When you pass the scroll bar a float with XtSetArg, it truncates the percentage to an integer (giving a 0) and then, within the scrollbar code, it looks at the zero and converts it to the default. In other words, unless you pass a 1.0 with the XtSetArg, you will always get the default value for XtNshown or XtNtop. The scrollbar widget gets around this by having the XtScrollbarSetThumb procedure, so it looks like it works to the user. It doesn't, though. -- SLPster