Bug fix disable cursor on focus FSwitch

This commit is contained in:
Markus Gans 2015-07-06 22:43:56 +02:00
parent 7844923d79
commit 71050832ac
3 changed files with 15 additions and 11 deletions

View File

@ -60,7 +60,8 @@ void FSwitch::drawCheckButton()
print (" On ");
setColor (wc.button_inactive_fg, wc.button_inactive_bg);
print (" Off ");
gotoxy (xpos+xmin+2+switch_offset_pos, ypos+ymin-1);
setCursorPos ( xpos + xmin + 1 + switch_offset_pos,
ypos + ymin - 1 );
}
else
{
@ -71,7 +72,8 @@ void FSwitch::drawCheckButton()
else
setColor (wc.button_hotkey_fg, wc.button_active_bg);
print (" Off ");
gotoxy (xpos+xmin+6+switch_offset_pos, ypos+ymin-1);
setCursorPos ( xpos + xmin + 5 + switch_offset_pos,
ypos + ymin - 1 );
}
}

View File

@ -64,7 +64,9 @@ void FToggleButton::init()
this->text = "";
setGeometry (1, 1, 4, 1, false); // initialize geometry values
setVisibleCursor();
if ( isRadioButton() || isCheckboxButton() )
setVisibleCursor();
if ( hasFocus() )
this->flags = FOCUS;
@ -151,11 +153,11 @@ void FToggleButton::draw()
}
}
// set the cursor to the button
if ( isRadioButton() || isCheckboxButton() )
{
// set the cursor to the button
{
setCursorPos (xpos+xmin, ypos+ymin-1);
if ( isCursorInside() && hasFocus() )
{
if ( isHiddenCursor() )
@ -407,7 +409,7 @@ bool FToggleButton::setFocus(bool on)
foregroundColor = wc.toggle_button_active_focus_fg;
backgroundColor = wc.toggle_button_active_focus_bg;
if ( isCursorInside() )
if ( isCursorInside() && (isRadioButton() || isCheckboxButton()) )
showCursor();
if ( statusBar() )
@ -536,7 +538,7 @@ void FToggleButton::onHide (FHideEvent*)
//----------------------------------------------------------------------
void FToggleButton::onFocusIn (FFocusEvent*)
{
if ( isCursorInside() )
if ( isCursorInside() && (isRadioButton() || isCheckboxButton()) )
showCursor();
if ( statusBar() )

View File

@ -62,14 +62,14 @@ watch::watch (FWidget* parent) : FDialog(parent)
seconds_sw = new FSwitch(L"Seconds", this);
clock_sw->setGeometry(4, 4, 9, 1);
seconds_sw->setGeometry(2, 6, 11, 1);
seconds_sw->setChecked();
sec = true;
clock_sw->setFocus();
sec = seconds_sw->setChecked();
// Create button
FButton* quit = new FButton(L"&Quit", this);
quit->setGeometry(6, 9, 9, 1);
quit->setShadow();
quit->setFocus();
// Connect switch signal "toggled" with a callback member function
clock_sw->addCallback