Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Column's controlsource strange behavior!
Message
 
À
20/06/2000 07:55:20
Emanuele Bonin
EB Soluzioni Informatiche
Tezze S/B, Italie
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00382120
Message ID:
00382161
Vues:
25
It seems you have one column in your 'test' cursor. So, the grid based on this cursor should have one column too. What could be 'physically' the ControlSource source for the grid's second column?

Try .Column2.Text1.Value="Decoding_Function(1)" instead.

Regards


*Your Message below---------------------------------------------------\

I have found a bug or a strange behavior when you try to use UDF on Column's ControlSource.

Depending on Type and/or Number of Parameters VFP can Emit the error 'Variable is not found'.

If You create a form with a grid bounded on a cursor/table and one of its column's controlsource is the results of a UDF, if THIS UDF Receive only ONE NUMERIC AND GREATER THAN 0 parameters VFP will emit an the error 'variable is not found' when you try to run your form. But if you pass more than one parameter to your UDF or you pass a character parameter or a numeric parameter lower or equal to 0 al will be OK.


At the end of this E-mail there is an example of this behavior, here, VFP, will emit the above error at compile time.

I'am using VFP 6.0 SP3

seem that VFP discern UDF by Array only for the first parameter passed.

Anyone Have any other explanation ?

Thanx.

PS: Sorry for Bad English.



--- Cut Here ----
LOCAL oForm

oFOrm = CREATEOBJECT('MyFORM')
oFORM.SHOW(1)

RETURN

DEFINE CLASS MyForm AS FORM

FUNCTION LOAD()
CREATE CURSOR Test(FIELD1 CHAR(10))
INSERT INTO TEST ( FIELD1) VALUES ('Test')
ENDFUNC

FUNCTION INIT()
THIS.AddObject('Mygrid', 'GRID')

WITH THIS.MyGrid
.RecordSource = 'Test'
.ColumnCount = 2
.Column1.ControlSource = "test.Field1"

** This Columns permits the Compilation
.Column2.ControlSource = "Decoding_Function('')" && (1)
** .Column2.ControlSource = "Decoding_Function(0, '')"&& (2)
** .Column2.ControlSource = "Decoding_Function(0)" && (3)
** .Column2.ControlSource = "Decoding_Function(-1)" && (4)
** .Column2.ControlSource = "Decoding_Function(-2)" && and so on ....

** This Column do not permit the Compilation emitting 'Variable is not Found'
** .Column2.ControlSource = "Decoding_Function(1)" && (5)
** .Column2.ControlSource = "Decoding_Function(2)" && (5)
** .Column2.ControlSource = "Decoding_Function(3)" && and so on ...


.Visible = .t.
ENDWITH


ENDFUNC

FUNCTION Destroy()
USE IN Test
ENDFUNC

ENDDEFINE

FUNCTION Decoding_Function(xVal, xVal2)
RETURN 'Fixed String'
ENDFUNC
--- Cut Here ----


Artel Software House
Emanuele Bonin
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform