Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Integration SDT - MM
Message
De
25/05/1998 10:37:44
Jaco Van Der Laan
Consilium Information Systems B.V.
Rotterdam, Pays-Bas
 
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
The Mere Mortals Framework
Titre:
Integration SDT - MM
Divers
Thread ID:
00101661
Message ID:
00101661
Vues:
48
I would like to integrate SDT with Mere Mortals CodeBook to automaticly fill in properties from the data dictionary into the controls, like the caption, format, width etc.

I have tried this by putting the following code into the Init() event of the cTextBoxL class:
*-------------------------------------------------------------------
DODEFAULT()

LOCAL loPrimaryBizObj,;
lcDatabaseName,;
llUseLocalData,;
oMetaMgr, ;
liID, ;
lcProp

loPrimaryBizObj = ThisForm.oPrimaryBizObj
IF TYPE('loPrimaryBizObj') != 'O'
WAIT WINDOW 'Primary Business Object (oPrimaryBizObj) is not instantiated'
RETURN
ELSE
loPrimaryBizObjEnvironment = loPrimaryBizObj.GetDataEnvironment()
lcDatabaseName = loPrimaryBizObjEnvironment.cDefaultDatabaseName
llUseLocalData = loPrimaryBizObjEnvironment.lUseLocalData
ENDIF

IF TYPE('goApp') # 'O'
WAIT WINDOW 'Application Object (goApp) not instantiated'
RETURN
ENDIF

* If we have a ControlSource and there's a application oMeta object or the oMeta
* property of the form this control is in has an oMeta object, use
* DBGetDBCKey() to get the ID for the field.

WITH This.TextBox
IF not empty(.ControlSource) and (type('goApp.oMeta') = 'O' and ;
not isnull(goApp.oMeta)) or (type('Thisform.oMeta') = 'O' and ;
not isnull(Thisform.oMeta))

oMetaMgr = iif(type('goApp.oMeta') = 'O' and not isnull(goApp.oMeta),;
goApp.oMeta, Thisform.oMeta)
slcFieldName = IIF(llUseLocalData,'L','V')+.ControlSource

liID = oMetaMgr.DBGetDBCKey(lcDatabaseName, 'Field', slcFieldName)

* Set InputMask and format to the appropriate properties if they aren't blank.

lcProp = dbgetprop(slcFieldName, 'Field', 'InputMask')
.InputMask = iif(empty(lcProp), .InputMask, lcProp)
lcProp = dbgetprop(slcFieldName, 'Field', 'Format')
.Format = iif(empty(lcProp), .Format, lcProp)

* Set ToolTipText to the appropriate property if it isn't blank.

lcProp = oMetaMgr.DBCXGetProp('CBmToolTip', liID)
.ToolTipText = iif(empty(lcProp), .ToolTipText, lcProp)

* Set StatusBarText to the appropriate property if it isn't blank.

lcProp = oMetaMgr.DBCXGetProp('CBmMessage', liID)
.StatusBarText = iif(empty(lcProp), .StatusBarText, lcProp)
ENDIF not empty(.ControlSource) ...
slcType = oMetaMgr.DBCXGetProp('CBcType',liID)
slnSize = oMetaMgr.DBCXGetProp('CBnSize',liID)
DO CASE
CASE slcType = 'D' AND ((SET('CENTURY') = 'ON' AND .Century = 2) ;
OR .Century = 1)
.Width = 77+.Margin
IF .Parent.Class = 'Column'
.Parent.Width = 77+.Margin
ENDIF
CASE slcType = 'D'
.Width = 63+.Margin
CASE LEN(ALLTRIM(.InputMask)) > slnSize
.Width = (LEN(ALLTRIM(.InputMask))+1)*7+.Margin
OTHERWISE
.Width = (slnSize+1)*7+.Margin
ENDCASE
ENDWITH

*------------------------------------------------------------------
The problem is that when I put this in the Init() event, the Business Object is not instantiated yet.

Does anyone have any suggestions of where to put this code, or is there already some documentation about this type of integration?

Thanks!


Jaco
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform