| Contents
Previous
Next
Class >Hierarchy>
>Fl_Widget>
> |
> +---->Fl_Button>
> |
> +---->Fl_Check_Button>, >Fl_Light_Button>, >Fl_Repeat_Button>,
> >Fl_Return_Button>, >Fl_Round_Button>
>
Include >Files>
>#include <FL/Fl_Button.H>
>
Description>
Buttons >generate >callbacks >when >they >are >clicked >
by >the >user. > You > control >exactly >when >and >how >
by >changing >the >values >for >type()> and >
when()>. >
Buttons >can >also >generate >callbacks >in >response >
to >FL_SHORTCUT> events. > The >button >can >
either >have >an >explicit >
shortcut()> value >or >a >letter >shortcut >can >
be >indicated >in > the >label()> with >an >'&' >
character >before >it. > For >the >label > shortcut >it >
does >not >matter >if >Alt> is >held >down, >but >
if >you >have > an >input >field >in >the >same >
window, >the >user >will >have >to >hold >down >the >
Alt> key >so >that >the >input >field >does >not >
eat >the >event >first >as >an > FL_KEYBOARD>
event. >
Methods>
The >constructor >creates >the >button >using >the >
position, >size, >and > label. >
The >destructor >removed >the >button. >
Same >as >value(0)>. >
The >first >form >returns >the >current >down >box >
type, >which >is >drawn >when > value()> is >
non-zero. >
The >second >form >sets >the >down >box >type. >The >
default >value >of >0 > causes >FLTK >to >figure >out >
the >correct >matching >down >version >of >box()>
. >
Same >as >value(1)>. >
Turns >on >this >button >and >turns >off >all >other >
radio >buttons >in >the > group >(calling >value(1)>
or >set()> does >not >do >this). >
The >first >form >returns >the >current >shortcut >key >
for >the >button. >
The >second >form >sets >the >shortcut >key >to >
key>. >Setting >this > overrides >the >use >of >
'&' >in >the >label()>. > The >value >is >a >
bitwise > OR >of >a >key >and >a >set >of >shift >
flags, >for >example >FL_ALT >| >'a'> , >
FL_ALT >| >(FL_F >+ >10)> , >or >just >'a'>
. > A >value > of >0 >disables >the >shortcut. >
The >key >can >be >any >value >returned >by >
Fl::event_key()>, >but >will >usually >be >an >
ASCII >letter. > Use > a >lower-case >letter >unless >you >
require >the >shift >key >to >be >held >down. >
The >shift >flags >can >be >any >set >of >values >
accepted >by >
Fl::event_state()>. > If >the >bit >is >on >
that >shift >key >must > be >pushed. > Meta, >Alt, >
Ctrl, >and >Shift >must >be >off >if >they >are >not >
in > the >shift >flags >(zero >for >the >other >bits >
indicates >a >"don't >care" > setting). >
The >first >form >of >type()> returns >the >
current >button >type, > which >can >be >one >of: >
0> : >The >value >is >unchanged. >
FL_TOGGLE_BUTTON> : >The >value >is >
inverted. >
FL_RADIO_BUTTON> : >The >value >is >set >to >
1, >and >all > other > buttons >in >the >current >group >
with >type() >== >FL_RADIO_BUTTON> are >set >
to >zero. >
The >second >form >sets >the >button >type >to >t>
. >
The >first >form >returns >the >current >value >(0 >or >
1). > The >second >form > sets >the >current >value. >
Controls >when >callbacks >are >done. > The >following >
values >are >useful, > the >default >value >is >
FL_WHEN_RELEASE> : >
0> : >The >callback >is >not >done, >
instead >changed() >is > turned >on. >
FL_WHEN_RELEASE> : >The >callback >is >done >
after >the >user > successfully >clicks >the >button, >or >
when >a >shortcut >is >typed. >
FL_WHEN_CHANGED > : >The >callback >is >done >
each >time >the > value() >changes >(when >the >user >
pushes >and >releases >the >button, >and >as > the >
mouse >is >dragged >around >in >and >out >of >the >
button). >
Contents
Previous
Next
No comments for this page.
|
| |