Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SUPERBUG: set Column.Controlsource='m.variable'
Message
From
13/07/2005 10:23:14
 
 
To
12/07/2005 11:46:42
General information
Forum:
Visual FoxPro
Category:
Object Oriented Programming
Environment versions
Visual FoxPro:
VFP 9
Miscellaneous
Thread ID:
01031725
Message ID:
01032217
Views:
16
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.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform