* fix keyboard handling to trigger the correct invokation message
* add support for B_HOME and B_END key (jump to min/max value) git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23285 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -404,27 +404,33 @@ BSlider::KeyDown(const char *bytes, int32 numBytes)
|
|||||||
if (!IsEnabled() || IsHidden())
|
if (!IsEnabled() || IsHidden())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
int32 newValue = Value();
|
||||||
|
|
||||||
switch (bytes[0]) {
|
switch (bytes[0]) {
|
||||||
case B_LEFT_ARROW:
|
case B_LEFT_ARROW:
|
||||||
case B_DOWN_ARROW: {
|
case B_DOWN_ARROW: {
|
||||||
int32 oldValue = Value();
|
newValue -= KeyIncrementValue();
|
||||||
|
|
||||||
SetValue(Value() - KeyIncrementValue());
|
|
||||||
if (oldValue != Value())
|
|
||||||
Invoke();
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case B_RIGHT_ARROW:
|
case B_RIGHT_ARROW:
|
||||||
case B_UP_ARROW: {
|
case B_UP_ARROW: {
|
||||||
int32 oldValue = Value();
|
newValue += KeyIncrementValue();
|
||||||
|
|
||||||
SetValue(Value() + KeyIncrementValue());
|
|
||||||
if (oldValue != Value())
|
|
||||||
Invoke();
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case B_HOME:
|
||||||
|
newValue = fMinValue;
|
||||||
|
break;
|
||||||
|
case B_END:
|
||||||
|
newValue = fMaxValue;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
BControl::KeyDown(bytes, numBytes);
|
BControl::KeyDown(bytes, numBytes);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (newValue != Value()) {
|
||||||
|
SetValue(newValue);
|
||||||
|
InvokeNotify(ModificationMessage(), B_CONTROL_MODIFIED);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user