FUNCTION MAIN()
LOCAL aArray := { { "SYMBOL1", 10 }, { "SYMBOL2", 20 } }
LOCAL i
FOR i = 1 TO LEN( aArray )
&( "M -> " + aArray[ i, 1 ] + " := " + LTRIM( STR( aArray[ i, 2 ] ) ) )
NEXT
? M -> SYMBOL1
? M -> SYMBOL2
RETURN NIL
class myActiveX
data aEvents
...
endclass
Now you can access aEvents:
MsgInfo( oActiveX:aEvents[1][1] )
MsgInfo( oActiveX:aEvents[1][2])
// ActiveX calendar class
CLASS calendar from TActiveX
DATA Campo1
DATA Campo2
endclass
Method new()
...
aEvents = ActXEvents( cTypeLib, act:hActiveX )
::Campo1 := aEvents[1][2]
::Campo2 := aEvents[2][2]
...
return self
oCalendar := calendar():new()
msgInfo( oCalendar:Campo1 ) // returns value, e.g. 30
method getEvent( cEvent )
local uValue, i
cEvent:= upper(alltrim(cEvent))
for i=1 to len( ::aEvents )
if upper(::aEvents[i]) == cEvent
uValue:= ::aEvents[i][2]
endif
next
return uValue
msgInfo( oCalendar:getEvent("campo1") ) // returns 30
lailton.webmaster wrote:MyArray:={ {'campo1', 30}, {'campo2', 50}}
for n = 1 to len(MyArray)
// How make it ?
// #define MyArray[n][1] MyArray[n][2]
next n
msginfo(campo2) // need return 50
i maked it
// it´s OK more is define campo2 as 50 only inside this function when i try msginfo(campo2) in other function
// give me erro variable no exist.
&( " "+Alltrim(MyArray[n][1]) +" := " + Alltrim(str(MyArray[n][1])) )
i try make it too.
&( "Public "+Alltrim(MyArray[n][1]) +" := " + Alltrim(str(MyArray[n][1])) )
More give me erro.
Someone can help ?
thanks
James Bott wrote:Frances,
That may work but assigning value to PUBLICs inside a class is not good OOP practice. It kind of defeats the purpose of having a class. The data should be stored inside the class.
Regards,
James
Return to FiveWin for Harbour/xHarbour
Users browsing this forum: Google [Bot] and 76 guests