Please enable JavaScript to view this site.

A-Shell Development History

Retrieve Date

To retrieve the selected date (either in response to receiving the click string or exitcode, or whenever you like), use CTLOP_QRYCB (5) opcode to query the control. This opcode was previously only used for querying a checkbox, but takes on a slightly different meaning here:

xcall AUI, AUI_CONTROL, CTLOP_QRYCB, id, ctext$, cstate, ctype, cmd$, "", cstatus

Set id to the id # of the control (as returned from the CTLOP_ADD) operation. The currently selected date will be returned in cstatus as a number with the following format: CCYYMMDD. (You can convert it to a string and parse it out into subfields as you like.) The ctext$, cstate, ctype, and cmd$ parameters are ignored.

Set Date

To set the date in the calendar, use the CTLOP_CHG opcode and put the date (in CCYYMMDD format) into the ctext$ parameter, as if you were changing the text of a control. Set the cstate parameter to MBST_TEXTONLY:

xcall AUI, AUI_CONTROL, CTLOP_CHG, id, ctext$, MBST_TEXTONLY

Set Limits

To limit the calendar to a range of dates, Use the CTLOP_CHG operation as for setting the date, except format the ctext$ parameter as a 17 byte string of two dates in CCYYMMDD format with a dash in between, for example:

CTEXT$ = "20050120-20070630"   ! range of 15-Jan-05 thru 30-Jun-07

xcall AUI, AUI_CONTROL, CTLOP_CHG, ID, CTEXT$, MBST_TEXTONLY

Set Day States

As an added feature, you can force selected dates to be shown in bold. To do so, specify the MCS_DAYSTATES flag (in the winstyle parameter) when creating the control. You must then send a string of 0's and 1's to the control to update the day states for the current month when the control is first displayed and whenever the month changes (which will require you to respond to the click code). Set the ctext$ parameter to a string 31 digits long, representing the days 1-31 of the current month. (Set any extra days to 0). 0 indicates the normal state, and 1 the bold state. Then use the same CTLOP_CHG format as shown above for setting the date. The control will determine which attribute you are setting by the fact that the ctext$ string is exactly 31 bytes long. For example::

CTEXT$ = "1000000000000010000000000000000"  ! bold 1st & 15th

xcall AUI, AUI_CONTROL, CTLOP_CHG, ID, CTEXT$, MBST_TEXTONLY

Note that this mechanism currently is only supported for one month at a time (so see the discussion above about specifying the coordinates to make sure that the control is not big enough to show multiple months).