Re: [Plib-users] (cory vs. pui) The attack of setValuator
Brought to you by:
sjbaker
From: cory b. <co...@gm...> - 2008-06-13 18:59:37
|
I haven't tried the most recent SVN version. I will try that and let you know. May be tuesday before I have a chance to try that. I am going out of town. thanks, Cory On Fri, Jun 13, 2008 at 9:25 AM, Fay John F Dr CTR USAF 46 SK <joh...@eg...> wrote: > Hmmm ... I'm running on Windows, but that shouldn't make a difference. > (Of course, "shouldn't" is the longest word in the English language, > right up there with "if.") > > Have you tried getting the most recent SVN version? > > Unfortunately I've been away from the library for a couple of years now, > and I'm a bit rusty on what's what. > > John F. Fay > Technical Fellow > Jacobs Technology TEAS Group > 850-883-1294 > > -----Original Message----- > From: pli...@li... > [mailto:pli...@li...] On Behalf Of cory > barton > Sent: Thursday, June 12, 2008 5:13 PM > To: PLIB Users > Subject: Re: [Plib-users] (cory vs. pui) The attack of setValuator > > 1.8.4c2 ubuntu package > > > > On Thu, Jun 12, 2008 at 5:30 PM, Fay John F Dr CTR USAF 46 SK > <joh...@eg...> wrote: >> Sorry, I still can't get it to crash. >> >> What version of PUI are you using? >> >> John F. Fay >> Technical Fellow >> Jacobs Technology TEAS Group >> 850-883-1294 >> >> -----Original Message----- >> From: pli...@li... >> [mailto:pli...@li...] On Behalf Of cory >> barton >> Sent: Thursday, June 12, 2008 3:53 PM >> To: PLIB Users >> Subject: Re: [Plib-users] (cory vs. pui) The attack of setValuator >> >> Here is the code: >> >> <snip> >> >> >> On Thu, Jun 12, 2008 at 4:42 PM, Fay John F Dr CTR USAF 46 SK >> <joh...@eg...> wrote: >>> Hmmm ... unless somebody else steps in, please forward me a copy of >> the >>> offending code. I've tried putting in your code snippet and the >> program >>> works just fine for me, so evidently something else is going on. >>> >>> John F. Fay >>> Technical Fellow >>> Jacobs Technology TEAS Group >>> 850-883-1294 >>> >>> -----Original Message----- >>> From: pli...@li... >>> [mailto:pli...@li...] On Behalf Of cory >>> barton >>> Sent: Thursday, June 12, 2008 3:19 PM >>> To: PLIB Users >>> Subject: [Plib-users] (cory vs. pui) The attack of setValuator >>> >>> I found the following in the PUI documentation today: >>> There are many occasions when you'd really like to have the PUI > widget >>> directly drive and/or reflect the value of some memory location in > the >>> application code. These calls let you do that: >>> >>> void puObject::setValuator ( int *i ) ; >>> void puObject::setValuator ( float *f ) ; >>> void puObject::setValuator ( char *s ) ; >>> >>> >>> Once you make one of these calls, PUI will automatically update the >>> memory location indicated with the current value of the widget >>> whenever it changes - and also update the appearance of the widget to >>> reflect the value stored in that memory location whenever the widget >>> is redrawn. This is often a lot more convenient than using a callback >>> function to register changes in the widget's value. >>> >>> So I tried it out: >>> //global variable >>> float update = 1.0f; >>> >>> //initialize my puInput inside a function >>> //hertz text input >>> hertz_text = new puInput ( curx, cury, >>> curx + >>> PUI_TEXT_WIDTH, >>> cury + >>> PUI_TEXT_HEIGHT ) ; >>> hertz_text->setValuator( &update ); >>> hertz_text->setLabel( "Hertz" ); >>> hertz_text->setLabelPlace( PUPLACE_TOP_CENTERED ); >>> >>> >>> This compiles, and runs. >>> >>> It seems to work correctly as long as I do not remove all of the >>> characters from the puInput box. However if I am trying to change the >>> value, when I am typing in the new value, if the new value ever >>> becomes a non valid float value, then the program crashes. For > example >>> if I want to change 1.0 to 2.0 and I delete 1.0 so I can type 2.0, >>> then instant crash. I can change from 1.0 to 2.0 if I type the 2 > after >>> the 1, and then erase the 1. >>> >>> Searching the mail archives and googling didn't help, so I am posting >>> here. >>> >>> I suspect either my weak understanding of pointers means that I am >>> passing an incorrect argument to the setValuator function, or maybe >>> the puInput object is writing invalid data to the update variable. >>> >>> Please let me know how to fix this. >>> >>> thanks, >>> >>> Cory >>> >> >> >> > ------------------------------------------------------------------------ > - >> Check out the new SourceForge.net Marketplace. >> It's the best place to buy or sell services for >> just about anything Open Source. >> http://sourceforge.net/services/buy/index.php >> _______________________________________________ >> plib-users mailing list >> pli...@li... >> https://lists.sourceforge.net/lists/listinfo/plib-users >> > > ------------------------------------------------------------------------ > - > Check out the new SourceForge.net Marketplace. > It's the best place to buy or sell services for > just about anything Open Source. > http://sourceforge.net/services/buy/index.php > _______________________________________________ > plib-users mailing list > pli...@li... > https://lists.sourceforge.net/lists/listinfo/plib-users > > ------------------------------------------------------------------------- > Check out the new SourceForge.net Marketplace. > It's the best place to buy or sell services for > just about anything Open Source. > http://sourceforge.net/services/buy/index.php > _______________________________________________ > plib-users mailing list > pli...@li... > https://lists.sourceforge.net/lists/listinfo/plib-users > |