on-demand scroll bars for FButtonGroup

This commit is contained in:
Markus Gans 2017-03-12 00:29:56 +01:00
parent 56df867ef7
commit 4107227119
23 changed files with 339 additions and 48 deletions

1
.gitignore vendored
View File

@ -35,6 +35,7 @@ test/windows
test/term-attributes
test/transparent
test/input-dialog
test/choice
test/mandelbrot
test/keyboard
test/timer

View File

@ -1,3 +1,12 @@
2017-03-12 Markus Gans <guru.mail@muenster.de>
* The FButtonGroup now has a scrolling area
with on-demand scroll bars
* Add the "choice" example to demonstrate the FButtonGroup
auto-adjusting with on-demand scroll bars
* FRect can now combine two FRect objects
* The FButtonGroup got the possibility of index access
to a child button.
2017-03-08 Markus Gans <guru.mail@muenster.de>
* Improve input cursor positioning in FScrollView

View File

@ -20,7 +20,6 @@ Missing Features
└──► tmp
---------------------------------------
- Add a scrolling area with on-demand scroll bars for FButtonGroup
- Adding for flexible layouts a FGrid widget container that organizes
its child widgets in rows and columns

View File

@ -207,6 +207,7 @@ class FApplication : public FWidget
// Friend functions from FWindow
friend bool FWindow::activateWindow (bool);
friend FWindow* FWindow::getActiveWindow();
friend void FWindow::unsetActiveWindow();
};
#pragma pack(pop)

View File

@ -51,6 +51,23 @@ FButtonGroup::~FButtonGroup() // destructor
// public methods of FButtonGroup
//----------------------------------------------------------------------
FToggleButton* FButtonGroup::getButton(int index) const
{
FObjectList::const_iterator iter;
index--;
if ( buttonlist.empty() )
return 0;
if ( index < 0 || index >= int(getCount()) )
return 0;
iter = buttonlist.begin();
std::advance (iter, index);
return static_cast<FToggleButton*>(*iter);
}
//----------------------------------------------------------------------
FToggleButton* FButtonGroup::getFirstButton()
{
@ -99,7 +116,18 @@ void FButtonGroup::setText (const FString& txt)
}
//----------------------------------------------------------------------
bool FButtonGroup::hasFocusedButton()
bool FButtonGroup::isChecked (int index) const
{
FToggleButton* button = getButton(index);
if ( button )
return button->isChecked();
else
return false;
}
//----------------------------------------------------------------------
bool FButtonGroup::hasFocusedButton() const
{
if ( buttonlist.empty() )
return false;
@ -122,7 +150,7 @@ bool FButtonGroup::hasFocusedButton()
}
//----------------------------------------------------------------------
bool FButtonGroup::hasCheckedButton()
bool FButtonGroup::hasCheckedButton() const
{
if ( buttonlist.empty() )
return false;
@ -223,6 +251,8 @@ void FButtonGroup::insert (FToggleButton* button)
"toggled",
_METHOD_CALLBACK (this, &FButtonGroup::cb_buttonToggled)
);
//checkScrollSize (button);
}
//----------------------------------------------------------------------
@ -251,6 +281,28 @@ void FButtonGroup::remove (FToggleButton* button)
}
}
//----------------------------------------------------------------------
void FButtonGroup::checkScrollSize (FToggleButton* button)
{
// Check and adjust the scroll size
checkScrollSize (button->getGeometry());
}
//----------------------------------------------------------------------
void FButtonGroup::checkScrollSize (const FRect& r)
{
// Check and adjust the scroll size
FRect scrollgeometry (1, 1, getScrollWidth(), getScrollHeight());
if ( ! scrollgeometry.contains(r) )
{
FRect new_size = scrollgeometry.combined(r);
setScrollSize (new_size.getWidth(), new_size.getHeight());
}
}
//----------------------------------------------------------------------
void FButtonGroup::onMouseDown (FMouseEvent* ev)
{
@ -283,10 +335,16 @@ void FButtonGroup::onFocusIn (FFocusEvent* in_ev)
{
if ( isRadioButton(toggle_button) )
{
in_ev->ignore();
FWidget* prev_element = getFocusWidget();
in_ev->ignore();
toggle_button->setFocus();
FFocusEvent cfi (fc::ChildFocusIn_Event);
FApplication::sendEvent(this, &cfi);
FFocusEvent in (fc::FocusIn_Event);
FApplication::sendEvent(toggle_button, &in);
if ( prev_element )
prev_element->redraw();

View File

@ -55,6 +55,8 @@ class FButtonGroup : public FScrollView
const char* getClassName() const;
FToggleButton* getFirstButton();
FToggleButton* getLastButton();
FToggleButton* getButton (int) const;
uInt getCount() const;
FString& getText();
// Mutator
@ -65,13 +67,16 @@ class FButtonGroup : public FScrollView
void setText (const FString&);
// Inquiries
bool hasFocusedButton();
bool hasCheckedButton();
bool isChecked(int) const;
bool hasFocusedButton() const;
bool hasCheckedButton() const;
// Methods
void hide();
void insert (FToggleButton*);
void remove (FToggleButton*);
void checkScrollSize (FToggleButton*);
void checkScrollSize (const FRect&);
// Event handlers
void onMouseDown (FMouseEvent*);
@ -100,15 +105,15 @@ class FButtonGroup : public FScrollView
FButtonGroup& operator = (const FButtonGroup&);
// Inquiries
bool isRadioButton (FToggleButton*) const;
bool isRadioButton (FToggleButton*) const;
// Methods
void init();
void directFocus();
void init();
void directFocus();
// Data Members
FString text;
FObjectList buttonlist;
FString text;
FObjectList buttonlist;
};
#pragma pack(pop)
@ -130,6 +135,10 @@ inline bool FButtonGroup::unsetEnable()
inline bool FButtonGroup::setDisable()
{ return setEnable(false); }
//----------------------------------------------------------------------
inline uInt FButtonGroup::getCount() const
{ return uInt(buttonlist.size()); }
//----------------------------------------------------------------------
inline FString& FButtonGroup::getText()
{ return text; }

View File

@ -22,7 +22,7 @@
class fc
{
public:
// event types
// Event types
enum events
{
None_Event, // invalid event
@ -50,7 +50,7 @@ class fc
Timer_Event // timer event occur
};
// properties of a widget
// Properties of a widget
enum widget_flags
{
shadow = 0x00000001,
@ -68,7 +68,7 @@ class fc
no_underline = 0x00001000
};
// internal character encoding
// Internal character encoding
enum encoding
{
UTF8,
@ -121,7 +121,7 @@ class fc
vt100_key_bullet = '~' // · - bullet
};
// unicode characters
// Unicode characters
enum SpecialCharacter
{
Euro = 0x20ac, // €
@ -403,7 +403,7 @@ class fc
Fkey_f63 = 0x1000194
};
// keyboard - modifier key combinations
// Keyboard - modifier key combinations
enum metakeys
{
Fmkey_ic = 0x1500100, // M-insert
@ -614,7 +614,7 @@ class fc
Fmkey_tilde = 0x200015e // M-~
};
// console color names
// Console color names
enum colornames
{
Default = -1,
@ -877,7 +877,7 @@ class fc
Grey93 = 255 // #eeeeee
};
// mouse/keyboard state values
// Mouse/keyboard state values
enum ButtonState
{
NoButton = 0x00,
@ -891,7 +891,7 @@ class fc
KeyButtonMask = 0x38
};
// wheel state values
// Wheel state values
enum WheelState
{
NoWheel = 0x00,
@ -900,15 +900,15 @@ class fc
WheelMask = 0x03
};
// type of focus
// Type of focus
enum FocusTypes
{
FocusNextWidget = 0x00,
FocusPreviousWidget = 0x01,
FocusDefiniteWidget = 0x03
FocusDefiniteWidget = 0x03 // event default
};
// scroll bar visibility mode
// Scroll bar visibility mode
enum scrollBarMode
{
Auto = 0, // Shows a scroll bar when area is larger than viewport
@ -916,7 +916,7 @@ class fc
Scroll = 2 // Always shows a scroll bar
};
// xterm cursor style
// Xterm cursor style
enum xtermCursorStyle
{
blinking_block = 0,
@ -928,7 +928,7 @@ class fc
steady_bar_xterm = 6
};
// linux console and framebuffer cursor style
// Linux console and framebuffer cursor style
enum consoleCursorStyle
{
default_cursor = 0,

View File

@ -310,7 +310,7 @@ inline bool FListBox::unsetFocus()
{ return setFocus(false); }
//----------------------------------------------------------------------
inline bool FListBox::isSelected(int index) const
inline bool FListBox::isSelected (int index) const
{ return data[uInt(index-1)].selected; }
//----------------------------------------------------------------------

View File

@ -653,7 +653,6 @@ void FMenu::onMouseMove (FMouseEvent* ev)
FString msg = getStatusbarMessage();
FString curMsg = getStatusBar()->getMessage();
if ( curMsg != msg )
if ( curMsg != msg )
{
getStatusBar()->setMessage(msg);

View File

@ -67,6 +67,23 @@ FObject::~FObject() // destructor
}
// public methods of FObject
//----------------------------------------------------------------------
FObject* FObject::getChild (int index) const
{
index--;
if ( children_list.empty() )
return 0;
if ( index < 0 || index >= numOfChildren() )
return 0;
FObjectList::const_iterator iter;
iter = children_list.begin();
std::advance (iter, index);
return *iter;
}
//----------------------------------------------------------------------
bool FObject::isChild (FObject* obj) const
{

View File

@ -69,6 +69,7 @@ class FObject
// Accessors
virtual const char* getClassName() const;
FObject* getParent() const;
FObject* getChild (int) const;
FObjectList getChildren() const;
int numOfChildren() const;

View File

@ -196,6 +196,17 @@ FRect FRect::intersect (const FRect& r) const
return new_rect;
}
//----------------------------------------------------------------------
FRect FRect::combined (const FRect& r) const
{
// Union: this r
FRect new_rect;
new_rect.X1 = std::min(X1, r.X1);
new_rect.Y1 = std::min(Y1, r.Y1);
new_rect.X2 = std::max(X2, r.X2);
new_rect.Y2 = std::max(Y2, r.Y2);
return new_rect;
}
//----------------------------------------------------------------------
FRect& FRect::operator = (const FRect& r)
{

View File

@ -91,6 +91,7 @@ class FRect
bool contains (const FRect&) const;
bool overlap (const FRect&) const;
FRect intersect (const FRect&) const;
FRect combined (const FRect&) const;
private:
// Data Members

View File

@ -736,6 +736,7 @@ inline FPoint FScrollView::getViewportCursorPos()
{
int x, y;
FWidget* window = FWindow::getWindowWidget(this);
if ( window )
{
int widget_offsetX = getTermX() - window->getTermX();

View File

@ -29,7 +29,7 @@ FToggleButton::FToggleButton (FWidget* parent)
{
setGroup( static_cast<FButtonGroup*>(parent) );
if ( getGroup() )
if ( hasGroup() )
getGroup()->insert(this); // insert into button group
}
}
@ -52,8 +52,8 @@ FToggleButton::FToggleButton (const FString& txt, FWidget* parent)
{
setGroup( static_cast<FButtonGroup*>(parent) );
if ( getGroup() )
getGroup()->insert( this ); // insert into button group
if ( hasGroup() )
getGroup()->insert(this); // insert into button group
}
}
@ -62,7 +62,7 @@ FToggleButton::~FToggleButton() // destructor
{
delAccelerator();
if ( getGroup() )
if ( hasGroup() )
getGroup()->remove(this);
}
@ -76,6 +76,11 @@ void FToggleButton::setGeometry (int x, int y, int w, int h, bool adjust)
if ( w < min_width )
w = min_width;
const FRect geometry(x, y, w, h);
if ( hasGroup() )
getGroup()->checkScrollSize(geometry);
FWidget::setGeometry(x, y, w, h, adjust);
}
@ -280,6 +285,15 @@ void FToggleButton::onMouseUp (FMouseEvent* ev)
processClick();
}
//----------------------------------------------------------------------
void FToggleButton::onWheel (FWheelEvent* ev)
{
if ( ! hasGroup() )
return;
getGroup()->onWheel(ev);
}
//----------------------------------------------------------------------
void FToggleButton::onAccel (FAccelEvent* ev)
{
@ -340,7 +354,7 @@ void FToggleButton::onFocusOut (FFocusEvent* out_ev)
getStatusBar()->drawMessage();
}
if ( ! getGroup() )
if ( ! hasGroup() )
return;
if ( ! focus_inside_group && isRadioButton() )

View File

@ -84,6 +84,7 @@ class FToggleButton : public FWidget
// Event handlers
void onMouseDown (FMouseEvent*);
void onMouseUp (FMouseEvent*);
void onWheel (FWheelEvent*);
void onAccel (FAccelEvent*);
void onFocusIn (FFocusEvent*);
void onFocusOut (FFocusEvent*);
@ -99,6 +100,7 @@ class FToggleButton : public FWidget
// Inquiries
bool isRadioButton() const;
bool isCheckboxButton() const;
bool hasGroup() const;
// Methods
virtual void draw();
@ -191,4 +193,8 @@ inline bool FToggleButton::isChecked()
inline FButtonGroup* FToggleButton::getGroup() const
{ return button_group; }
//----------------------------------------------------------------------
inline bool FToggleButton::hasGroup() const
{ return button_group; }
#endif // _FTOGGLEBUTTON_H

View File

@ -41,6 +41,10 @@ FWindow::~FWindow() // destructor
if ( isAlwaysOnTop() )
deleteFromAlwaysOnTopList (this);
// unset the global active window
if ( this == FWindow::getActiveWindow() )
unsetActiveWindow();
delWindow (this);
if ( ! fapp->isQuit() )
@ -151,6 +155,13 @@ bool FWindow::activateWindow (bool on)
return window_active = (on) ? true : false;
}
//----------------------------------------------------------------------
void FWindow::unsetActiveWindow()
{
// unset the active FWindow object
FApplication::active_window = 0;
}
//----------------------------------------------------------------------
bool FWindow::setResizeable (bool on)
{

View File

@ -76,6 +76,7 @@ class FWindow : public FWidget
void setWindowFocusWidget (FWidget*);
bool activateWindow (bool);
bool activateWindow();
void unsetActiveWindow();
bool deactivateWindow();
virtual bool setResizeable (bool);
virtual bool setResizeable();

View File

@ -9,6 +9,7 @@ noinst_PROGRAMS = \
hello \
dialog \
input-dialog \
choice \
opti-move \
string-operations \
mandelbrot \
@ -26,6 +27,7 @@ noinst_PROGRAMS = \
hello_SOURCES = hello.cpp
dialog_SOURCES = dialog.cpp
input_dialog_SOURCES = input-dialog.cpp
choice_SOURCES = choice.cpp
opti_move_SOURCES = opti-move.cpp
string_operations_SOURCES = string-operations.cpp
mandelbrot_SOURCES = mandelbrot.cpp

View File

@ -83,7 +83,7 @@ POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
noinst_PROGRAMS = hello$(EXEEXT) dialog$(EXEEXT) input-dialog$(EXEEXT) \
opti-move$(EXEEXT) string-operations$(EXEEXT) \
choice$(EXEEXT) opti-move$(EXEEXT) string-operations$(EXEEXT) \
mandelbrot$(EXEEXT) calculator$(EXEEXT) watch$(EXEEXT) \
term-attributes$(EXEEXT) transparent$(EXEEXT) \
keyboard$(EXEEXT) timer$(EXEEXT) scrollview$(EXEEXT) \
@ -110,6 +110,9 @@ AM_V_lt = $(am__v_lt_@AM_V@)
am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
am__v_lt_0 = --silent
am__v_lt_1 =
am_choice_OBJECTS = choice.$(OBJEXT)
choice_OBJECTS = $(am_choice_OBJECTS)
choice_LDADD = $(LDADD)
am_dialog_OBJECTS = dialog.$(OBJEXT)
dialog_OBJECTS = $(am_dialog_OBJECTS)
dialog_LDADD = $(LDADD)
@ -189,20 +192,20 @@ AM_V_CXXLD = $(am__v_CXXLD_@AM_V@)
am__v_CXXLD_ = $(am__v_CXXLD_@AM_DEFAULT_V@)
am__v_CXXLD_0 = @echo " CXXLD " $@;
am__v_CXXLD_1 =
SOURCES = $(calculator_SOURCES) $(dialog_SOURCES) $(hello_SOURCES) \
$(input_dialog_SOURCES) $(keyboard_SOURCES) \
$(mandelbrot_SOURCES) $(menu_SOURCES) $(opti_move_SOURCES) \
$(scrollview_SOURCES) $(string_operations_SOURCES) \
$(term_attributes_SOURCES) $(timer_SOURCES) \
$(transparent_SOURCES) $(ui_SOURCES) $(watch_SOURCES) \
$(windows_SOURCES)
DIST_SOURCES = $(calculator_SOURCES) $(dialog_SOURCES) \
SOURCES = $(calculator_SOURCES) $(choice_SOURCES) $(dialog_SOURCES) \
$(hello_SOURCES) $(input_dialog_SOURCES) $(keyboard_SOURCES) \
$(mandelbrot_SOURCES) $(menu_SOURCES) $(opti_move_SOURCES) \
$(scrollview_SOURCES) $(string_operations_SOURCES) \
$(term_attributes_SOURCES) $(timer_SOURCES) \
$(transparent_SOURCES) $(ui_SOURCES) $(watch_SOURCES) \
$(windows_SOURCES)
DIST_SOURCES = $(calculator_SOURCES) $(choice_SOURCES) \
$(dialog_SOURCES) $(hello_SOURCES) $(input_dialog_SOURCES) \
$(keyboard_SOURCES) $(mandelbrot_SOURCES) $(menu_SOURCES) \
$(opti_move_SOURCES) $(scrollview_SOURCES) \
$(string_operations_SOURCES) $(term_attributes_SOURCES) \
$(timer_SOURCES) $(transparent_SOURCES) $(ui_SOURCES) \
$(watch_SOURCES) $(windows_SOURCES)
am__can_run_installinfo = \
case $$AM_UPDATE_INFO_DIR in \
n|no|NO) false;; \
@ -354,6 +357,7 @@ AM_CPPFLAGS = -Wall -Werror -I$(top_srcdir)/src
hello_SOURCES = hello.cpp
dialog_SOURCES = dialog.cpp
input_dialog_SOURCES = input-dialog.cpp
choice_SOURCES = choice.cpp
opti_move_SOURCES = opti-move.cpp
string_operations_SOURCES = string-operations.cpp
mandelbrot_SOURCES = mandelbrot.cpp
@ -415,6 +419,10 @@ calculator$(EXEEXT): $(calculator_OBJECTS) $(calculator_DEPENDENCIES) $(EXTRA_ca
@rm -f calculator$(EXEEXT)
$(AM_V_CXXLD)$(CXXLINK) $(calculator_OBJECTS) $(calculator_LDADD) $(LIBS)
choice$(EXEEXT): $(choice_OBJECTS) $(choice_DEPENDENCIES) $(EXTRA_choice_DEPENDENCIES)
@rm -f choice$(EXEEXT)
$(AM_V_CXXLD)$(CXXLINK) $(choice_OBJECTS) $(choice_LDADD) $(LIBS)
dialog$(EXEEXT): $(dialog_OBJECTS) $(dialog_DEPENDENCIES) $(EXTRA_dialog_DEPENDENCIES)
@rm -f dialog$(EXEEXT)
$(AM_V_CXXLD)$(CXXLINK) $(dialog_OBJECTS) $(dialog_LDADD) $(LIBS)
@ -482,6 +490,7 @@ distclean-compile:
-rm -f *.tab.c
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/calculator.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/choice.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dialog.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hello.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/input-dialog.Po@am__quote@

141
test/choice.cpp Normal file
View File

@ -0,0 +1,141 @@
// File: os-choice.cpp
#include "fapp.h"
#include "fbutton.h"
#include "fbuttongroup.h"
#include "fdialog.h"
#include "fradiobutton.h"
#include "ftooltip.h"
// function prototypes
void cb_quit (FWidget*, FWidget::data_ptr);
//----------------------------------------------------------------------
// callback functions
//----------------------------------------------------------------------
void cb_quit (FWidget*, FWidget::data_ptr data)
{
FDialog* dlg = static_cast<FDialog*>(data);
dlg->close();
}
//----------------------------------------------------------------------
// main part
//----------------------------------------------------------------------
int main (int argc, char* argv[])
{
int x,y,w,h;
FString label_text = "no OS";
// Create the application object
FApplication app(argc, argv);
// Create a simple dialog box
FDialog* dgl = new FDialog(&app);
dgl->setModal();
dgl->setText ("UNIX select");
w = 20;
h = 13;
x = (app.getColumnNumber() - w) / 2;
y = (app.getLineNumber() - h) / 2;
dgl->setGeometry (x, y, w, h);
dgl->setShadow();
// Create another button group
FButtonGroup* checkButtonGroup = new FButtonGroup("choice", dgl);
checkButtonGroup->setGeometry (2, 1, 16, 7);
// Create radio buttons
FRadioButton* os1 = new FRadioButton("AIX", checkButtonGroup);
FRadioButton* os2 = new FRadioButton("Cygwin", checkButtonGroup);
FRadioButton* os3 = new FRadioButton("FreeBSD", checkButtonGroup);
FRadioButton* os4 = new FRadioButton("HP-UX", checkButtonGroup);
FRadioButton* os5 = new FRadioButton("Linux", checkButtonGroup);
FRadioButton* os6 = new FRadioButton("Mac OS X", checkButtonGroup);
FRadioButton* os7 = new FRadioButton("NetBSD", checkButtonGroup);
FRadioButton* os8 = new FRadioButton("OpenBSD", checkButtonGroup);
FRadioButton* os9 = new FRadioButton("Solaris", checkButtonGroup);
// Set the radio button geometry
// => checkButtonGroup->setScrollSize(...) is not required
// because a FButtonGroup is self-adjusting
os1->setGeometry(1, 1, 12, 1);
os2->setGeometry(1, 2, 12, 1);
os3->setGeometry(1, 3, 12, 1);
os4->setGeometry(1, 4, 12, 1);
os5->setGeometry(1, 5, 12, 1);
os6->setGeometry(1, 6, 12, 1);
os7->setGeometry(1, 7, 12, 1);
os8->setGeometry(1, 8, 12, 1);
os9->setGeometry(1, 9, 12, 1);
#if defined(_AIX)
os1->setChecked();
os1->setFocus();
#elif defined(__CYGWIN__)
os2->setChecked();
os2->setFocus();
#elif defined(__FreeBSD__)
os3->setChecked();
os3->setFocus();
#elif defined(__hpux)
os4->setChecked();
os4->setFocus();
#elif defined(__linux__)
os5->setChecked();
os5->setFocus();
#elif defined(__APPLE__) && defined(__MACH__)
os6->setChecked();
os6->setFocus();
#elif defined(__NetBSD__)
os7->setChecked();
os7->setFocus();
#elif defined(__OpenBSD__)
os8->setChecked();
os8->setFocus();
#elif defined(__sun) && defined(__SVR4)
os9->setChecked();
os9->setFocus();
#endif
// Scroll to the focused child element
FFocusEvent cfi (fc::ChildFocusIn_Event);
FApplication::sendEvent(checkButtonGroup, &cfi);
// Create a OK button
FButton* ok = new FButton("&OK", dgl);
ok->setGeometry (10, 9, 8, 1);
// Connect the button signal "clicked" with the callback function
ok->addCallback
(
"clicked",
_FUNCTION_CALLBACK (&cb_quit),
dgl
);
// Show the dialog
dgl->show();
// Get the checked radio button text
for (int n=1; n <= int(checkButtonGroup->getCount()); n++)
{
if ( checkButtonGroup->isChecked(n) )
{
label_text = checkButtonGroup->getButton(n)->getText();
break;
}
}
// Hide and destroy the dialog object
delete dgl;
// Create and show tooltip for two seconds
FToolTip* tooltip = new FToolTip(&app);
tooltip->setText ("You have chosen " + label_text);
tooltip->show();
sleep(2);
delete tooltip;
}

View File

@ -79,8 +79,8 @@ int main (int argc, char* argv[])
// Create radio buttons
FRadioButton* male = new FRadioButton("&Male", radioButtonGroup);
FRadioButton* female = new FRadioButton("&Female", radioButtonGroup);
male->setGeometry(1, 1, 7, 1);
female->setGeometry(1, 2, 7, 1);
male->setGeometry(1, 1, 8, 1);
female->setGeometry(1, 2, 10, 1);
// Create another button group
FButtonGroup* checkButtonGroup = new FButtonGroup("&Data options", &dgl);
@ -89,8 +89,8 @@ int main (int argc, char* argv[])
// Create checkbox buttons
FCheckBox* check1 = new FCheckBox("Save data", checkButtonGroup);
FCheckBox* check2 = new FCheckBox("Encrypt data", checkButtonGroup);
check1->setGeometry(1, 1, 7, 1);
check2->setGeometry(1, 2, 7, 1);
check1->setGeometry(1, 1, 13, 1);
check2->setGeometry(1, 2, 16, 1);
check2->setDisable();
// Create a OK button

View File

@ -452,11 +452,11 @@ MyDialog::MyDialog (FWidget* parent)
//radioButtonGroup->unsetBorder();
FRadioButton* radio1 = new FRadioButton ("E&nable", radioButtonGroup);
radio1->setGeometry(1, 1, 7, 1);
radio1->setGeometry(1, 1, 10, 1);
radio1->setStatusbarMessage ("Enable button Test");
FRadioButton* radio2 = new FRadioButton (radioButtonGroup);
radio2->setGeometry(1, 2, 7, 1);
radio2->setGeometry(1, 2, 11, 1);
radio2->setText ("&Disable");
radio2->setStatusbarMessage ("Disable button Test");
radio2->setChecked();
@ -467,11 +467,11 @@ MyDialog::MyDialog (FWidget* parent)
checkButtonGroup->setGeometry(3, 12, 14, 4);
FCheckBox* check1 = new FCheckBox ("&Bitmode", checkButtonGroup);
check1->setGeometry(1, 1, 7, 1);
check1->setGeometry(1, 1, 11, 1);
check1->setNoUnderline();
FCheckBox* check2 = new FCheckBox ("&8-Bit", checkButtonGroup);
check2->setGeometry(1, 2, 7, 1);
check2->setGeometry(1, 2, 9, 1);
check2->setChecked();
check2->setNoUnderline();