File: part3_valuator_objects.texi

package info (click to toggle)
libforms 1.0.93sp1-2
  • links: PTS
  • area: main
  • in suites: wheezy
  • size: 11,548 kB
  • sloc: ansic: 97,227; sh: 9,236; makefile: 858
file content (1628 lines) | stat: -rw-r--r-- 53,137 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
@node Part III Valuator Objects
@chapter Valuator Objects

@ifnottex

@menu
* Slider Object:      Slider Object
* Scrollbar Object:   Scrollbar Object
* Dial Object:        Dial Object
* Positioner Object:  Positioner Object
* Counter Object:     Counter Object
* Spinner Object:     Spinner Object
* Thumbwheel Object:  Thumbwheel Object
@end menu

@end ifnottex


@node Slider Object
@section Slider Object

Sliders are useful for letting the user indicate a value between some
fixed bounds. Both horizontal and vertical sliders exist. They have a
minimum, a maximum and a current value (all floating point values).
The user can change the current value by shifting the slider with the
mouse. Whenever the value changes, this is reported to the application
program.

@ifnottex

@menu
* Adding Slider Objects:   Adding Slider Objects
* Slider Types:            Slider Types
* Slider Interaction:      Slider Interaction
* Other Slider Routines:   Other Slider Routines
* Slider Attributes:       Slider Attributes
* Remarks:                 Slider Remarks
@end menu

@end ifnottex


@node Adding Slider Objects
@subsection Adding Slider Objects

Adding an object To add a slider to a form use
@findex fl_add_slider()
@anchor{fl_add_slider()}
@example
FL_OBJECT *fl_add_slider(int type, FL_Coord x, FL_Coord y,
                         FL_Coord w, FL_Coord h, const char *label);
@end example
@noindent
or
@findex fl_add_valslider()
@anchor{fl_add_valslider()}
@example
FL_OBJECT *fl_add_valslider(int type, FL_Coord x, FL_Coord y,
                            FL_Coord w, FL_Coord h, const char *label);
@end example
@noindent
The meaning of the parameters is as usual. The label is by default
placed below the slider. The difference between a normal slider and a
valslider is that for the second type its value is displayed above or
to the left of the slider.


@node Slider Types
@subsection Slider Types

The following types of sliders are available:
@table @code
@tindex FL_VERT_SLIDER
@anchor{FL_VERT_SLIDER}
@item FL_VERT_SLIDER
A vertical slider.

@tindex FL_HOR_SLIDER
@anchor{FL_HOR_SLIDER}
@item FL_HOR_SLIDER
A horizontal slider.

@tindex FL_VERT_FILL_SLIDER
@anchor{FL_VERT_FILL_SLIDER}
@item FL_VERT_FILL_SLIDER
A vertical slider, filled from the bottom.

@tindex FL_HOR_FILL_SLIDER
@anchor{FL_HOR_FILL_SLIDER}
@item FL_HOR_FILL_SLIDER
A horizontal slider, filled from the left.

@tindex FL_VERT_NICE_SLIDER
@anchor{FL_VERT_NICE_SLIDER}
@item FL_VERT_NICE_SLIDER
A nice looking vertical slider.

@tindex FL_HOR_NICE_SLIDER
@anchor{FL_HOR_NICE_SLIDER}
@item FL_HOR_NICE_SLIDER
A nice looking horizontal slider.

@tindex FL_VERT_BROWSER_SLIDER
@anchor{FL_VERT_BROWSER_SLIDER}
@item FL_VERT_BROWSER_SLIDER
A different looking vertical slider.

@tindex FL_HOR_BROWSER_SLIDER
@anchor{FL_HOR_BROWSER_SLIDER}
@item FL_HOR_BROWSER_SLIDER
A different looking horizontal slider.
@end table

@ifhtml
@center @image{images/slidertypes}
@end ifhtml
@ifnothtml
@center @image{images/slidertypes,12cm}
@end ifnothtml


@node Slider Interaction
@subsection Slider Interaction

Whenever the user changes the value of the slider using the mouse, the
slider is returned (unless there's callback function associated with
the object) by the interaction routines. The slider position is
changed by moving the mouse inside the slider area. For fine control,
hold down the @code{<Shift>} key while moving the slider.

In some cases you might not want the slider to be returned or its
callback called each time its value changes. To change the default,
call the following routine:
@example
void fl_set_object_return(FL_OBJECT *obj, unsigned int when)
@end example
@noindent
where the parameter @code{when} can be one of the four values:
@table @code
@item @ref{FL_RETURN_NONE}
Never return or invoke callback.

@item @ref{FL_RETURN_END_CHANGED}
Return or invoke callback at end (mouse release) if value is changed
since last return.

@item @ref{FL_RETURN_CHANGED}
Return or invoke callback whenever the slider value is changed. This
is the default.

@item @ref{FL_RETURN_END}
Return or invoke callback at end (mouse release) regardless if the
value is changed or not.

@item @ref{FL_RETURN_ALWAYS}
Return or invoke callback when the value changed or at end (mouse
release).
@end table

See the demo program @file{objreturn.c} for an example use of this.


@node Other Slider Routines
@subsection Other Slider Routines

To change the value and bounds of a slider use the following routines
@findex fl_set_slider_value()
@anchor{fl_set_slider_value()}
@findex fl_set_slider_bounds()
@anchor{fl_set_slider_bounds()}
@example
void fl_set_slider_value(FL_OBJECT *obj, double val);
void fl_set_slider_bounds(FL_OBJECT *obj, double min, double max);
@end example
@noindent
By default, the minimum value for a slider is 0.0, the maximum is 1.0
and the value is 0.5. For vertical sliders the slider position for the
minimum value is at the left, for horizontal sliders at the top of the
slider. By setting @code{nin} to a larger value than @code{max} in a
call of @code{@ref{fl_set_slider_bounds()}} this can be reversed.

If in a call of @code{@ref{fl_set_slider_bounds()}} the actual value
of a slider isn't within the range of the new bounds, its value gets
adjusted to the nearest limit. When the requested new slider value in
a call of @code{@ref{fl_set_slider_value()}} is outside the range of
bounds it gets adjusted to the nearest boundary value.

To obtain the current value or bounds of a slider use
@findex fl_get_slider_value()
@anchor{fl_get_slider_value()}
@example
double fl_get_slider_value(FL_OBJECT *obj);
void fl_get_slider_bounds(FL_OBJECT *obj, double *min, double *max);
@end example

@c -----------------------------------------------------------------
@c The following function still exist but the description is wrong.
@c fl_set_slider_step() doesn't do anything and
@c fl_set_slider_increment() is only used internallyy for sliders
@c used in scrollbars (and doesn't do anything for normal sliders)

@c In a number of situations you may like slider values to be rounded to
@c some values, e.g. to integer values. To this end use the routine
@c @findex fl_set_slider_step()
@c @anchor{fl_set_slider_step()}
@c @example
@c void fl_set_slider_step(FL_OBJECT *obj, double step);
@c @end example
@c @noindent
@c After this call slider values will be rounded to multiples of @code{step}.
@c Use the value 0.0 for @code{step} to switch off rounding.


@c By default, if the mouse is pressed below or above the the sliding
@c bar, the sliding bar jumps to the location where the mouse got pressed.
@c You can, however, use the following routine to change this default so
@c the jumps are made is discrete increments:
@c @findex fl_set_slider_increment()
@c @anchor{fl_set_slider_increment()}
@c @example
@c void fl_set_slider_increment(FL_OBJECT *obj, double lj, double rj);
@c @end example
@c @noindent
@c where @code{lj} indicates how much to jump if the left mouse button is
@c pressed and @code{rj} indicates how much to increment if right/middle
@c mouse buttons pressed. This routine can be used if finer control of
@c the slider value is needed or to assign different meanings to different
@c mouse buttons. For example, for the slider in the browser class, the
@c left mouse jump is made to be one page and right jump is made to be
@c one line.
@c 
@c To obtain the current increment, use the following routine
@c @findex fl_get_slider_increment()
@c @anchor{fl_get_slider_increment()}
@c @example
@c void fl_get_slider_increment(FL_OBJECT *obj, double *lj, double *rj);
@c @end example
@c -----------------------------------------------------------------


@node Slider Attributes
@subsection Slider Attributes

Never use @code{FL_NO_BOX} as the boxtype for a slider. For
@code{FL_VERT_NICE_SLIDER}s and @code{FL_HOR_NICE_SLIDER}s it's best
to use a @code{FL_FLAT_BOX} in the color of the background to get the
nicest effect.

The first color argument (@code{col1}) to
@code{@ref{fl_set_object_color()}} controls the color of the
background of the slider, the second (@code{col2}) the color of the
slider itself.

You can control the size of the slider inside the box using the routine
@findex fl_set_slider_size()
@anchor{fl_set_slider_size()}
@example
void fl_set_slider_size(FL_OBJECT *obj, double size);
@end example
@noindent
@code{size} should be a floating point value between 0.0 and 1.0. The
default is
@tindex FL_SLIDER_WIDTH
@code{FL_SLIDER_WIDTH}, which is 0.1 for regular sliders and 0.15 for
browser sliders. With a value for @code{size} of 1.0, the slider
covers the box completely and can no longer be moved. This function
does nothing if applied to sliders of type @code{NICE_SLIDER} and
@code{FILL_SLIDER}.

The routine
@findex fl_set_slider_precision()
@anchor{fl_set_slider_precision()}
@example
void fl_set_slider_precision(FL_OBJECT *obj, int prec);
@end example
@noindent
sets the precision with which the value of the slider is shown. This
only applies to sliders showing their value, i.e.@: valsliders.

By default, the value shown by a valslider is the slider value in
floating point format. You can override the default by registering a
filter function using the following routine
@findex fl_set_slider_filter()
@anchor{fl_set_slider_filter()}
@example
void fl_set_slider_filter(FL_OBJECT *obj,
                          const char *(*filter)(FL_OBJECT *,
                                                double value,
                                                int prec));
@end example
@noindent
where @code{value} and @code{prec} are the slider value and precision
respectively. The filter function @code{filter} should return a string
that is to be shown. The default filter is equivalent to the following
@example
const char *filter(FL_OBJECT *obj, double value, int prec) @{
    static char buf[32];

     sprintf(buf, "%.*f", prec, value);
     return buf;
@}
@end example

@node Slider Remarks
@subsection Remarks

See the demo program @file{demo05.c} for an example of the use of
sliders. See demo programs @file{sldsize.c} and @file{sliderall.c}
for the effect of setting slider sizes and the different types of
sliders.


@node Scrollbar Object
@section Scrollbar Object

Scrollbars are similar to sliders (as a matter of fact, scrollbars are
made with sliders and scrollbuttons), and useful in letting the user
indicate a value between some fixed bounds. Both horizontal and
vertical scrollbars exist. They have a minimum, maximum and current
value (all floating point values). The user can change this value by
dragging the sliding bar with the mouse or press the scroll buttons.
Whenever the value changes, it is reported to the application program
via the callback function.

@ifnottex

@menu
* Adding Scrollbar Objects:   Adding Scrollbar Objects
* Scrollbar Types:            Scrollbar Types
* Scrollbar Interaction:      Scrollbar Interaction
* Other Scrollbar Routines:   Other Scrollbar Routines
* Scrollbar Attributes:       Scrollbar Attributes
* Remarks:                    Scrollbar Remarks
@end menu

@end ifnottex


@node Adding Scrollbar Objects
@subsection Adding Scrollbar Objects

To add a scrollbar to a form use
@findex fl_add_scrollbar()
@anchor{fl_add_scrollbar()}
@example
FL_OBJECT *fl_add_scrollbar(int type, FL_Coord x, FL_Coord y,
                            FL_Coord w, FL_Coord h, const char *label);
@end example
@noindent
The meaning of the parameters is as usual. The label is by default
placed below the scrollbar.


@ifhtml
@center @image{images/scrollbars}
@end ifhtml
@ifnothtml
@center @image{images/scrollbars,14cm}
@end ifnothtml


@node Scrollbar Types
@subsection Scrollbar Types

The following types of scrollbar are available:
@table @code
@tindex FL_VERT_SCROLLBAR
@anchor{FL_VERT_SCROLLBAR}
@item FL_VERT_SCROLLBAR
A vertical scrollbar.

@tindex FL_HOR_SCROLLBAR
@anchor{FL_HOR_SCROLLBAR}
@item FL_HOR_SCROLLBAR
A horizontal scrollbar.

@tindex FL_VERT_THIN_SCROLLBAR
@anchor{FL_VERT_THIN_SCROLLBAR}
@item FL_VERT_THIN_SCROLLBAR
A different looking vertical scrollbar.

@tindex FL_HOR_THIN_SCROLLBAR
@anchor{FL_HOR_THIN_SCROLLBAR}
@item FL_HOR_THIN_SCROLLBAR
A different looking horizontal scrollbar.

@tindex FL_VERT_NICE_SCROLLBAR
@anchor{FL_VERT_NICE_SCROLLBAR}
@item FL_VERT_NICE_SCROLLBAR
A vertical scrollbar using @code{FL_NICE_SLIDER}.

@tindex FL_HOR_NICE_SCROLLBAR
@anchor{FL_HOR_NICE_SCROLLBAR}
@item FL_HOR_NICE_SCROLLBAR
A horizontal scrollbar using @code{FL_NICE_SLIDER}.

@tindex FL_VERT_PLAIN_SCROLLBAR
@anchor{FL_VERT_PLAIN_SCROLLBAR}
@item FL_VERT_PLAIN_SCROLLBAR
Similar to @code{FL_THIN_SCROLLBAR}.

@tindex FL_HOR_PLAIN_SCROLLBAR
@anchor{FL_HOR_PLAIN_SCROLLBAR}
@item FL_HOR_PLAIN_SCROLLBAR
Similar to @code{FL_HOR_THIN_SCROLLBAR}.
@end table


@node Scrollbar Interaction
@subsection Scrollbar Interaction

Whenever the user changes the value of the scrollbar, the scrollbar's
callback is called (if one is associated with the scrollbar). The
scrollbar position is changed by moving the mouse inside the scrollbar
area or. For fine control hold down the left or right @code{<Shift>}
key while moving the slider.

You can control under which conditions the scrollbar gets returned to
your application or its callback invoked. To change the default, call
@example
void fl_set_object_return(FL_OBJECT *obj, unsigned int when);
@end example
@noindent
where the parameter @code{when} can be one of the following four
values:
@table @code
@item @ref{FL_RETURN_NONE}
Never return or invoke callback.

@item @ref{FL_RETURN_END_CHANGED}
Return or invoke callback at end (mouse release) if value is changed
(since last return).

@item @ref{FL_RETURN_CHANGED}
Return or invoke callback whenever the scrollbar value is changed.
This is the default.

@item @ref{FL_RETURN_END}
Return or invoke callback at end (mouse release) regardless if the
value is changed or not.

@item @ref{FL_RETURN_ALWAYS}
Return or invoke callback whenever value changed or mouse button was
released.
@end table

The default setting for @code{when} for a scrollbar object is
@code{@ref{FL_RETURN_CHANGED}} (unless during the build of XForms you
set the configuration flag @code{--enable-bwc-bs-hack} in which case
the default is @code{@ref{FL_RETURN_NONE}} to keep backward
compatibility with earlier releases of the library).

See demo program @file{objreturn.c} for an example use of this.


@node Other Scrollbar Routines
@subsection Other Scrollbar Routines

To change the value and bounds of a scrollbar use the following
routines:
@findex fl_set_scrollbar_value()
@anchor{fl_set_scrollbar_value()}
@findex fl_set_scrollbar_bounds()
@anchor{fl_set_scrollbar_bounds()}
@example
void fl_set_scrollbar_value(FL_OBJECT *obj, double val);
void fl_set_scrollbar_bounds(FL_OBJECT *obj, double min, double max);
@end example
By default, the minimum value for a slider is 0.0, the maximum is 1.0
and the value is 0.5. For vertical sliders the slider position for the
minimum value is at the left, for horizontal sliders at the top of the
slider. By setting @code{min} to a larger value than @code{max} in a
call of @code{@ref{fl_set_scrollbar_bounds()}} this can be reversed.

If in a call of @code{@ref{fl_set_scrollbar_bounds()}} the actual
value of a scrollbar isn't within the range of the new bounds, its
value gets adjusted to the nearest limit. When the requested new
scrollbar value in a call of @code{@ref{fl_set_scrollbar_value()}} is
outside the range of bounds it gets adjusted to the nearest boundary
value.


To obtain the current value and bounds of a scrollbar use
@findex fl_get_scrollbar_value()
@anchor{fl_get_scrollbar_value()}
@findex fl_get_scrollbar_bounds()
@anchor{fl_get_scrollbar_bounds()}
@example
double fl_get_scrollbar_value(FL_OBJECT *obj);
void fl_get_scrollbar_bounds(FL_OBJECT *obj, double *min, double *max);
@end example

@c ---------------------------------------------------------------
@c The function fl_set_scrollbar_step() still exists but doesn't
@c has any effect!

@c In a number of situations you would like scrollbar values to be
@c rounded to some values, e.g. to integer values. To this end use the
@c routine
@c @findex fl_set_scrollbar_step()
@c @anchor{fl_set_scrollbar_step()}
@c @example
@c void fl_set_scrollbar_step(FL_OBJECT *obj, double step);
@c @end example
@c @noindent
@c After this call the scrollbar values will be rounded to multiples of
@c @code{step}. Use the value 0.0 for @code{step} to switch off rounding.
@c This should not be confused with the increment/decrement value when
@c the scroll buttons are pressed. Use
@c @code{@ref{fl_set_scrollbar_increment()}} to change the increment
@c value.
@c ---------------------------------------------------------------

By default, if the mouse is pressed beside the the sliding bar, the
bar starts to jumps in the direction of the mouse position. You can
use the following routine to change this size of the steps being
made :
@findex fl_set_scrollbar_increment()
@anchor{fl_set_scrollbar_increment()}
@example
void fl_set_scrollbar_increment(FL_OBJECT *obj, double lj, double rj);
@end example
@noindent
where @code{lj} indicates how much to increment if the left mouse
button is pressed and @code{rj} indicates how much to jump if the
middle mouse button pressed. For example, for the scrollbar in the
browser class, the left mouse jump is made to be one page and middle
mouse jump is made to be one line. The increment (decrement) value
when the scrollbuttons are pressed is set to the value of the right
jump. The default values for @code{lj} and @code{rj} are @code{0.1}
and @code{0.02}.

To obtain the current increment settings, use the following routine
@findex fl_get_scrollbar_increment()
@anchor{fl_get_scrollbar_increment()}
@example
void fl_get_scrollbar_increment(FL_OBJECT *obj, double *lj, double *sj);
@end example


@node Scrollbar Attributes
@subsection Scrollbar Attributes

Never use @code{FL_NO_BOX} as the boxtype for a scrollbar. For
@code{FL_VERT_NICE_SCROLLBAR}s and @code{FL_HOR_NICE_SCROLLBAR}s it's
best to use a @code{FL_FLAT_BOX} boxtype in the color of the
background to get the nicest effect.

The first color argument (@code{col1} to
@code{@ref{fl_set_object_color()}} controls the color of the
background of the scrollbar, the second (@code{col2}) the color of the
sliding bar itself.

You can control the size of the sliding bar inside the box using the
routine
@findex fl_set_scrollbar_size()
@anchor{fl_set_scrollbar_size()}
@example
void fl_set_scrollbar_size(FL_OBJECT *obj, double size);
@end example
@noindent
@code{size} should be a value between 0.0 and 1.0. The default is
@tindex FL_SLIDER_WIDTH
@code{FL_SLIDER_WIDTH}, which is 0.15 for all scrollbars With
@code{size} set to 1.0, the scrollbar covers the box completely and
can no longer be moved. This function does nothing if applied to
scrollbars of type @code{FL_NICE_SCROLLBAR}.


@node Scrollbar Remarks
@subsection Remarks

See the demo program @file{scrollbar.c} for an example of the use of
scrollbars.


@node Dial Object
@section Dial Object

Dial objects are dials that the user can put in a particular position
using the mouse. They have a minimum, maximum and current value (all
floating point values). The user can change this value by turning the
dial with the mouse. Whenever the value changes, this is reported to
the application program.

@ifnottex

@menu
* Adding Dial Objects:    Adding Dial Objects
* Dial Types:             Dial Types
* Dial Interaction:       Dial Interaction
* Other Dial Routines:    Other Dial Routines
* Dial Attributes:        Dial Attributes
* Remarks:                Dial Remarks
@end menu

@end ifnottex


@node Adding Dial Objects
@subsection Adding Dial Objects

To add a dial to a form use
@findex fl_add_dial()
@anchor{fl_add_dial()}
@example
FL_OBJECT *fl_add_dial(int type, FL_Coord x, FL_Coord y,
                       FL_Coord w, FL_Coord h, const char *label);
@end example
@noindent
The meaning of the parameters is as usual. The label is by default
placed below the dial.

@node Dial Types
@subsection Dial Types

@ifhtml
@center @image{images/dials}
@end ifhtml
@ifnothtml
@center @image{images/dials,10cm}
@end ifnothtml


The following types of dials are available:
@table @code
@tindex FL_NORMAL_DIAL
@anchor{FL_NORMAL_DIAL}
@item FL_NORMAL_DIAL
A dial with a knob indicating the position.

@tindex FL_LINE_DIAL
@anchor{FL_LINE_DIAL}
@item FL_LINE_DIAL
A dial with a line indicating the position.

@tindex FL_FILL_DIAL
@anchor{FL_FILL_DIAL}
@item FL_FILL_DIAL
The area between initial and current is filled.
@end table


@node Dial Interaction
@subsection Dial Interaction

By default, the dial value is returned to the application when the
user releases the mouse. It is possible to change this behavior using
the following routine
@example
void fl_set_object_return(FL_OBJECT *obj, unsigned int when);
@end example
@noindent
where @code{when} can be one of the following
@table @code
@item @ref{FL_RETURN_NONE}
Never report or invoke callback.

@item @ref{FL_RETURN_END_CHANGED}
Return or invoke callback at end (mouse release) and only if the dial
value is changed. This is the default setting.

@item @ref{FL_RETURN_CHANGED}
Return or invoke callback whenever the dial value is changed.

@item @ref{FL_RETURN_END}
Return or invoke callback at the end regardless if the dial value is
changed or not.

@item @ref{FL_RETURN_ALWAYS}
Return or invoke callback when value has changed or mouse button has
been released.
@end table

@node Other Dial Routines
@subsection Other Dial Routines

To change the value of the dial and its bounds use
@findex fl_set_dial_value()
@anchor{fl_set_dial_value()}
@findex fl_set_dial_bounds()
@anchor{fl_set_dial_bounds()}
@example
void fl_set_dial_value(FL_OBJECT *obj, double val);
void fl_set_dial_bounds(FL_OBJECT *obj, double min, double max);
@end example
@noindent
By default, the minimum value is 0.0, the maximum is 1.0 and the value
is 0.5.

To obtain the current values of the dial and its bounds use
@findex fl_get_dial_value()
@anchor{fl_get_dial_value()}
@findex fl_get_dial_bounds()
@anchor{fl_get_dial_bounds()}
@example
double fl_get_dial_value(FL_OBJECT *obj);
void fl_get_dial_bounds(FL_OBJECT *obj, double *min, double *max);
@end example

Sometimes, it might be desirable to limit the angular range a dial can
take or choose an angle other than 0 to represent the minimum value.
For this purpose, use the following routine
@findex fl_set_dial_angles()
@anchor{fl_set_dial_angles()}
@example
void fl_set_dial_angles(FL_OBJECT *obj, double thetai, double thetaf)
@end example
@noindent
where @code{thetai} maps to the minimum value of the dial and
@code{thetaf} to its maximum value. The angles are relative to the
origin of the dial, which is by default at 6 o'clock and rotates
clock-wise. By default, the minimum angle is 0 and the maximum angle
is 360.

By default, crossing from 359.9 to 0 or from 0 to 359.9 is not
allowed. To allowing crossing over, use the following routine
@findex fl_set_dial_crossover()
@anchor{fl_set_dial_crossover()}
@example
void fl_set_dial_crossover(FL_OBJECT *obj, int yes_no);
@end example
@noindent
where a true value for @code{yes_no} indicates that cross-over is
allowed.

In a number of situations you might want dial values to be rounded to
some values, e.g. to integer values. To this end use the routine
@findex fl_set_dial_step()
@anchor{fl_set_dial_step()}
@example
void fl_set_dial_step(FL_OBJECT *obj, double step);
@end example
@noindent
After this call dial values will be rounded to multiples of
@code{step}. Use a value of 0.0 for @code{step} to switch off
rounding.

By default, clock-wise rotation increases the dial value. To change,
use the following routine
@findex fl_set_dial_direction()
@anchor{fl_set_dial_direction()}
@example
void fl_set_dial_direction(FL_OBJECT *obj, int dir);
@end example
@noindent
where @code{dir} can be either
@tindex FL_DIAL_CCW
@code{FL_DIAL_CCW} or
@tindex FL_DIAL_CW
@code{FL_DIAL_CW}.


@node Dial Attributes
@subsection Dial Attributes

You can use any boxtype you like, but the final dial face always
appears to be circular although certain correlation between the
requested boxtype and actual boxtype exists (for example,
@code{FL_FRAME_BOX} is translated into a circular frame box.)

The first color argument (@code{col1} to
@code{@ref{fl_set_object_color()}} controls the color of the
background of the dial, the second @code{col2}) the color of the knob
or the line or the fill color.


@node Dial Remarks
@subsection Remarks

The resolution of a dial is about 0.2 degrees, i.e., there are only
about 2000 steps per 360 degrees and, depending on the size of the
dial, it is typically less.

The dial is always drawn with a circular box. If you specify a
@code{FL_UP_BOX}, a @code{FL_OVAL3D_UPBOX} will be used.

See the demo programs @file{ldial.c}, @file{ndial.c} and
@file{fdial.c} for examples of the use of dials.


@node Positioner Object
@section Positioner Object

A positioner is an object in which the user can indicate a position
with an x- and a y-coordinate. It displays a box with a cross-hair
cursor in it (except an invisble positioner, of course). Clicking the
mouse inside the box changes the position of the cross-hair cursor
and, hence, the x- and y-values.

@ifnottex

@menu
* Adding Positioner Objects:   Adding Positioner Objects
* Positioner Types:            Positioner Types
* Positioner Interaction:      Positioner Interaction
* Other Positioner Routines:   Other Positioner Routines
* Positioner Attributes:       Positioner Attributes
* Remarks:                     Positioners Remarks
@end menu

@end ifnottex


@node Adding Positioner Objects
@subsection Adding Positioner Objects

A positioner can be added to a form using the call
@findex fl_add_positioner()
@anchor{fl_add_positioner()}
@example
FL_OBJECT *fl_add_positioner(int type, FL_Coord x, FL_Coord y,
                             FL_Coord w, FL_Coord h, const char *label);
@end example
@noindent
The meaning of the parameters is as usual. The label is placed below
the box by default.


@node Positioner Types
@subsection Positioner Types

The following types of positioner exist:
@table @code
@tindex FL_NORMAL_POSITIONER
@anchor{FL_NORMAL_POSITIONER}
@item FL_NORMAL_POSITIONER
Cross-hair inside a box.

@tindex FL_OVERLAY_POSITIONER
@anchor{FL_OVERLAY_POSITIONER}
@item FL_OVERLAY_POSITIONER
Cross-hair inside a transparent box (i.e.@{ drawn in in XOR mode).

@tindex FL_INVISIBLE_POSITIONER
@anchor{FL_INVISIBLE_POSITIONER}
@item FL_INVISIBLE_POSITIONER
Completely invisible positioner to be used just for the side effect
of obtaining a position (typically an object is below below it that
otherwise would receive user events).
@end table


@node Positioner Interaction
@subsection Positioner Interaction

The user changes the setting of the positioner using the mouse inside
the box. Per default whenever the values changes, the object is
returned by the interaction routines or its callback invoked (if
one exists.

To change the default use the function
@example
void fl_set_object_return(FL_OBJECT *obj, unsigned int when);
@end example
@noindent
where @code{when} can be one of the following
@table @code
@item @ref{FL_RETURN_NONE}
Never report or invoke callback.

@item @ref{FL_RETURN_END_CHANGED}
Return or invoke callback at end (mouse release) and only when
the positioner ended in a different position than the one it
started from.

@item @ref{FL_RETURN_CHANGED}
Return or invoke callback whenever the positioners value is changed,
default setting.

@item @ref{FL_RETURN_END}
Return or invoke callback at the end only but regardless if the
positioners value changed or not.

@item @ref{FL_RETURN_ALWAYS}
Return or invoke callback when value has changed or mouse button has
been released.
@end table


@node Other Positioner Routines
@subsection Other Positioner Routines

To set the value of the positioner and the boundary values use the
routines:
@findex fl_set_positioner_xvalue()
@anchor{fl_set_positioner_xvalue()}
@findex fl_set_positioner_xbounds()
@anchor{fl_set_positioner_xbounds()}
@findex fl_set_positioner_yvalue()
@anchor{fl_set_positioner_yvalue()}
@findex fl_set_positioner_ybounds()
@anchor{fl_set_positioner_ybounds()}
@example
void fl_set_positioner_xvalue(FL_OBJECT *obj, double val);
void fl_set_positioner_xbounds(FL_OBJECT *obj, double min, double max);
void fl_set_positioner_yvalue(FL_OBJECT *obj, double val);
void fl_set_positioner_ybounds(FL_OBJECT *obj, double min, double max);
@end example
@noindent
By default the minimum values are 0.0, the maximum values are 1.0 and
the actual values are 0.5. For boundaries in x-direction @code{min}
and @code{max} should be taken to mean the left- and right-most
position, respectively, and for the y-boundaries @code{min} and @code{max}
should be taken to mean the value at the bottom and value at the top
of the positioner.

To obtain the current values of the positioner and the bounds use
@findex fl_get_positioner_xvalue()
@anchor{fl_get_positioner_xvalue()}
@findex fl_get_positioner_xbounds()
@anchor{fl_get_positioner_xbounds()}
@findex fl_get_positioner_yvalue()
@anchor{fl_get_positioner_yvalue()}
@findex fl_get_positioner_ybounds()
@anchor{fl_get_positioner_ybounds()}
@example
double fl_get_positioner_xvalue(FL_OBJECT *obj);
void fl_get_positioner_xbounds(FL_OBJECT *obj,
                               double *min, double *max);
double fl_get_positioner_yvalue(FL_OBJECT *obj);
void fl_get_positioner_ybounds(FL_OBJECT *obj,
                               double *min, double *max);
@end example
@noindent

In a number of situations you might like positioner values to be
rounded to some values, e.g. to integer values. To this end use the
routines
@findex fl_set_positioner_xstep()
@anchor{fl_set_positioner_xstep()}
@findex fl_set_positioner_ystep()
@anchor{fl_set_positioner_ystep()}
@example
void fl_set_positioner_xstep(FL_OBJECT *obj, double step);
void fl_set_positioner_ystep(FL_OBJECT *obj, double step);
@end example
@noindent
After these calls positioner values will be rounded to multiples of
@code{step}. Use a value of 0.0 for @code{step} to switch off rounding.

Sometimes, it makes more sense for a positioner to have an icon/pixmap
as the background that represents a minified version of the area where
the positioner's values apply. Type @code{FL_OVERLAY_POSITIONER} is
specifically designed for this by drawing the moving cross-hair in XOR
mode as not to erase the background. A typical creation procedure
might look something like the following
@example
obj = fl_add_pixmap(FL_NORMAL_PIXMAP, x, y, w, h, label);
fl_set_pixmap_file(obj, iconfile);
pos = fl_add_positioner(FL_OVERLAY_POSITIONER, x, y, w, h, label);
@end example
@noindent
Of course, you can overlay this type of positioner on objects other
than a pixmap. See the demo program @file{positionerXOR.c} for an
example.


@node Positioner Attributes
@subsection Positioner Attributes

Never use @code{FL_NO_BOX} as the boxtype for a positioner of type.
@code{FL_NORMAL_POSITIONER} (but the other two types will have a box
type of @code{FL_NO_BOX} per default).

The first color argument (@code{col1}) to
@code{@ref{fl_set_object_color()}} controls the color of the box, the
second (@code{col2}) the color of the cross-hair.


@node Positioners Remarks
@subsection Remarks

A demo can be found in @file{positioner.c}.


@node Counter Object
@section Counter Object

A counter provides a different mechanism for the user to indicate a
value. In consists of a box displaying a value and two or four
buttons, two at the left and two at the right side. The user can press
these buttons to change the value. If the counter has four buttons,
the left-most and right-most button make the value change in large
steps, the other buttons make it change in small steps. As long as the
user keeps the mouse pressed, the value changes.


@ifnottex

@menu
* Adding Counter Objects:   Adding Counter Objects
* Counter Types:            Counter Types
* Counter Interaction:      Counter Interaction
* Other Counter Routines:   Other Counter Routines
* Counter Attributes:       Counter Attributes
* Remarks:                  Counter Remarks
@end menu

@end ifnottex


@node Adding Counter Objects
@subsection Adding Counter Objects

To add a counter to a form use
@findex fl_add_counter()
@anchor{fl_add_counter()}
@example
FL_OBJECT *fl_add_counter(int type, FL_Coord x, FL_Coord y,
                          FL_Coord w, FL_Coord h, const char *label)
@end example
@noindent
The meaning of the parameters is as usual. The label is by default
placed below the counter.

@node Counter Types
@subsection Counter Types

@ifhtml
@center @image{images/counters}
@end ifhtml
@ifnothtml
@center @image{images/counters,8cm}
@end ifnothtml


The following types of counters are available:
@table @code
@tindex FL_NORMAL_COUNTER
@anchor{FL_NORMAL_COUNTER}
@item FL_NORMAL_COUNTER
A counter with two buttons on each side.

@tindex FL_SIMPLE_COUNTER
@anchor{FL_SIMPLE_COUNTER}
@item FL_SIMPLE_COUNTER
A counter with one button on each side.
@end table

@node Counter Interaction
@subsection Counter Interaction

The user changes the value of the counter by keeping his mouse pressed
on one of the buttons. Per default whenever the mouse is released and
the counter value is changed the counter is returned to the
application program or its callback is invoked.

In some applications you might want the counter to be returned to the
application program (or the callback invoked) e.g.@: whenever the
value changes and not only when the mouse is released. To this end use
@example
void fl_set_object_return(FL_OBJECT *obj, unsigned int when);
@end example
@noindent
where @code{when} can be either
@table @code
@item @ref{FL_RETURN_NONE}
Never report or invoke callback.

@item @ref{FL_RETURN_END_CHANGED}
Return or invoke callback at end (mouse release) and only if the counter
value is changed.

@item @ref{FL_RETURN_CHANGED}
Return or invoke callback whenever the counter value is changed. This
is the default setting.

@item @ref{FL_RETURN_END}
Return or invoke callback at the end regardless if the counter value is
changed or not.

@item @ref{FL_RETURN_ALWAYS}
Return or invoke callback when the counter value has changed or mouse
button has been released.
@end table


@node Other Counter Routines
@subsection Other Counter Routines

To change the value of the counter, it's bounds and stp size use the
routines
@findex fl_set_counter_value()
@anchor{fl_set_counter_value()}
@findex fl_set_counter_bounds()
@anchor{fl_set_counter_bounds()}
@findex fl_set_counter_step()
@anchor{fl_set_counter_step()}
@example
void fl_set_counter_value(FL_OBJECT *obj, double val);
void fl_set_counter_bounds(FL_OBJECT *obj, double min, double max);
void fl_set_counter_step(FL_OBJECT *obj, double small, double large);
@end example
@noindent
The first routine sets the value (default is 0) of the counter, the
second routine sets the minimum and maximum values that the counter
will take (default are -1000000 and 1000000, respectively) and the
third routine sets the sizes of the small and large steps (defaults to 0.1
and 1). (For simple counters only the small step is used.)

For conflicting settings, bounds take precedence over value, i.e., if
setting a value that is outside of the current bounds, it is clamped.
Also changing the bounds in a way that the current counter value isn't
within the new bounds range anymore will result in its value being
adjusted to the nearest of the new limits.

To obtain the current value of the counter use
@findex fl_get_counter_value()
@anchor{fl_get_counter_value()}
@example
double fl_get_counter_value(FL_OBJECT *obj);
@end example

To obtain the current bounds and steps, use the following functions
@findex fl_get_counter_bounds()
@anchor{fl_get_counter_bounds()}
@findex fl_get_counter_step()
@anchor{fl_get_counter_step()}
@example 
void fl_get_counter_bounds(FL_OBJECT *obj, double *min, double *max);
void fl_get_counter_step(FL_OBJECT *obj, double *small, double *large);
@end example

To set the precision (number of digits after the dot) with which the
counter value is displayed use the routine
@findex fl_set_counter_precision()
@anchor{fl_set_counter_precision()}
@example
void fl_set_counter_precision(FL_OBJECT *obj, int prec);
@end example

To determine the current value of the precision use
@findex fl_get_counter_precision()
@anchor{fl_get_counter_precision()}
@example
int fl_get_counter_precision(FL_OBJECT *obj);
@end example

By default, the value shown is the counter value in floating point
format. You can override the default by registering a filter function
using the following routine
@findex fl_set_counter_filter()
@anchor{fl_set_counter_filter()}
@example
void fl_set_counter_filter(FL_OBJECT *obj,
                           const char *(*filter)(FL_OBJECT *,
                                                 double value,
                                                 int prec));
@end example
@noindent
where @code{value} and @code{prec} are the counter value and precision
respectively. The filter function @code{filter} should return a string
that is to be shown. Note that the default filter is equivalent to the
following
@example
const char *filter(FL_OBJECT *obj, double value, int prec) @{
    static char buf[32];

     sprintf(buf, "%.*f",prec,value);
     return buf;
@}
@end example

By default the counter value changes first slowly and the rate of
change then accelerates until a final speed is reached. The default delay
between the value changing is @w{600 ms} at the start and the final
delay is @w{50 ms}. You can change the initial delay by a call of
the function
@findex fl_set_counter_repeat()
@anchor{fl_set_counter_repeat()}
@example
void fl_set_counter_repeat(FL_OBJECT *obj, int millisec);
@end example
@noindent
and the final delay by using
@findex fl_set_counter_min_repeat()
@anchor{fl_set_counter_min_repeat()}
@example
void fl_set_counter_min_repeat(FL_OBJECT *obj, int millisec);
@end example
@noindent
where in both cases the argument @code{millisec} is the delay in
milli-seconds. The current settings for the initial and final delay
can be obtained by calling the functions
@findex fl_get_counter_repeat()
@anchor{fl_get_counter_repeat()}
@findex fl_get_counter_min_repeat()
@anchor{fl_get_counter_min_repeat()}
@example
int fl_get_counter_repeat(FL_OBJECT *obj);
int fl_get_counter_min_repeat(FL_OBJECT *obj);
@end example

Until version 1.0.91 of the library the delay between changes of a
counter was constant (with a default value of @w{100 ms}). To obtain
this traditional behaviour simple set the initial and final delay to
the same value.

As a third alternative you can also request that only the first change
of the counter has a different delay from all the following ones. To
achieve this call
@findex fl_set_counter_speedjump()
@anchor{fl_set_counter_speedjump()}
@example
void fl_set_counter_speedjump(FL_OBJECT *obj, int yes_no);
@end example
@noindent
with a true value for @code{yes_no}. The delay for the first change of
the counter value will then be the one set by
@code{@ref{fl_set_counter_repeat()}} and the following delays last as
long as set by @code{@ref{fl_set_counter_min_repeat()}}.

To determine the setting for "speedjumping" call
@findex fl_get_counter_speedjump()
@anchor{fl_get_counter_speedjump()}
@example
int fl_get_counter_speedjump(FL_OBJECT *obj);
@end example


@node Counter Attributes
@subsection Counter Attributes

Never use @code{FL_NO_BOX} as the boxtype for a counter.

The first color argument (@code{col1}) t
@code{@ref{fl_set_object_color()}} controls the color of the
background of the counter, the second (@code{col2}) sets the color of
the arrow buttons of the counter.


@node Counter Remarks
@subsection Remarks

See demo program @file{counter.c} for an example of the use of
counters.


@node Spinner Object
@section Spinner Object

A spinner object is a combination of a (numerical) input field with
two (touch) buttons that allow to increment or decrement the value in
the (editable) input field. I.e.@: the user can change the spinners
value by either editing the value of the input field or by using the
up/down buttons shown beside the input field.

There are two types of spinner objects, one for integer and one for
floating point values. You can set limits on the values that can be
input and you can also set the amount of increment/decrement achieved
when clicking on its buttons.

@ifnottex

@menu
* Adding Spinner Objects:   Adding Spinner Objects
* Spinner Types:            Spinner Types
* Spinner Interaction:      Spinner Interaction
* Other Spinner Routines:   Other Spinner Routines
* Spinner Attributes:       Spinner Attributes
@end menu

@end ifnottex

@node Adding Spinner Objects
@subsection Adding Spinner Objects

To add a spinner to a form use
@findex fl_add_spinner()
@anchor{fl_add_spinner()}
@example
FL_OBJECT *fl_add_spinner(int type, FL_Coord x, FL_Coord y,
                          FL_Coord w, FL_Coord h, const char *label);
@end example
@noindent
The meaning of the parameters is as usual. The label is by default
placed on the left of the spinner object.


@node Spinner Types
@subsection Spinner Types

There are two types of spinners, one for input of integer and
one for floating point values:
@table @code
@tindex FL_INT_SPINNER
@anchor{FL_INT_SPINNER}
@item FL_INT_SPINNER
A spinner that allows input of integer values.

@tindex FL_FLOAT_SPINNER
@anchor{FL_FLOAT_SPINNER}
@item FL_FLOAT_SPINNER
A spinner that allows input of floating point values.
@end table

The way a spinner looks like depends on its dimensions. If it's at
least as wide as it's high the two buttons are drawn above each other
to the right of the input field (and are marked with and up and
down pointing triangle), while when the object is higher than it's
wide they are drawn beside each other and below the input field
(and the markers are then left and right pointing arrows).


@node Spinner Interaction
@subsection Spinner Interaction

The user can change the value of a spinner in two ways. She can either
edit the value in the spinner directly (exactly the same as for an
integer or floating point input object (@ref{Part III Input Objects})
or by clicking on one of the buttons that will increment or decrement
the value.

Per default the spinner object gets returned to the application
(or the associated callback is called) whenever the value changed
and the interaction seems to have ended. If you want it returned
under different circumstances use the function
@example
void fl_set_object_return(FL_OBJECT *obj, unsigned int when);
@end example
where the parameter @code{when} can be one of the four values
@table @code
@item @ref{FL_RETURN_NONE}
Never return or invoke callback.

@item @ref{FL_RETURN_END_CHANGED}
Return or invoke callback at end of interaction (when either the input
field loses the focus or one of the buttons was released) and the
spinner's value changed during the interaction.

@item @ref{FL_RETURN_CHANGED}
Return or invoke callback whenever the spinner's value changed. This
is the default.

@item @ref{FL_RETURN_END}
Return or invoke callback at end of interaction regardless of the
spinner's value having changed or not.

@item @ref{FL_RETURN_ALWAYS}
Return or invoke callback whenever the value changed or the
interaction ended.
@end table


@node Other Spinner Routines
@subsection Other Spinner Routines

Probably the most often used spinner functions are
@findex fl_get_spinner_value()
@anchor{fl_get_spinner_value()}
@findex fl_set_spinner_value()
@anchor{fl_set_spinner_value()}
@example
double fl_get_spinner_value(FL_OBJECT *obj );
double fl_set_spinner_value(FL_OBJECT *obj, double val);
@end example
@noindent
The first one returns the value of a spinner. The type of the return
value is a double for both integer and floating point spinners, so
you have to convert it for integer spinners appropriately, e.g:@:
using the @code{FL_nint()} macro, that converts a double to the
nearest integer value.

You can set or retrieve the upper and lower limit the value a spinner
can be set to using the functions
@findex fl_set_spinner_bounds()
@anchor{fl_set_spinner_bounds()}
@findex fl_get_spinner_bounds()
@anchor{fl_get_spinner_bounds()}
@example
void fl_set_spinner_bounds(FL_OBJECT *obj, double min, double max);
void fl_get_spinner_bounds(FL_OBJECT *obj, double *min, double *max);
@end example
@noindent
Since this function is to be used for integer as well as floating
point spinner objects the @code{double} type values must be converted
as necessary for @code{@ref{FL_INT_SPINNER}}.

The default limits are @code{-10000} and @code{10000}, but can be
set to up to @code{INT_MIN} and @code{INT_MIN} for
@code{@ref{FL_INT_SPINNER}}s and @code{-DBL_MAX} and @code{DBL_MAX}
for @code{@ref{FL_FLOAT_SPINNER}}s.

To set or determine the step size by which a spinner will be
incremented or decremented when one of the buttons is clicked on use
@findex fl_set_spinner_step()
@anchor{fl_set_spinner_step()}
@findex fl_get_spinner_step()
@anchor{fl_get_spinner_step()}
@example
void fl_set_spinner_step(FL_OBJECT *obj, double step);
double fl_get_spinner_step(FL_OBJECT *obj);
@end example
@noindent
The default step size is @code{1} for both @code{@ref{FL_INT_SPINNER}}
and @code{@ref{FL_FLOAT_SPINNER}} objects.


For @code{@ref{FL_FLOAT_SPINNER}} objects you can set (or determine)
how many digits after the decimal point are shown by using
@findex fl_set_spinner_precision()
@anchor{fl_set_spinner_precision()}
@findex fl_get_spinner_precision()
@anchor{fl_get_spinner_precision()}
@example
void fl_set_spinner_precision(FL_OBJECT *obj, int prec);
int fl_get_spinner_precision(FL_OBJECT *obj);
@end example
@noindent
This is per default set to 6 digits after the decimal point. The
function for setting the precision has no effect on
@code{@ref{FL_INT_SPINNER}} objects and the other one returns 0 for
this type of spinners.


@node Spinner Attributes
@subsection Spinner Attributes

Please don't change the boxtype from @code{@ref{FL_NO_BOX}}.

The label color and font can be set using the normal
@code{@ref{fl_set_object_lcol()}}, @code{@ref{fl_set_object_lsize()}}
and @code{@ref{fl_set_object_lstyle()}} functions. The color of the
input field of a spinner object can be set via using
@code{@ref{fl_set_object_color()}} where the first color argument
(@code{col1}) controls the color of the input field when it is not
selected and the second (@code{col2}) is the color when selected.

Instead of creating a plethora of functions to influence all the other
aspects of how the spinner is drawn (colors, font types etc.) the user
is given direct access to the sub-objects of a spinner. To this end
three functions exist:
@findex fl_get_spinner_input()
@anchor{fl_get_spinner_input()}
@findex fl_get_spinner_up_button()
@anchor{fl_get_spinner_up_button()}
@findex fl_get_spinner_down_button()
@anchor{fl_get_spinner_down_button()}
@example
FL_OBJECT *fl_get_spinner_input(FL_OBJECT *obj);
FL_OBJECT *fl_get_spinner_up_button(FL_OBJECT *obj);
FL_OBJECT *fl_get_spinner_down_button(FL_OBJECT *obj);
@end example
@noindent
They return the addresses of the objects the spinner object is made up
from and those then can be used to set or query the way the individual
components are drawn. The addresses of these sub-objects shouldn't be
used for any other purposes, especially their callback function may
never be changed!


@node Thumbwheel Object
@section Thumbwheel Object

Thumbwheel is another valuator that can be useful for letting the user
indicate a value between some fixed bounds. Both horizontal and
vertical thumbwheels exist. They have a minimum, a maximum and a
current value (all floating point values). The user can change the
current value by rolling the wheel.

@ifnottex

@menu
* Adding Thumbwheel Objects:   Adding Thumbwheel Objects
* Thumbwheel Types:            Thumbwheel Types
* Thumbwheel Interaction:      Thumbwheel Interaction
* Other Thumbwheel Routines:   Other Thumbwheel Routines
* Thumbwheel Attributes:       Thumbwheel Attributes
* Remarks:                     Thumbwheel Remarks
@end menu

@end ifnottex


@node Adding Thumbwheel Objects
@subsection Adding Thumbwheel Objects

To add a thumbwheel to a form use
@findex fl_add_thumbwheel()
@anchor{fl_add_thumbwheel()}
@example
FL_OBJECT *fl_add_thumbwheel(int type, FL_Coord x, FL_Coord y,
                             FL_Coord w, FL_Coord h, const char *label);
@end example
@noindent
The meaning of the parameters is as usual. The label is by default
placed below the thumbwheel.


@node Thumbwheel Types
@subsection Thumbwheel Types


@ifhtml
@center @image{images/thumbwheels}
@end ifhtml
@ifnothtml
@center @image{images/thumbwheels,7cm}
@end ifnothtml


The following types of thumbwheels are available:
@table @code
@tindex FL_VERT_THUMBWHEEL
@anchor{FL_VERT_THUMBWHEEL}
@item FL_VERT_THUMBWHEEL
A vertical thumbwheel.

@tindex FL_HOR_THUMBWHEEL
@anchor{FL_HOR_THUMBWHEEL}
@item FL_HOR_THUMBWHEEL
A horizontal thumbwheel.
@end table


@node Thumbwheel Interaction
@subsection Thumbwheel Interaction

Whenever the user changes the value of the thumbwheel using the mouse
or keyboard, the thumbwheel is returned (or the callback called) by
the interaction routines. You change the value of a thumbwheel by
dragging the mouse inside the wheel area or, for vertical thumbwheels
also by using the scroll wheel of the mouse. Each pixel of movement
changes the value of the thumbwheel by 0.005, which you can change
using the @code{@ref{fl_set_thumbwheel_step()}} function.

The keyboard can be used to change the value of a thumbwheel.
Specifically, the @code{<Up>} and @code{<Down>} cursor keys can be
used to increment or decrement the value of a vertical thumbwheel and
the @code{<Right>} and @code{<Left>} cursor keys can be used to
increment or decrement the value of horizontal thumbwheel. Each
pressing of the cursor key changes the thumbwheel value by the current
step value. The @code{<Home>} key can be used to set the thumbwheel to
a known value, which is the average of the minimum and the maximum
value of the thumbwheel.

In some applications you might not want the thumbwheel to be returned
all the time. To change the default, call the following routine:
@example
void fl_set_object_return(FL_OBJECT *obj, unsigned int when);
@end example
where the parameter @code{when} can be one of the four values
@table @code
@item @ref{FL_RETURN_NONE}
Never return or invoke callback.

@item @ref{FL_RETURN_END_CHANGED}
Return or invoke callback at end (mouse release) if value is changed
since last return.

@item @ref{FL_RETURN_CHANGED}
Return or invoke callback whenever the thumbwheel value is changed.

@item @ref{FL_RETURN_END}
Return or invoke callback at end (mouse release) regardless if the
value is changed or not.

@item @ref{FL_RETURN_ALWAYS}
Return or invoke callback whenever the value changes or the mouse
button is released.
@end table

See demo program @file{thumbwheel.c} for an example use of this.


@node Other Thumbwheel Routines
@subsection Other Thumbwheel Routines

To change the value and bounds of a thumbwheel use the following routines
@findex fl_set_thumbwheel_value()
@anchor{fl_set_thumbwheel_value()}
@findex fl_set_thumbwheel_bounds()
@anchor{fl_set_thumbwheel_bounds()}
@example
double fl_set_thumbwheel_value(FL_OBJECT *obj, double val);
void fl_set_thumbwheel_bounds(FL_OBJECT *obj, double min, double max);
@end example
@noindent
By default, the minimum value is 0.0, the maximum is 1.0 and the value
is 0.5.

To obtain the current value or bounds of a thumbwheel use
@findex fl_get_thumbwheel_value()
@anchor{fl_get_thumbwheel_value()}
@findex fl_get_thumbwheel_bounds()
@anchor{fl_get_thumbwheel_bounds()}
@example
double fl_get_thumbwheel_value(FL_OBJECT *obj);
void fl_get_thumbwheel_bounds(FL_OBJECT *obj, double *min, double *max);
@end example

By default, the bounds are "hard", i.e., once you reach the minimum or
maximum, the wheel would not turn further in this direction. However,
if desired, you can make the bounds to turn over such that it crosses
over from the minimum to the maximum value and vice versa. To this
end, the following routine is available
@findex fl_set_thumbwheel_crossover()
@anchor{fl_set_thumbwheel_crossover()}
@example
int fl_set_thumbwheel_crossover(FL_OBJECT *obj, int yes_no);
@end example

In a number of situations you might like thumbwheel values to be
rounded to some values, e.g. to integer values. To this end use the
routine
@findex fl_set_thumbwheel_step()
@anchor{fl_set_thumbwheel_step()}
@example
void fl_set_thumbwheel_step(FL_OBJECT *obj, double step);
@end example
@noindent
After this call thumbwheel values will be rounded to multiples of
@code{step}. Use a value 0.0 for @code{step} to switch off rounding.


@node Thumbwheel Attributes
@subsection Thumbwheel Attributes

Setting colors via @code{@ref{fl_set_object_color()}} has no effect on
thumbwheels.


@node Thumbwheel Remarks
@subsection Remarks

See the demo program @file{thumbwheel.c} for an example of the use of
thumbwheels.