Welcome! Log In Create A New Profile

Advanced

Intercept Column Whenever Modified event?

Posted by Malc 
Malc
Intercept Column Whenever Modified event?
July 23, 2008 05:57PM
Hi Guys,

Anyone know of a way to intercept the Whenever Modified event for all columns of a specified Table so that I can call a generic routine????

Cheers

Malc
Piet van Zanten
Re: Intercept Column Whenever Modified event?
July 23, 2008 10:53PM
Hi Malc,

Why not put the call to the procedure in each columns modified section?

Best regards,
Piet
Hi Piet


Thats what I'm currently doing, but it is tedious and I am trying to find a generic replacement which can be saved in a control template/supercontrol and applied to our future development.


Regards

Malc


Firetox
Re: Intercept Column Whenever Modified event?
July 24, 2008 10:47AM
Hello

PROCEDURE TestAllModified(p_tableName is string)

v_ind is int
v_modified is boolean = True 

FOR v_ind = 1 _TO_ TableCount(p_tableName,toColumn)
	v_modified =  {TableEnumColumn(p_tableName,v_ind)}..Modified
	IF NOT v_modified THEN BREAK 
END
RESULT v_modified

Firetox
Bob Stratton (bosher)
Re: Intercept Column Whenever Modified event?
July 24, 2008 10:57AM
Very nice Firetox.

lovely bit of code!

Bob
Piet van Zanten
Re: Intercept Column Whenever Modified event?
July 24, 2008 12:48PM
Hi Malc,

Perhaps this could do the trick:
//in the project initialization code section:
EXTERN "Winconst.wl" 
//procedure to handle typed characters:
PROCEDURE HandleModif(nMessage, WPARAM , LPARAM )
Trace(nMessage,WPARAM,LPARAM)
//in the table initialization code section:
Event("HandleModif","Table1",WM_CHAR)
WPARAM returns the character, so you can discard Tab and Enter. Note that this event is triggered on every typed character, just as the "whenever modified" section of the table columns. I prefer to check modifications on exit of the column.

HTH,
Regards,
Piet
Hi Firetox

I shall try this now


Thanks

Malc
Hi Piet

I'm going to check this out now


Thanks


Malc
Hi Firetox

Sadly, this isn't doing the job.

It does determine which column has been modified, but unfortunately it is for all rows.
The reason I want to intercept the Column Whenever modified event, which fires for every cell edit, is that I can then flag a row as being modified, which will allow me to only process those modified rows in a batch transaction.

Cheers


Malc



Hello Malc

If that's all you need to do then:

If it is a meory table you could add a tag colum in the table and tick the ones that are modified and then process the tagged rows.

If the table is file based then use the primary key of the file records as a unique row identifier and write that id into a memory zone or a memory table for later processing.

Regards
Al
firetox
Re: Intercept Column Whenever Modified event?
July 24, 2008 03:08PM
yes this code is for column and the first message ask for it

now the prperty modified is not acitvate for a cell
then you neeed to do somme change for one line in the table but without the modified property.

you need to have a code in the enter of cell to save the value to say if it was modified or not
but it's possible
Hi Al

That's exactly what I am trying to accomplish.

I have an invisible RowModified checkbox column (which I might add on the fly if it doesn't exist) with I set True if a cell of that row is modified.

I'm also playing around with a configurable setting to switch the cell/row color for edited items. e.g. from Black text to Blue

Ditto for deleted rows, set a RowDeleted column & set the color to red and strikeout to indicate pending deletes

Then on save, I start my transaction, save the header (if changed) and iterate through the rows just applying the recorded changes


All this is fine if I call the routine from every Whenever Modified column event, but I am trying to be able to just apply it in one place.


Cheers

Malc

Piet,

Ooooh. Soooo close.

Can't seem to catch the Delete key sad smiley

I need to use WM_KEYUP or WM_KEYDOWN to catch this system key


Oh well, perhaps I'll put in a request to PC Soft for a
Whenever Modified event at the Table and or Row level

Cheers

Malc
Hi Firetox

> yes this code is for column and the first message ask for it
Sorry about that, I was probably not very clear in my question.

>you need to have a code in the enter of cell to save the value to say if it was modified or not
>but it's possible

I played around with the Focus Gain and Loss, saving to a global variable, but its a bit hit and miss, as these events do not seem to fire when you change rows within the same column.

I might just live with pasting a global procedure call into every column Whenever Modified event. Though tedious to apply, it works flawlessly.

Thanks


Malc
Piet van Zanten
Re: Intercept Column Whenever Modified event?
July 25, 2008 04:17PM
Hi Malc,

You could use Firetox's solution with some adaptation. If the help is correct the modified property can be reset. So if you put the modification checking in the row exit section of the table then you can reset each columns modified property after checking. On entry of the next line, all modified properties are reset to false again. Something like:
//in the row exit section
SetModCol(MyTable,col_Modif)
//global procedure
PROCEDURE SetModCol(sTableName..Name,sColName..Name)
i,nRow is int
bModif is boolean
sColName is string
nRow=CurrentSubscript()
FOR i = 1 _TO_ TableCount(tableName,toColumn)
  sColName=TableEnumColumn(p_tableName,i)
  IF bModif=False then 
    bModif =  {sColName,indControl}..Modified
  ELSE
    {sColName,indControl}..Modified=False
  END
END
//set invisible table column to True
IF bModif THEN {sColName,indControl}[nRow]=True
HTH, regards,
Piet
Author:

Your Email:


Subject:


Spam prevention:
Please, enter the code that you see below in the input field. This is for blocking bots that try to post this form automatically. If the code is hard to read, then just try to guess it right. If you enter the wrong code, a new image is created and you get another chance to enter it right.
Message: