MAINT-1747 Fixed after switching Preferences tabs, radio buttons don't get focus on click
parent
187caf8515
commit
46e1bb558e
|
|
@ -54,6 +54,7 @@ public:
|
|||
/*virtual*/ void setValue(const LLSD& value);
|
||||
|
||||
/*virtual*/ BOOL postBuild();
|
||||
/*virtual*/ BOOL handleMouseDown(S32 x, S32 y, MASK mask);
|
||||
|
||||
LLSD getPayload() { return mPayload; }
|
||||
|
||||
|
|
@ -224,6 +225,22 @@ BOOL LLRadioGroup::setSelectedIndex(S32 index, BOOL from_event)
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
void LLRadioGroup::focusSelectedRadioBtn()
|
||||
{
|
||||
if (mSelectedIndex >= 0)
|
||||
{
|
||||
LLRadioCtrl* radio_item = mRadioButtons[mSelectedIndex];
|
||||
if (radio_item->hasTabStop() && radio_item->getEnabled())
|
||||
{
|
||||
radio_item->focusFirstItem(FALSE, FALSE);
|
||||
}
|
||||
}
|
||||
else if (mRadioButtons[0]->hasTabStop() || hasTabStop())
|
||||
{
|
||||
focusFirstItem(FALSE, FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
BOOL LLRadioGroup::handleKeyHere(KEY key, MASK mask)
|
||||
{
|
||||
BOOL handled = FALSE;
|
||||
|
|
@ -283,19 +300,6 @@ BOOL LLRadioGroup::handleKeyHere(KEY key, MASK mask)
|
|||
return handled;
|
||||
}
|
||||
|
||||
BOOL LLRadioGroup::handleMouseDown(S32 x, S32 y, MASK mask)
|
||||
{
|
||||
// grab focus preemptively, before child button takes mousecapture
|
||||
//
|
||||
if (hasTabStop())
|
||||
{
|
||||
focusFirstItem(FALSE, FALSE);
|
||||
}
|
||||
|
||||
return LLUICtrl::handleMouseDown(x, y, mask);
|
||||
}
|
||||
|
||||
|
||||
// Handle one button being clicked. All child buttons must have this
|
||||
// function as their callback function.
|
||||
|
||||
|
|
@ -466,6 +470,29 @@ BOOL LLRadioCtrl::postBuild()
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
BOOL LLRadioCtrl::handleMouseDown(S32 x, S32 y, MASK mask)
|
||||
{
|
||||
// Grab focus preemptively, before button takes mousecapture
|
||||
if (hasTabStop() && getEnabled())
|
||||
{
|
||||
focusFirstItem(FALSE, FALSE);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Only currently selected item in group has tab stop as result it is
|
||||
// unclear how focus should behave on click, just let the group handle
|
||||
// focus and LLRadioGroup::onClickButton() will set correct state later
|
||||
// if needed
|
||||
LLRadioGroup* parent = (LLRadioGroup*)getParent();
|
||||
if (parent)
|
||||
{
|
||||
parent->focusSelectedRadioBtn();
|
||||
}
|
||||
}
|
||||
|
||||
return LLCheckBoxCtrl::handleMouseDown(x, y, mask);
|
||||
}
|
||||
|
||||
LLRadioCtrl::~LLRadioCtrl()
|
||||
{
|
||||
}
|
||||
|
|
|
|||
|
|
@ -66,8 +66,6 @@ public:
|
|||
|
||||
virtual BOOL postBuild();
|
||||
|
||||
virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask);
|
||||
|
||||
virtual BOOL handleKeyHere(KEY key, MASK mask);
|
||||
|
||||
void setIndexEnabled(S32 index, BOOL enabled);
|
||||
|
|
@ -75,6 +73,8 @@ public:
|
|||
S32 getSelectedIndex() const { return mSelectedIndex; }
|
||||
// set the index value programatically
|
||||
BOOL setSelectedIndex(S32 index, BOOL from_event = FALSE);
|
||||
// foxus child by index if it can get focus
|
||||
void focusSelectedRadioBtn();
|
||||
|
||||
// Accept and retrieve strings of the radio group control names
|
||||
virtual void setValue(const LLSD& value );
|
||||
|
|
|
|||
Loading…
Reference in New Issue