Tip for using TextDynamic in Visual FoxPro |
[Top] [Chapter] [Previous] [Next] |
If You cannot access the interfaces in Visual FoxPro directly, You can use the method GETINTERFACE:
Example:
ospell=GETINTERFACE(someform.textdynamic.SpellCtrl, "{8A8763C7-D866-4D33-A6E9-FF17C008D57B}", "WPTDynInt.ocx")
This is the list of the GUIDs:
IWPDLLInt: TGUID = '{12AD8DF2-3F90-4842-A8DA-238FBB997A2C}'; DIWPDLLIntEvents: TGUID = '{F3406696-3A1F-40B7-9223-45CEAEE763A9}'; IWPSpell: TGUID = '{8A8763C7-D866-4D33-A6E9-FF17C008D57B}'; IWPFieldContents: TGUID = '{3A9F60B7-68DE-4685-8C4E-9CA5CB6BA0A1}'; IWPReportBand: TGUID = '{229A4D15-EDC5-49E1-88F0-537AFB9E5545}'; IWPAttrInterface: TGUID = '{EE1F5982-43C0-4CCC-A57D-44355A439B8B}'; IWPParInterface: TGUID = '{EEC880BF-F8D7-4759-BE47-6A5451D08DBE}'; IWPPageSize: TGUID = '{00CBDEC6-0659-484C-8E9A-79EEE052CE8D}'; IWPTextObj: TGUID = '{68402602-9579-4833-ACCF-87C08445D09D}'; IWPCharacterAttr: TGUID = '{3AD3823E-F98F-45C5-8C6A-63C759CEF115}'; IWPDllButton: TGUID = '{8F6368D4-20D7-47C0-BF15-BE84DC7A19B2}'; IWPMeasurePageParam: TGUID = '{AE5DC437-13B8-4570-B51E-5782DB781372}'; IWPTextWriter: TGUID = '{E67714A5-920B-4D7C-ADC9-E69771B837AF}'; IWPPdfCreator: TGUID = '{C6B1B485-6EB5-4360-9C19-7BCBA4E43529}'; IWPTextCursor: TGUID = '{04210CF0-6926-4FD3-A7F0-4B6E49A8E631}'; IWPPicture: TGUID = '{4814E8DE-FD92-428A-9A50-D8415D212F7C}'; IWPMemo: TGUID = '{1E97E55D-87BD-4EAA-A9D3-4596CA692066}'; IWPDataBlock: TGUID = '{5B3F57A7-111F-4BC3-96CF-87B28F799D58}'; IWPPrintParameter: TGUID = '{1007B503-DE31-49EC-961E-5793E6F56BBB}'; IWPStream: TGUID = '{6E876673-C4DF-46B2-A6BF-0CD2EAD934B2}'; IWPReport: TGUID = '{22473C83-2A1E-4F86-B63C-96AA53C2D38B}'; IWPReportVar: TGUID = '{D5522CFE-7289-47E8-9980-AE5A684842C4}'; IWPNumberStyle: TGUID = '{C0084898-160F-4B43-8C7B-C1B9A18B36AF}'; IWPMapi: TGUID = '{FCD93E2C-09F6-429D-B77A-DD52DB5F7202}'; CLASS_WPDLLInt: TGUID = '{2BBD28B0-E69A-4A69-8AFB-20048338C0C2}'; IWPLabelDef: TGUID = '{36A5EC1D-A642-45FB-8BFF-A4903A66BEFA}'; IWPPageSizeList: TGUID = '{03859513-A634-4C7F-AB33-0FB46BC027BA}';
Getting access to special-interfaces using VFP
To get full access to the interfaces of some parts of the textdynamic object you have to use GETINTERFACE(). The following codesnippet shows as an example the access to the PageSize via the WPTDYNINT.IWPPageSize Interface. In this example loRTF is an instance of the WPTDYNINT mainobject.
LOCAL loPageSize as WPTDYNINT.IWPPageSize loPageSize = GETINTERFACE(loRTF.Memo.PageSize,"{00CBDEC6-0659-484C-8E9A-79EEE052CE8D}","WPTDynInt.ocx") WITH loPageSize lnPW=.PageWidth lnPH=.PageHeight lnML=.LeftMargin lnMR=.RightMargin lnMT=.TopMargin lnMB=.BottomMargin ENDWITH loPageSize=.null.
RELEASE loPageSize
Hints for this example:
- Using a variable declaration with AS <interface-name> will give you intellisense support on your object showing the interface-props and methods. Which makes life much easier when typing.
- Be aware of using the correct Reference-object as first param of the GETINTERFACE(…) Function. Example: loRTF.MEMO.PageSize will give you access to the interface of the first editor’s pagesize. On the contrary loRTF.MEMO2.PageSize will present the interface and content of the second Editor. Especially with Interfaces like CurrAttr / CurrPar etc. you have to be sure what content you actually get.
- Be sure to clear and release the object you created with the interface. GarbageCollection will most likely clear everything, but if not, things will get pretty messy. So null-it and release it when you’re done with it.
|