Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
SUPERBUG: set Column.Controlsource='m.variable'
Message
De
13/07/2005 10:23:14
 
 
À
12/07/2005 11:46:42
Information générale
Forum:
Visual FoxPro
Catégorie:
Programmation Orientée Object
Versions des environnements
Visual FoxPro:
VFP 9
Divers
Thread ID:
01031725
Message ID:
01032217
Vues:
15
Well, I won't say anything about the style of your bug report. But there is the official support page support.microsoft.com/vfp9. The first link is a how to about bug reporting, and I think you already know that official way but like to post your bugs here.

The bug itself is even worse, if you consider that VFP so far not only accepted vars but even expressions and function calls as a controlsource. I have reported that bug on {^2005-07-07} and got no answer so far.

I found out that a controlsource works with things like uDoNothing(uDoNothing(m.var)), where uDoNothing() is a function just returning the value passed to it.

Here's a bit more bug reproduction code known to Microsoft:
** (1) Open VFP9
** (2) Run the following code:

*-------------------------------------------------
* VFP9 Controlsource-Bug:
PUBLIC goForm
goForm = CREATEOBJECT("myForm")
goForm.Show()

DEFINE CLASS myForm As Form
   ADD OBJECT Grid1 As Grid

   PROCEDURE Load()
      Create Cursor curTest(iPeriod I)
      Insert Into curTest Values(200411)
      Insert Into curTest Values(200412)
      Insert Into curTest Values(200501)
      Go Top
   ENDPROC

   PROCEDURE Init()
      WITH Thisform.Grid1
       .Recordsource = "curTest"
       .ColumnCount = 1
       .Columns(1).Controlsource="cMonthOfPeriod(curTest.iPeriod)" 

       * alternatively use the following Controlsources to get different contradictory behaviour:
       * .Columns(1).Controlsource="=cMonthOfPeriod(curTest.iPeriod)"
       * => why "... must be a variable reference"?
       * .Columns(1).Controlsource="cMonthOfPeriod(uDoNothing(curTest.iPeriod))"
       * => why "variable not found"?
       * .Columns(1).Controlsource="cMonthOfPeriod(Transform(curTest.iPeriod))"
       * => error in cMonthofPeriod as expected, as the parameter type is wrong,
       *    but the controlsource is accepted!
       * .Columns(1).Controlsource="uDoNothing(cMonthOfPeriod(curTest.iPeriod))"
       * => Works!? Why not the other way around then???
     ENDWITH
   ENDPROC
ENDDEFINE

FUNCTION cMonthOfPeriod()
  LPARAMETERS tiPeriod
  RETURN CMONTH(DATE(1900,VAL(RIGHT(STR(m.tiPeriod),2)),1))
ENDFUNC

FUNCTION uDoNothing()
   LPARAMETERS tuAnything
   RETURN tuAnything
ENDFUNC
*-------------------------------------------------
Bye, Olaf.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform