FoxInCloud
Re: Developing sample app
Mar. 5, 2012
06:31 am
3G50E088C Show this entire thread in new window
Gratar Image based on email address
From: Thierry Nivelet (FoxInCloud)
To: Garth Groft
Gilles is right

your .wAfterRowChange() method should be written this way :

LPARAMETERS tuRow IF NOT m.thisForm.wlHTMLGen DoDefault(tuRow) <your code to be executed when row changes> ENDIF


Thanks for both replies. We now understand the "splitting" idea but still need further clarification.

We put all the .AfterRowColChange event code in .wAfterRowColChange for both grids (Grid1 and GridUnits). We replaced <existing code> with Grid1 .AfterRowColChange event code. We do not know what to pass as tuRow. If turow is RECNO("projects"), then code could be DoDefault("RECNO("projects"))?

Grid1.wAfterRowColChange
IF NOT m.thisForm.wlHTMLGen
DoDefault(tuRow)
* <existing code>
SELECT Units
SET FILTER TO pid = projects.pid
thisform.grdunits.refresh
ENDIF

GridUnits.wAfterRowColChange:
Thisform.txtpid.refresh
Thisform.txtseq.refresh
Thisform.txtmodel_no.refresh
Thisform.txtselleach.refresh
Thisform.txtqty.refresh
thisform.txttonnage.refresh


Garth,

Tuvia's answer is absolutely right, I'll just expand a little more on that ...

.AfterRowColChange() triggers on either row change or column change; ActiveWidget's grid has 2 separate events for the same effect: row change and col change; having a 1-1 match between javascript and VFP events requires that you move your code processing row change to .wAfterRowChange() and/or your code processing column change to .wAfterColChange(), resulting in an empty .AfterRowColChange() method so that default aw.vcx!awGrd code executes (this default code ensures calling either .wAfterRowChange() or .wAfterColChange() when running in LAN mode).

tuRow is whatever data identifies current row, brought in by FoxInCloud Application Server, and processed by aw.vcx!awGrd::wRowChange() through the DoDefault(tuRow) instruction.

If your grid.RecordSource has a primary or candidate index key, it prevails on recno() used by default.

As index key may be of any type (mainly 'C' or 'I', but could be 'T' or whatever), parameter name is 'tuRow' follows VFP standard variable naming convention :
- 't' for parameter
- 'u' for unknown type
- 'Row' for Row identifier.

HTH,

thn



We are expanding our sample form by adding a classic table maintenance (add,edit,delete) form launched from a button on form1 (main). Our maintenance form has a parent grid and child grid. The parent grid (grid1.afterrowcol change) has the following code to display the child record associated with the parent record.

LPARAMETERS nColIndex
SELECT Units
SET FILTER TO pid = projects.pid
thisform.grdunits.refresh

We could have SET RELATION between the parent and child tables in the forms Init instead of SET FILTER in the grid's Event method.

FAA indicates that following manual change is needed:

Code for this event method must be split into before/afterRowChange() and before/afterColChange().

awGrd parent class code should execute:

IF NOT m.thisForm.wlHTMLGen
DoDefault(tuRow))
<existing code>
ENDIF

Split server code into wAfterRowChange() et wAfterColChange()

Our question is what does this message mean? what is meant by code for this event method must be split?

What is meant by awGrd parent class code should execute: IF NOT m.thisForm.wlHTMLGen
DoDefault(tuRow))
<existing code>
ENDIF

What is tuRow in DoDefault(tuRow))?

FAA has a similar message for the text field refreshes code in the child grid afterrowcolchangeevent method:
LPARAMETERS nColIndex
Thisform.txtpid.refresh
Thisform.txtseq.refresh
Thisform.txtmodel_no.refresh
Thisform.txtselleach.refresh
thisform.txtqty.refresh
thisform.txttonnage.refresh

How/where do we "split" these commands? What actually needs to be changed?

Thanks.

Garth





-- thn (FoxInCloud)