Arrow-up/down will now select the first item in the list if there is no selected
item yet. This fixes bug #728. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@18480 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -365,72 +365,66 @@ BListView::MouseMoved(BPoint pt, uint32 code, const BMessage *msg)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// KeyDown
|
|
||||||
void
|
void
|
||||||
BListView::KeyDown(const char *bytes, int32 numBytes)
|
BListView::KeyDown(const char *bytes, int32 numBytes)
|
||||||
{
|
{
|
||||||
switch (bytes[0]) {
|
switch (bytes[0]) {
|
||||||
case B_UP_ARROW:
|
case B_UP_ARROW:
|
||||||
{
|
{
|
||||||
if (fFirstSelected == -1)
|
if (fFirstSelected == -1) {
|
||||||
break;
|
// if nothing is selected yet, always select the first item
|
||||||
|
Select(0);
|
||||||
|
} else {
|
||||||
bool extend = false;
|
bool extend = false;
|
||||||
|
if (fListType == B_MULTIPLE_SELECTION_LIST
|
||||||
if (fListType == B_MULTIPLE_SELECTION_LIST && (modifiers() & B_SHIFT_KEY))
|
&& (modifiers() & B_SHIFT_KEY) != 0)
|
||||||
extend = true;
|
extend = true;
|
||||||
|
|
||||||
Select(fFirstSelected - 1, extend);
|
Select(fFirstSelected - 1, extend);
|
||||||
|
}
|
||||||
|
|
||||||
ScrollToSelection();
|
ScrollToSelection();
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case B_DOWN_ARROW:
|
case B_DOWN_ARROW:
|
||||||
{
|
{
|
||||||
if (fFirstSelected == -1)
|
if (fFirstSelected == -1) {
|
||||||
break;
|
// if nothing is selected yet, always select the first item
|
||||||
|
Select(0);
|
||||||
|
} else {
|
||||||
bool extend = false;
|
bool extend = false;
|
||||||
|
if (fListType == B_MULTIPLE_SELECTION_LIST
|
||||||
if (fListType == B_MULTIPLE_SELECTION_LIST && (modifiers() & B_SHIFT_KEY))
|
&& (modifiers() & B_SHIFT_KEY) != 0)
|
||||||
extend = true;
|
extend = true;
|
||||||
|
|
||||||
Select(fLastSelected + 1, extend);
|
Select(fLastSelected + 1, extend);
|
||||||
|
}
|
||||||
|
|
||||||
ScrollToSelection();
|
ScrollToSelection();
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case B_HOME:
|
case B_HOME:
|
||||||
{
|
|
||||||
Select(0, fListType == B_MULTIPLE_SELECTION_LIST);
|
Select(0, fListType == B_MULTIPLE_SELECTION_LIST);
|
||||||
|
|
||||||
ScrollToSelection();
|
ScrollToSelection();
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
case B_END:
|
case B_END:
|
||||||
{
|
|
||||||
Select(CountItems() - 1, fListType == B_MULTIPLE_SELECTION_LIST);
|
Select(CountItems() - 1, fListType == B_MULTIPLE_SELECTION_LIST);
|
||||||
|
|
||||||
ScrollToSelection();
|
ScrollToSelection();
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
case B_RETURN:
|
case B_RETURN:
|
||||||
case B_SPACE:
|
case B_SPACE:
|
||||||
{
|
|
||||||
Invoke();
|
Invoke();
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
default:
|
default:
|
||||||
BView::KeyDown(bytes, numBytes);
|
BView::KeyDown(bytes, numBytes);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// MakeFocus
|
|
||||||
void
|
void
|
||||||
BListView::MakeFocus(bool focused)
|
BListView::MakeFocus(bool focused)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user