|
Paul Walker wrote:
> I am trying to create a composite class that looks like the
> following. It would have one push button, and one text-entry box.
> When you click the push-button, a dialog appears allowing you to
> select a dataset. After selecting the dataset you want, the dialog
> closes, and the name of the dataset appears in the textbox.
>
> Textbox is named txtDS.
> Pushbutton is named cmdSELECTDS.
>
> I have started by creating a subclass of the parent class
> SASHELP.FSP.COMPOSIT. I know that I need to over-ride the .onClick()
> method of the push-button, and I am not sure how to do this. So far
> I am trying the code that follows in an SCL program named
> mynewclass_methods.scl:
>
> ------------------
> cmdSELECTDS._onClick(), Source Label=onClickAdd;
>
> onClickAdd: protected method return=num;
>
> myds = openSASFileDialog('DATA');
>
> call send( txtDS, '_set_text_', myds );
>
> endmethod;
> -------------------
>
> The error message I am getting when I try and compile the SCL code is:
>
> ERROR: [Line 1] The variable cmdSELECTDS has not been declared as an
> object.
> ERROR 22-322: Syntax error, expecting one of the following: ;, (, +,
> '.', =, [, {.
> ERROR 76-322: Syntax error, statement will be ignored.
> NOTE: SCL source line.
> 1 cmdSELECTDS._onClick(), Source Label=onClickAdd;
> -
> 22
> 76
> -------------------
>
> Can anyone help fix this code?
Suppose your composite is named PAULS.CONTROLS.DSTE.CLASS.
In SAS Explorer, double click on the class to open the CLASS EDITOR.
In the Class Properties pane, select the Attributes node. The second
attribute should be componentDefinition. Hightlight the Initial Value cell
of that attribute and select the ellipsis (...).
You are now in the Composite Definition window, which is very similar to a
Frame Build window.
Suppose the components are named myTE and myPB.
Right click in the layout window and select Properties. This brings up the
Properties Editor.
Open the push buttons node in the properties treelist.
Open the methods node
Scroll down to _onClick in the right hand side methods list and right click
on it.
Select override.
Entry your source catalog name.
Right click on the method again and select source. An edit window will
open.
Enter your override code
onClick: method;
myTE.text = openSASFileDialog('DATA');
endmethod;
compile and end.
end your way out of class editor.
I highly recommend learning and using dot notation. Avoid call send(), only
use it in legacy and highly exotic situtations.
You can find many conference papers on SAS/AF by using Lex Jansen's search
page
http://www.lexjansen.com/sugi/index.htm
You can find lots of AF samples at
http://www.devenezia.com/downloads/sas/af/
and a composite paper at
http://www.devenezia.com/papers/
--
Richard A. DeVenezia
|