Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Calculate column on grid
Message
 
À
25/01/2024 18:12:07
Luis Santos
Biglevel-Soluções Informáticas, Lda
Portugal
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
01687576
Message ID:
01687589
Vues:
91
>Hello community,
>
>i created these bindevents for columns 1,5,8,9 so that when i change the value of any of them the procedure can calculate the value of my column13.
>but it doesn't work!
>
>As I'm already getting a headache, can someone help me explain what's wrong and possibly correct the code?
>
>Here is the code:
>
>PUBLIC oManipulador as Manipulador
>
>*!* - Instancia o objeto manipulador
>oManipulador = CREATEOBJECT("Manipulador")
>
>
>loGrid = SFT.PAGEFRAME1.PAGE1.CONT1.GRID1
>  
>* Set the ControlSource for each column
>*loGrid.Column1.ControlSource = "FI.ALTURA"
>*loGrid.Column5.ControlSource = "FI.ESPESSURA"
>*loGrid.Column8.ControlSource = "FI.LARGURA"
>*loGrid.Column9.ControlSource = "FI.PARTES"
>
>
>* Bind the event to Column1
>BINDEVENT(loGrid.Column1, "AfterRowColChange", oManipulador, "CalculateTotal")
>
>* Bind the event to Column5
>BINDEVENT(loGrid.Column5, "AfterRowColChange", oManipulador, "CalculateTotal")
>
>* Bind the event to Column8
>BINDEVENT(loGrid.Column8, "AfterRowColChange", oManipulador, "CalculateTotal")
>
>* Bind the event to Column9
>BINDEVENT(loGrid.Column9, "AfterRowColChange", oManipulador, "CalculateTotal")
>
>DEFINE CLASS Manipulador AS Session
>LPARAMETERS nColIndex
>
>* Define the event handler method directly
>PROCEDURE CalculateTotal
>   ? "CalculateTotal method called"  && No message was return ??
>      loGrid.Column13.text1.value = VAL(loGrid.Column1.text1.value * loGrid.Column5.text1.value * loGrid.Column8.text1.value * loGrid.Column9.text1.value)
>
>ENDPROC
>enddefine
>
>
>Thanks!
>Luis

Why BINDEVENT?
What happens if you set this:
loGrid.Column13.ControlSource = "=(loGrid.Column1.text1.value * loGrid.Column5.text1.value * loGrid.Column8.text1.value * loGrid.Column9.text1.value)"
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform