Improve focusFirstChild() and focusLastChild()
This commit is contained in:
parent
9420e2050a
commit
0485138c33
|
@ -1,3 +1,6 @@
|
||||||
|
2015-06-12 Markus Gans <guru.mail@muenster.de>
|
||||||
|
* Improve focusFirstChild() and focusLastChild()
|
||||||
|
|
||||||
2015-06-09 Markus Gans <guru.mail@muenster.de>
|
2015-06-09 Markus Gans <guru.mail@muenster.de>
|
||||||
* Better contrast on 8 color terminals
|
* Better contrast on 8 color terminals
|
||||||
|
|
||||||
|
|
|
@ -110,9 +110,11 @@ void FDialog::init()
|
||||||
this->flags |= ACTIVE;
|
this->flags |= ACTIVE;
|
||||||
|
|
||||||
FWidget* old_focus = FWidget::getFocusWidget();
|
FWidget* old_focus = FWidget::getFocusWidget();
|
||||||
setFocus();
|
|
||||||
if ( old_focus )
|
if ( old_focus )
|
||||||
|
{
|
||||||
|
setFocus();
|
||||||
old_focus->redraw();
|
old_focus->redraw();
|
||||||
|
}
|
||||||
accelerator_list = new Accelerators;
|
accelerator_list = new Accelerators;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1278,13 +1278,15 @@ bool FWidget::focusFirstChild (void)
|
||||||
while ( iter != end )
|
while ( iter != end )
|
||||||
{
|
{
|
||||||
FWidget* widget = static_cast<FWidget*>(*iter);
|
FWidget* widget = static_cast<FWidget*>(*iter);
|
||||||
if ( widget->isEnabled()
|
if ( widget->isEnabled() && widget->acceptFocus() )
|
||||||
&& widget->acceptFocus()
|
|
||||||
&& ! widget->isWindow() )
|
|
||||||
{
|
{
|
||||||
widget->setFocus(true);
|
|
||||||
if ( widget->numOfChildren() >= 1 )
|
if ( widget->numOfChildren() >= 1 )
|
||||||
widget->focusFirstChild();
|
{
|
||||||
|
if ( ! widget->focusFirstChild() )
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
widget->setFocus();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
// prefix increment (++) is faster
|
// prefix increment (++) is faster
|
||||||
|
@ -1311,13 +1313,15 @@ bool FWidget::focusLastChild (void)
|
||||||
{
|
{
|
||||||
--iter;
|
--iter;
|
||||||
FWidget* widget = static_cast<FWidget*>(*iter);
|
FWidget* widget = static_cast<FWidget*>(*iter);
|
||||||
if ( widget->isEnabled()
|
if ( widget->isEnabled() && widget->acceptFocus() )
|
||||||
&& widget->acceptFocus()
|
|
||||||
&& ! widget->isWindow() )
|
|
||||||
{
|
{
|
||||||
widget->setFocus(true);
|
|
||||||
if ( widget->numOfChildren() >= 1 )
|
if ( widget->numOfChildren() >= 1 )
|
||||||
widget->focusLastChild();
|
{
|
||||||
|
if ( ! widget->focusLastChild() )
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
widget->setFocus();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -79,8 +79,6 @@ int main (int argc, char* argv[])
|
||||||
st_field->setShadow();
|
st_field->setShadow();
|
||||||
c_field->setShadow();
|
c_field->setShadow();
|
||||||
|
|
||||||
name_field->setFocus();
|
|
||||||
|
|
||||||
// Create the button group
|
// Create the button group
|
||||||
FButtonGroup* radioButtonGroup = new FButtonGroup("Sex", &dgl);
|
FButtonGroup* radioButtonGroup = new FButtonGroup("Sex", &dgl);
|
||||||
radioButtonGroup->setGeometry(2, 13, 13, 4);
|
radioButtonGroup->setGeometry(2, 13, 13, 4);
|
||||||
|
|
|
@ -61,7 +61,6 @@ watch::watch (FWidget* parent) : FDialog(parent)
|
||||||
seconds_sw = new FSwitch(L"Seconds", this);
|
seconds_sw = new FSwitch(L"Seconds", this);
|
||||||
clock_sw->setGeometry(4, 4, 9, 1);
|
clock_sw->setGeometry(4, 4, 9, 1);
|
||||||
seconds_sw->setGeometry(2, 6, 11, 1);
|
seconds_sw->setGeometry(2, 6, 11, 1);
|
||||||
clock_sw->setFocus();
|
|
||||||
sec = seconds_sw->setChecked();
|
sec = seconds_sw->setChecked();
|
||||||
|
|
||||||
// Create button
|
// Create button
|
||||||
|
|
Loading…
Reference in New Issue