I have a .w uib with miriad of fields. A browse on left and lots of fileds of that record on right. I intended to do this, but can't accomplish:
ON LEAVE OF fNombre IN FRAME DEFAULT-FRAME /* Nombre */ OR LEAVE OF fStatus OR LEAVE OF fSucursal OR LEAVE OF fNomina OR LEAVE OF fNombre OR LEAVE OF fDireccion OR LEAVE OF fCP OR LEAVE OF fColonia OR LEAVE OF fTelefono OR LEAVE OF fCiudad OR LEAVE OF fEstado OR LEAVE OF fRFC OR LEAVE OF fIMSS OR LEAVE OF fCURP ...... OR LEAVE OF fAfore OR LEAVE OF fEdoCivil OR LEAVE OF fFechaNacim OR LEAVE OF fDepen OR LEAVE OF fSexo OR LEAVE OF fTipoSanguineo OR LEAVE OF fVendedor OR LEAVE OF fComision OR LEAVE OF fSueldoDiario OR LEAVE OF fClave OR LEAVE OF fSueldoAnte OR LEAVE OF fHorario OR LEAVE OF fFechaModi OR LEAVE OF fJornada DO: IF SELF:MODIFIED THEN DO: MESSAGE "Modified" VIEW-AS ALERT-BOX. /* change buttons and state of options*/ END. END.
Is there somehow I can program one trigger? (I did it once, but used self:handle to get into private-data of the buttons which previously had stored the pk to some other data)
At this point I haven't found some method nor property to compare to :screen-value
greetings!!! and thanks!
One solution I gave to this problem, is:
ON ENTRY OF xxx OR ENTRY OF xxy OR ENTRY of xxz .... DO:
ASSIGN SELF:PRIVATE-DATA = STRING(SELF:SCREEN-.VALUE).
And on leave of xxxx or leave of xxy.....:
IF NOT (SELF:PRIVATE-DATA = STRING(SELF:screen-value)) THEN
but still, I think there is a much cleaver solution, but I don't know to question the current state of a filed (in the sense of changes)
Unless I'm misunderstanding what you're trying to do, I think an ANYWHERE trigger will do want you want.
ON ENTRY OF FRAME DEFAULT-FRAME ANYWHERE DO:
/* Use the SELF handle to see which widget in the frame received the event */
mmmhh. more or less, yes... thanks..
the thing is how can I know that a field was changed by the user.
Knowing which widget is being edited Is found by SELF:NAME or anything you want...
but is there some method or property that shows me the value the filed had before the current editing action...
this way I know I have to take some course of action that corresponds to accept editing, and some more stuff..
I've used an 'ON ENTRY' equivalent trigger that stores the previous value in a variable e.g.:
cPrevVal = SELF:SCREEN-VALUE.
Then compare that in the 'ON LEAVE' e.g.:
IF SELF:SCREEN-VALUE <> cPrevVal etc.
> At this point I haven't found some method nor property to compare to :screen-value
What's wrong with SELF:MODIFIED, like in your own example?
It throws true on every leave of the field, even in the case where just tabbing, that's it, I never changed the value, and still fires true... :( ?
> It throws true on every leave of the field, even in the case where just tabbing
When I try it, it works. But I'm on an old version, so I don't know if something might have changed.
But more likely, maybe there is something in the rest of your program that affects the status of the MODIFIED attribute? E.g if you DISPLAY the field when it is already enabled, then MODIFIED becomes TRUE. You can reset MODIFIED before editing by turning off and on the field's SENSITIVE attribute. Or don't enable the field until after you DISPLAY it. (According to the ABL reference.)