source: cprs/branches/tmg-cprs/m_files/TMGOOWG.m@ 1531

Last change on this file since 1531 was 796, checked in by Kevin Toppenberg, 14 years ago

Initial upload

File size: 2.9 KB
Line 
1TMGOOWG ;TMG/kst/OO widget setup ;03/25/06
2 ;;1.0;TMG-LIB;**1**;04/25/04
3
4 ;"Note: this was concept code. But a better example now is the TMGW* code
5
6
7 ;"Kevin Toppenberg MD
8 ;"GNU General Public License (GPL) applies
9 ;"------------------------------------------
10 ;"Object Widget setup code below
11 ;"------------------------------------------
12
13constrWidget(instanceName)
14 ;"Purpose -- A constructor for object Widget
15 ;"Input: objectType -- the NAME of the type of the object to be defined.
16 ;" This should be a variable (global or otherwise) of the object.
17 ;"Note: This function should not be called directly, but instead is called
18 ;" via new^TMGOOL
19 ;"Result: none <--- REQUIRED TO NOT RETURN A RESULT
20
21 ;"Here we define the default values for vars and functions.
22
23 ;"----------------All constructors should copy this format --------------------
24 new typeDef
25 set typeDef=@instanceName@("TYPEDEF")
26 set @typeDef@("Multiply")="wgtMultiply^TMGOOWG(x,y)"
27 set @typeDef@("Divide")="wgtDivide^TMGOOWG(x,y)"
28 set @typeDef@("Show")="wgtShowValue^TMGOOWG(x)"
29 ;"--------------------------------------------------------------------------------
30
31 ;"Optional initialization of some instance-specific variables.
32 set @instanceName@("MyVar1")=0
33 set @instanceName@("MyVar2")=0
34 set @instanceName@("MyVar3")=0
35
36 quit
37
38
39destWidget(instanceName)
40 ;"Purpose: A destructor for object Widget
41 ;" any needed clean up code would go here first.
42 ;"Input: instanceName -- the name of the object instance to be deleted.
43 ;" This should be the value returned from defWidget
44 ;"Note: Don't actually delete the object here. Just perform code needed to
45 ;" save the object variables etc. Anything neeed before the object
46 ;" is deleted by delete^TMGOOL
47
48 ;"-----------------
49
50 ;" Here I would put code that needs to be called before destruction of the object.
51
52 ;"-----------------
53
54 quit
55
56
57 ;"------------------------------------------
58 ;"Object Widget member functions below
59 ;"------------------------------------------
60
61
62wgtMultiply(x,y)
63 ;"Widget member function
64 ;"Note: function may depend on variable (with global scope) TMGthis, as a 'this' pointer to object calling
65 quit x*y
66
67wgtDivide(x,y)
68 ;"Widget member function
69 ;"Note: function may depend on variable (with global scope) TMGthis, as a 'this' pointer to object calling
70 quit x/y
71
72wgtShowValue(x)
73 ;"Widget member function (with no return value, i.e. a procedure)
74 ;"Note: function may depend on variable (with global scope) TMGthis, as a 'this' pointer to object calling
75 write x,!
76 quit 0
77
78
Note: See TracBrowser for help on using the repository browser.