Beijer Electronics (formerly QSI Corporation)

Manufacturer of Mobile Data and Human Machine Interface Terminals.
It is currently Mon Nov 20, 2017 2:23 am

All times are UTC - 7 hours




Post new topic Reply to topic  [ 4 posts ] 
Author Message
PostPosted: Thu Apr 27, 2006 9:04 am 
Offline
User avatar

Joined: Thu Apr 27, 2006 8:50 am
Posts: 39
Location: Duncan, OK
Slider V2 object that is used for a variety of ranges.



Range 1:

max 106000

min 1500



Range 2:

max -1500

min -34000



If I attempt to set range 2 after range 1 has been used the validation function for max sets my max not to -1500 but to 1500, but does not give me any indication that it has done this (until I debug it) to see what's going one.



It would be nice if there was some sort of indication from the validation function (exception) that the expected action had not taken place. I prefer this over logic in the validation function that tries to fix the slider for me.



And now a emoticon for good measure: :?


Top
 Profile  
 
 Post subject:
PostPosted: Thu Apr 27, 2006 9:22 am 
Offline
QSI Support
QSI Support
User avatar

Joined: Wed Mar 08, 2006 12:25 pm
Posts: 881
Location: Salt Lake City, Utah
Well, you are bringing up an age old debate: What do do when someone sets an invalid property value. As you have seen most Qlarity objects opt to correct the invalid value rather than throw an exception.



There are, of course, long winded arguments for both approaches. However, in your case, I can certainly see how an exception would be preferable.



Of course, the easy workaround in your scenario is to set the min before the max. If you are interested in a more robust solution, you could always create a new template inherited from the SliderV2 template and override the min and max validation functions as follows:



Code:
func max(newval as float)

    if newval <= min then

        throw(str(me)+".max", "Invalid Maximum value")

    endif

    default(newval)

endfunc




This, of course, is a bit more work but will provide a general purpose solution to your dilemma.



Edit: Added the call to default() in the sample code. Can't believe that I forgot that.

_________________
Jeremy
http://www.beijerinc.com


Last edited by Jeremy on Fri Apr 28, 2006 8:53 am, edited 1 time in total.

Top
 Profile  
 
 Post subject:
PostPosted: Fri Apr 28, 2006 7:35 am 
Offline
User avatar

Joined: Thu Apr 27, 2006 8:50 am
Posts: 39
Location: Duncan, OK
You have a good point. I was being the bonehead by trying to put the slider in an invalid state. The whole issue is easily avoided by setting the min/max in an order that doesn't attempt to put the slider in an invalid state.



Maybe there could be an exception of such insignificant priority that it presents a message in the debug pane but is ignored if it bubbles up? Might help a developer reduce the amount of time spent hunting the bug. Just a thought...


Top
 Profile  
 
 Post subject:
PostPosted: Fri Apr 28, 2006 8:55 am 
Offline
QSI Support
QSI Support
User avatar

Joined: Wed Mar 08, 2006 12:25 pm
Posts: 881
Location: Salt Lake City, Utah
Well your suggestion is a good one. We already employ it in a number of other contexts, in particular with communications libraries. Next time we do a major object development cycle I will see if we can get that added in.

_________________
Jeremy
http://www.beijerinc.com


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC - 7 hours


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group