Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Overcome 255 CursorSchema limit at Design Time
Message
 
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Titre:
Overcome 255 CursorSchema limit at Design Time
Divers
Thread ID:
00799936
Message ID:
00799936
Vues:
68
Many of you have been bitten by the Property Sheet limitation of 255 characters in general, and the CursorSchema in particular. The way to handle this is to populate the CursorSchema property with the complete structure in code at runtime. Of course, this is absolutely useless at design time when you would like to drag-and-drop fields from the cursor in the DE onto a form since you do not have all the fields available because of the 255 char limit for the CursorSchema [and other] properties.

What I am doing is creating a dummy DBC with tables of the same name as what I will name the associated CursorAdapter. Since these tables have the complete structure, I can temporarily add these tables to the DE for field drag-and-drop purposes. Once I am finished, I can delete the table from the DE, and replace it with the correct CA. Just make sure the Alias is the same name as the table.

To create the dummy DBC with the tables, you can use the following code that will open the CA ClassLib you build with my CA VCX Builder and create a PRG file that you can then run to create the DBC and all the tables represented in the VCX. Get the CA VCX Builder from the UT Downloads section.

Here is the code:
#DEFINE VFP_CRLF CHR(13)+CHR(10)

LOCAL lcClassLib, lcSQL, lcCode, lcTable
lcClassLib = GETFILE([VCX], [ClassLib], [OK], 0, ;
   [Select ClassLib to Process])
IF EMPTY(lcCLassLib) OR NOT FILE(lcClassLib)
   RETURN
ENDIF
lcSQL = [create database dbtemp] + VFP_CRLF ;
   + [set database to dbtemp] + VFP_CRLF + VFP_CRLF

USE (lcClassLib) ALIAS CA_Class
SET FILTER TO [TEXT TO lcSchema NOSHOW PRETEXT 2] $Methods
LOCATE
SCAN
   lcCode = STREXTRACT(Methods, ;
      [TEXT TO lcSchema NOSHOW PRETEXT 2], [ENDTEXT])
   lcCode = STRTRAN(lcCode, VFP_CRLF, [ ;] + VFP_CRLF)
   lcTable = GetAlias()
   lcCode = [CREATE TABLE ] + lcTable + [ (] + lcCode + [)]
   lcSQL = lcSQL + lcCode + VFP_CRLF
ENDSCAN
USE
LOCAL lcSafety
lcSafety = SET("Safety")
SET SAFETY ON
STRTOFILE(lcSQL, [Cr8_Tables.prg])
SET SAFETY &lcSafety
MODIFY COMMAND Cr8_Tables NOWAIT
RETURN


PROCEDURE GetAlias
LOCAL lnLines, laProps[1], lnI, lcTable
lcTable = [...???...]
lnLines = ALINES(laProps, CA_Class.Properties)
FOR lnI = 1 TO lnLines
   IF laProps[lnI] = [Alias =]
      lcTable = ALLTRIM(STRTRAN(laProps[lnI], [Alias = ], []))
      EXIT
   ENDIF
NEXT
RETURN lcTable
Mark McCasland
Midlothian, TX USA
Répondre
Fil
Voir

Click here to load this message in the networking platform