Path: utzoo!attcan!uunet!tut.cis.ohio-state.edu!cs.utexas.edu!sdd.hp.com!decwrl!bacchus.pa.dec.com!asente From: asente@wrl.dec.com (Paul Asente) Newsgroups: comp.windows.x Subject: Re: floats and XtSetArg Message-ID: <1990Jul3.231215.25447@wrl.dec.com> Date: 3 Jul 90 23:12:15 GMT References: <9007021151.AA13264@expo.lcs.mit.edu> Sender: news@wrl.dec.com (News) Organization: DEC Western Research Lab Lines: 25 In article <9007021151.AA13264@expo.lcs.mit.edu> sheehyjp%v701.DECnet@NUSC.NAVY.MIL ("V701::SHEEHYJP") writes: > > I'm in the process of writing my first widget and I would like to use >a variable type float as one of my resources. I have the converter (I'm using >R3) and everything works fine when I use the default or if I place the float >in a resource file, but when I try to hard code a value in my application >using XtSetArg, the widget always gets a zero. How can I use XtSetArg to >send a float to my widget? I hope there is someone out there who can help. You *really* don't want to do this. *Really*, *really*, *really*. By now you've probably seen the other responses that show you how to make this work, so I won't go through them again. But do you want to make everyone who uses your widget have to go through all that complexity? Consider either creating a new resource type, a pointer to a float (you should still be able to create a converter just fine, but you'll also need a destructor) or replacing the resource with two integers, either numerator/denominator or value/scale. It's unfortunate that specifying float resources is so hard, but it is. Better to avoid them than to constantly expose the problem to people. -paul asente asente@decwrl.dec.com ...!decwrl!asente