[haiku-development] Re: RFC: B_INVALID flag for BControlLook

  • From: pulkomandy <pulkomandy@xxxxxxxxxxxxx>
  • To: haiku-development@xxxxxxxxxxxxx
  • Date: Thu, 2 Oct 2014 21:10:19 +0200

On Thu, Oct 02, 2014 at 01:23:59PM -0400, John Scipione wrote:
> On Thu, Oct 2, 2014 at 12:25 PM, looncraz <looncraz@xxxxxxxxxxx> wrote:
> > Why doesn't BSpinner implement BControl rather than BView and BInvoker? I'm
> > sure there must be a reason.
> 
> Good question, BControl returns an int32 for Value() and takes one for
> SetValue(), I wanted to use a double instead. I originally did casting
> to make this work but later decided the hack wasn't worth it and made
> the control inherit from BView and BInvoker instead. This way I can
> have SetValue() that take a double (or whatever I want thank you very
> much) and I don't have to worry about overloading a method in the base
> class.
> 

You should think again. Even BTextField is a BControl. You can have a
look at BColorControl too which is another example of a control
accepting other things than ints.

If only for coherence with other parts of the API, the BSpinner should
do the same.

-- 
Adrien.

Other related posts: