BSpinner: do not redefine fValue

BSpinner had its own fValue defined instead of using the one from
BControl. This results in the be:value in the message sent when the
control is invoked to always be 0.

Change-Id: I1cff5f30adbf5b1dede57a14377cd4e1db7a30d3
Reviewed-on: https://review.haiku-os.org/c/haiku/+/7428
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
This commit is contained in:
PulkoMandy 2024-02-25 22:19:19 +01:00 committed by waddlesplash
parent 0aede635f1
commit 8cc8ec9ef9
2 changed files with 4 additions and 13 deletions

View File

@ -45,7 +45,6 @@ public:
void Range(int32* min, int32* max);
virtual void SetRange(int32 min, int32 max);
int32 Value() const { return fValue; };
virtual void SetValue(int32 value);
virtual void SetValueFromText();
@ -77,10 +76,9 @@ private:
int32 fMinValue;
int32 fMaxValue;
int32 fValue;
// FBC padding
uint32 _reserved[20];
uint32 _reserved[21];
};

View File

@ -105,9 +105,6 @@ BSpinner::BSpinner(BMessage* data)
if (data->FindInt32("_max", &fMaxValue) != B_OK)
fMaxValue = INT32_MAX;
if (data->FindInt32("_val", &fValue) != B_OK)
fValue = 0;
}
@ -138,9 +135,6 @@ BSpinner::Archive(BMessage* data, bool deep) const
if (status == B_OK)
status = data->AddInt32("_max", fMaxValue);
if (status == B_OK)
status = data->AddInt32("_val", fValue);
return status;
}
@ -160,7 +154,7 @@ BSpinner::GetSupportedSuites(BMessage* message)
void
BSpinner::AttachedToWindow()
{
SetValue(fValue);
SetValue(Value());
BAbstractSpinner::AttachedToWindow();
}
@ -243,10 +237,10 @@ BSpinner::SetValue(int32 value)
SetIncrementEnabled(IsEnabled() && value < fMaxValue);
SetDecrementEnabled(IsEnabled() && value > fMinValue);
if (value == fValue)
if (value == Value())
return;
fValue = value;
BControl::SetValue(value);
ValueChanged();
Invoke();
@ -269,7 +263,6 @@ BSpinner::_InitObject()
{
fMinValue = INT32_MIN;
fMaxValue = INT32_MAX;
fValue = 0;
TextView()->SetAlignment(B_ALIGN_RIGHT);
for (uint32 c = 0; c <= 42; c++)