@@ -90,7 +90,7 @@ instance fields inherited from the GenValue's superclass, **GenClass**.
9090
9191----------
9292** Code Display 8-1 GenValue Instance Data**
93-
93+ ~~~
9494 /* The instance data fields for GenValue are shown below. Those that are records
9595 * of flags have their default flags shown with other possible flags listed below.
9696 * Other fields are shown with their default values. */
@@ -125,7 +125,7 @@ instance fields inherited from the GenValue's superclass, **GenClass**.
125125
126126 @instance optr GVLI_destination;
127127 @instance Message GVLI_applyMsg = 0;
128-
128+ ~~~
129129----------
130130* GVLI_value* is the current numerical value of the GenValue. By default, it is
131131an integer constant defined by the application. Depending on the
@@ -161,14 +161,14 @@ changes. This can be an optr to an object or a valid **TravelOption**. See
161161
162162----------
163163** Code Display 8-2 GenValue Optional Attribute Fields**
164-
164+ ~~~
165165 @vardata Message ATTR_GEN_VALUE_STATUS_MSG;
166166 @vardata word TTR_GEN_VALUE_DECIMAL_PLACES;
167167 @vardata WWFixed ATTR_GEN_VALUE_METRIC_INCREMENT;
168168 @vardata optr ATTR_GEN_VALUE_RUNS_ITEM_GROUP;
169169 @reloc ATTR_GEN_VALUE_RUNS_ITEM_GROUP, 0 optr;
170170 @vardata void ATTR_GEN_VALUE_SET_MODIFIED_ON_REDUNDANT_SELECTION;
171-
171+ ~~~
172172----------
173173ATTR_GEN_VALUE_STATUS_MSG sets a status message for a GenValue. A
174174status message allows your object to communicate with other objects when
@@ -193,14 +193,17 @@ state occurs, no message will be sent out.)
193193
194194----------
195195** Code Display 8-3 GenValue Hints**
196-
196+ ~~~
197197 @vardata void HINT_VALUE_INCREMENTABLE;
198198 @vardata void HINT_VALUE_NOT_INCREMENTABLE;
199199
200200 @vardata void HINT_VALUE_NAVIGATE_TO_NEXT_FIELD_ON_RETURN_PRESS;
201201 @vardata Message HINT_VALUE_CUSTOM_RETURN_PRESS;
202202
203203 @vardata WWFixedAsDWord HINT_VALUE_DISPLAYS_RANGE;
204+ @vardata void HINT_VALUE_X_SCROLLER;
205+ @vardata void HINT_VALUE_Y_SCROLLER;
206+
204207 @vardata GenValueIntervals HINT_VALUE_DISPLAY_INTERVALS;
205208 @vardata void HINT_VALUE_CONSTRAIN_TO_INTERVALS;
206209
@@ -221,7 +224,7 @@ state occurs, no message will be sent out.)
221224 @vardata void HINT_VALUE_NO_ANALOG_DISPLAY;
222225 @vardata void HINT_VALUE_NOT_DIGITALLY_EDITABLE;
223226 @vardata void HINT_VALUE_DO_NOT_MAKE_LARGER_ON_PEN_SYSTEMS;
224-
227+ ~~~
225228----------
226229HINT_VALUE_INCREMENTABLE and HINT_VALUE_NOT_INCREMENTABLE
227230specify whether increment (and decrement) gadgets are appropriate for this
@@ -241,6 +244,12 @@ here. The maximum *GVLI_value* in this case would be *GVLI_maximum* minus
241244the range. If this hint is not present, the range "length" is presumed to be
242245zero, even in gadgets that specify a range length by default.
243246
247+ HINT_VALUE_X_SCROLLER and HINT_VALUE_Y_SCROLLER cause the GenValue to act as a
248+ scroll bar. These hints are often used to replace the scroll bars of a GenView with
249+ your own GenValue objects. It is also possible to use stand-alone scroll bars.
250+ However, this requires more extensive support from the application.
251+
252+
244253HINT_VALUE_DISPLAY_INTERVALS indicates that intervals should be
245254displayed along an object's range. This hint is used most often in analog (e.g.
246255slider) type displays. If possible, hash marks will appear along the
@@ -323,15 +332,15 @@ immediate mode, which will result in an immediate change in *GVLI_value*.
323332
324333----------
325334** Code Display 8-4 Setting an Initial Value**
326-
335+ ~~~
327336 /* This GenValue will appear with the initial integer value of two. MakeWWFixed
328337 * creates a fixed point value. */
329338
330339 @object GenValueClass MyValue = {
331340 GI_visMoniker = "My Value";
332341 GVLI_value = MakeWWFixed(2.0);
333342 }
334-
343+ ~~~
335344----------
336345** GenValueClass** provides several messages to change the value without user
337346control. MSG_GEN_VALUE_SET_VALUE sets this numeric value to a passed
@@ -565,13 +574,15 @@ and minimum.
565574----------
566575** Code Display 8-5 Setting Minimum, Maximum, Increment Values**
567576
577+ ~~~
568578 @object GenValueClass MyValue = {
569579 GI_visMoniker = "My Value";
570580 GVLI_value = MakeWWFixed(1.0);
571581 GVLI_minimum = MakeWWFixed(-100.0);
572582 GVLI_maximum= MakeWWFixed(100.0);
573583 GVLI_increment = MakeWWFixed(5.0);
574584 }
585+ ~~~
575586
576587----------
577588You may change the fixed point value of this increment with
@@ -842,6 +853,7 @@ it displays the numerical value within the textual display.
842853----------
843854** Code Display 8-6 Setting a Distance Display Format**
844855
856+ ~~~
845857 @object GenValueClass MyValue = {
846858 GI_visMoniker = "My Value";
847859 GVLI_displayFormat = GVDF_INCHES;
@@ -852,6 +864,7 @@ it displays the numerical value within the textual display.
852864 /* For an initial value of 1/2 inch, the equivalent value in Points is 36. */
853865 GVLI_increment = MakeWWFixed(36.0);
854866 }
867+ ~~~
855868
856869----------
857870 For example, if your display format is GVDF_INCHES and you wish to set an
@@ -890,6 +903,7 @@ the increment used if the application is metric.
890903----------
891904Code Display 8-7 ATTR_GEN_VALUE_METRIC_INCREMENT
892905
906+ ~~~
893907 /* If the application is US, the initial value will be 1 inch and the increment
894908 * will be 1 inch. If the application is metric, the initial value will be 2.54 cm
895909 * (1 inch or 72 points) but the increment will be 2.0 cm (56.692 points). If
@@ -904,6 +918,7 @@ Code Display 8-7 ATTR_GEN_VALUE_METRIC_INCREMENT
904918 GVLI_increment = MakeWWFixed(72.0);
905919 ATTR_GEN_VALUE_METRIC_INCREMENT = MakeWWFixed(56.692);
906920 }
921+ ~~~
907922
908923----------
909924To set a new display format, send MSG_GEN_VALUE_SET_DISPLAY_FORMAT.
@@ -974,6 +989,7 @@ TO_APP_TARGET.)
974989
975990** Code Display 8-8 Sending an Apply Message**
976991
992+ ~~~
977993 @object GenValueClass MyValue = {
978994 GI_visMoniker = "My Value";
979995 GVLI_value = MakeWWFixed(1.0);
@@ -990,6 +1006,7 @@ TO_APP_TARGET.)
9901006 curValue = curValue*2;
9911007 @call MyValue::MSG_GEN_VALUE_SET_VALUE(curValue, 0);
9921008 }
1009+ ~~~
9931010
9941011----------
9951012
@@ -1659,4 +1676,91 @@ range length.
16591676
16601677** Interception:** Generally not intercepted.
16611678
1679+ ### 8.4.7 Stand Alone Scroll Bars
1680+
1681+ HINT_VALUE_X_SCROLLER
1682+ HINT_VALUE_Y_SCROLLER
1683+
1684+ HINT_VALUE_X_SCROLLER and HINT_VALUE_Y_SCROLLER cause the GenValue to act as a
1685+ scroll bar. To use a GenValus as a stand-alone scroll bar, the application must
1686+ provide more comprehensive support.
1687+
1688+ - A GenValue that functions as a scroll bar sends not just one apply message, but
1689+ one of seven. Which one is sent depends on the action performed. The application
1690+ must define all seven messages sequentially. The first of these messages must be
1691+ set as GVLI_applyMsg of the object. It is permitted but not
1692+ required to handle all these messages in the same way.
1693+
1694+ - Furthermore, the visual update of scroll bars does not occur automatically. It
1695+ is necessary to send the current value of the GenValue back to the GenValue,
1696+ for example using MSG_GEN_VALUE_SET_VALUE. In
1697+ doing so, it is allowed to change the value beforehand, for example by rounding it to
1698+ ensure that only integer values are stored in the GenValue.
1699+
1700+ Typically, a GenValue that works as a scroll bar should display a range.
1701+
1702+ A GenValue that has set the hints HINT_VALUE_X_SCROLLER or HINT_VALUE_Y_SCROLLER does
1703+ not send it's status message, even if the attribute ATTR_GEN_VALUE_STATUS_MSG is present.
1704+
1705+ ----------
1706+ ** Code Display 8-9 Declaring and Handling the Messages**
1707+ ~~~
1708+ /* Define seven messages to support a GenValue that acts as a scroll bar.
1709+ * These messages must be defined immediately one after the other.
1710+ */
1711+ @class SampleApplicationClass, GenApplicationClass;
1712+ @message (GEN_VALUE_APPLY_MSG) MSG_SAMPLE_APP_SCROLLER_APPLY; /* BEG_ANCHOR */
1713+ @message (GEN_VALUE_APPLY_MSG) MSG_SAMPLE_APP_SCROLLER_APPLY_1; /* PAGE_UP */
1714+ @message (GEN_VALUE_APPLY_MSG) MSG_SAMPLE_APP_SCROLLER_APPLY_2; /* INC_UP */
1715+ @message (GEN_VALUE_APPLY_MSG) MSG_SAMPLE_APP_SCROLLER_APPLY_3; /* DRAG_AREA */
1716+ @message (GEN_VALUE_APPLY_MSG) MSG_SAMPLE_APP_SCROLLER_APPLY_4; /* INC_DOWN */
1717+ @message (GEN_VALUE_APPLY_MSG) MSG_SAMPLE_APP_SCROLLER_APPLY_5; /* PAGE_DOWN */
1718+ @message (GEN_VALUE_APPLY_MSG) MSG_SAMPLE_APP_SCROLLER_APPLY_6; /* END_ANCHOR */
1719+ @endc
1720+
1721+ /* We handle all the messages in the same way.
1722+ * As example, we round the passed value to the nearest integer first.
1723+ * Then we send it back to GenValue to visual update the scroll bar.
1724+ * The actual application-specific actions have been left out here.
1725+ */
1726+ @method SampleApplicationClass, MSG_SAMPLE_APP_SCROLLER_APPLY,
1727+ MSG_SAMPLE_APP_SCROLLER_APPLY_1,
1728+ MSG_SAMPLE_APP_SCROLLER_APPLY_2,
1729+ MSG_SAMPLE_APP_SCROLLER_APPLY_3,
1730+ MSG_SAMPLE_APP_SCROLLER_APPLY_4,
1731+ MSG_SAMPLE_APP_SCROLLER_APPLY_5,
1732+ MSG_SAMPLE_APP_SCROLLER_APPLY_6 {
1733+
1734+ /* Round the WWFixedAsDWord value. */
1735+ value += 0x8000;
1736+ value &= 0xFFFF0000;
1737+ @send SampleScroller::MSG_GEN_VALUE_SET_VALUE(value, FALSE);
1738+
1739+ /*
1740+ * Do whatever is necessary with that value.
1741+ */
1742+
1743+ }
1744+ ~~~
1745+
1746+ ** Code Display 8-10 Set up GenValue**
1747+ ~~~
1748+ /* This GenValue is intended to function as a horizontal scroll bar and
1749+ * represent a range of three values from zero to ten. This means that the
1750+ * GenValue's apply messages provide a value ranging from zero to seven.
1751+ *
1752+ * It is necessary to set the first of the seven messages defined above as
1753+ * GVLI_applyMsg.
1754+ */
1755+ @object GenValueClass SampleScroller = {
1756+ HINT_VALUE_X_SCROLLER;
1757+ HINT_EXPAND_WIDTH_TO_FIT_PARENT;
1758+ HINT_VALUE_DISPLAYS_RANGE = MakeWWFixed(3);
1759+ GVLI_maximum = MakeWWFixed(10);
1760+ GVLI_applyMsg = MSG_SAMPLE_APP_SCROLLER_APPLY;
1761+ GVLI_destination = @SampleApp;
1762+ }
1763+ ~~~
1764+
1765+
16621766[ GenInteraction] ( ogenint.md ) <-- [ Table of Contents] ( ../objects.md )   ;  ; --> [ GenView] ( ogenvew.md )
0 commit comments