Re: [Plib-devel] puSlider
Brought to you by:
sjbaker
From: Steve B. <sjb...@ai...> - 2000-08-15 21:51:02
|
Fay John F Contr AAC/WMG wrote: > > The problem Dave found was that there is an ambiguity between the original > puSlider constructor with "vertical" specified and the new puSlider > constructor with "vertical" left as a default. If the user creates a new > puSlider object with four integer arguments, the compiler doesn't know which > constructor to call. Personally, I wouldn't have overloaded the constructor at all. I'd probably have done this: puSlider ( int minx, int miny, int sz, int vertical = FALSE, int width = -1 ) ...and then had this constructor simply treat width==-1 to mean "whatever height fits the text"...or whatever it means now. That forces you to say that you want a horizontal slider if you also want to set the width - but that doesn't seem too much of a chore to me. > Another way to fix this might be to change the type of the variable > "vertical". It only takes the values TRUE and FALSE, so making it "short" > should work. Unfortunately, this could create confusion if the user creates > a puSlider with four integer numbers: the computer would know exactly which > constructor it is calling, but the user wouldn't be able to tell easily > without an explicit type casting. A second alternative would be to make it > "bool", but nothing else in PUI is "bool" and I don't know how portable it > is. Hmm - I don't like any of those things. -- Steve Baker HomeEmail: <sjb...@ai...> WorkEmail: <sj...@li...> HomePage : http://web2.airmail.net/sjbaker1 Projects : http://plib.sourceforge.net http://tuxaqfh.sourceforge.net http://tuxkart.sourceforge.net http://prettypoly.sourceforge.net |