| Search Locate Previous Next | Contents |
It would be nice to give the user some control over the look and feel of the chart, for example by setting the heading, or requesting markers rather than a filled line. Here is a slightly more refined version:
... where I have taken the actions out of the event table and returned the completed chart from a simple function:
rMakeCht sz
[1] © Set up chart to fit in given space
[2] #.ch.New 0 0,²sz
[3] #.ch.Set'noline,nomark,nofill'
[4] #.ch.Set,/chopt/'line,' 'mark,' 'fill'
[5] #.ch.Set'head'chttl
[6] #.ch.Plot+\?123½12
[7] r#.ch.Close
Note that the window size is passed in as an argument if I had included any Gui code within the function I would have made it impossible to test it from the session! I have left chopt and chttl as globals for the same reason; they are probably the kind of data you would save on an INI file anyway, so they would be local to your startup function or saved in a suitable namespace such as #.workvars.
There is one interesting new technique illustrated by the event tables on the first and last check boxes:
Lines: Validation: chopt[3]^¾
Filled: Validation: chopt[1]¾
It makes no sense to have fill without lines, so when the user unchecks the Lines box the Fill box is also cleared and when Fill is checked, Lines is checked also! This is done on a Validate event which is run by Causeway between the object being examined and the data from it being put back into the target variable. The actual data is available as ¾ in the event table; you can modify it in passing, reject the event (in which case the field is restored to its previous value) with CPro.Reject, or just set some other data to match.
In this case there was no need to holler chopt, because the change would be signalled automatically by Causeway as long as the validate was not rejected. If I had set a different variable, rather than just another element of the same variable, I would have needed to signal the change.