Post by George on Jan 25, 2022 14:21:14 GMT -5
Hi,
This is just a note about learning, there's always something new.
When multiple Edit tabs were introduced in SPFLite, the data isolation between tabs was handled by stuffing all tab related data into an Object. Some of that data was itself another Object (like Profile Data) and I could never quite get the syntax for accessing nested object data.
Forum searches etc. were no help, so I resorted to adding intermediary code stubs to provide the needed linkage, but this requires unique stubs for each data item.
Today while searching something totally different, I stumbled on exactly what I've been looking for and never finding.
Q: Now -- is it worth "correcting" things to remove all these little code stubs? Gotta think about this one.
Just FYI for any coders out there, here's the small test program showing the technique.
George
This is just a note about learning, there's always something new.
When multiple Edit tabs were introduced in SPFLite, the data isolation between tabs was handled by stuffing all tab related data into an Object. Some of that data was itself another Object (like Profile Data) and I could never quite get the syntax for accessing nested object data.
Forum searches etc. were no help, so I resorted to adding intermediary code stubs to provide the needed linkage, but this requires unique stubs for each data item.
Today while searching something totally different, I stumbled on exactly what I've been looking for and never finding.
Q: Now -- is it worth "correcting" things to remove all these little code stubs? Gotta think about this one.
Just FYI for any coders out there, here's the small test program showing the technique.
George
#COMPILE EXE
#DIM ALL
CLASS cProfData ' Sample Profile Object
INSTANCE Sample1 AS LONG
CLASS METHOD CREATE()
Sample1 = 123
END METHOD
INTERFACE iProfData: INHERIT IUNKNOWN
PROPERTY GET Sample1 AS LONG: PROPERTY = Sample1: END PROPERTY
PROPERTY SET Sample1(vl AS LONG): Sample1 = vl: END PROPERTY
METHOD TIMES(By AS LONG) AS LONG: METHOD = by * Sample1: END METHOD
METHOD TRY()
MSGBOX "Running inside TRY"
END METHOD
END INTERFACE
END CLASS
CLASS cTabData ' Sample TabData Object
INSTANCE PRF AS iProfData
CLASS METHOD CREATE
PRF = CLASS "cProfData"
END METHOD
CLASS METHOD DESTROY
PRF = NOTHING
END METHOD
INTERFACE iTabData: INHERIT IUNKNOWN
METHOD PRF_ AS iProfData ' Magic method, create a method to
METHOD = PRF ' return the PRF object itself
END METHOD
END INTERFACE
END CLASS
FUNCTION PBMAIN () AS LONG
LOCAL TP AS iTabData ' Create the TabData Object
TP = CLASS "cTabData"
msgbox FORMAT$(TP.PRF_.Sample1) ' Print Sample1 (123)
TP.PRF_.Sample1 = 987 ' Alter Sample1
msgbox FORMAT$(TP.PRF_.Sample1) ' Print Sample1 again (987)
msgbox FORMAT$(TP.PRF_.Times(3)) ' Invoke a PRF METHOD (987 * 3) = 2961
TP.PRF_.try ' and another one
END FUNCTION