Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How can I Modify Framework Events?

Status
Not open for further replies.

serarmoro

Programmer
Dec 18, 2002
16
MX
I'm working with Paradox 9 Developers Edition and developing applications in Paradox Framework, every time I create a new form it comes with a default framework code, I need to disable the Ctrl-Delete combination in order to prevent unauthorized record deletion, the way I use to do it in Paradox was placing code in the KeyPhysical event in the form. That always worked wonders. But under the framework scope there is a comment that explixcitly reads:

[uses ObjectPAL

KeyPhysicalBefore( var fwFormInfo FWForm, var eventInfo KeyEvent, var fwEventInfo FWEvent)
KeyPhysicalAfter( var fwFormInfo FWForm, var eventInfo KeyEvent, var fwEventInfo FWEvent)

endUses

method keyPhysical(var eventInfo KeyEvent)

var
fwEventInfo FWEvent
endVar

; DO NOT MODIFY THIS CODE! USE FRAMEWORK EVENTS INSTEAD...]

I've looked for framework events in the desktop form, and in the libraries, there's one that's named fwevent.ldl that means that is a delivered library (of course that you already knew) I've also searched for a fwevent.lsl that can be edited, but there's no such file.

Can anybody tell me where can I find this Framework events and if so, how can I edit them

Thank you very much

Serarmoro
 
Serarmoro,

You can't override the built-in Framework events, which is one reason why most people don't use the AF.

Instead, you should override an action event on the form the users shouldn't be deleting records from. Here's one way to do it, one taken from the record object of a tableframe (or MRO):

if eventInfo.id() = dataDeleteRecord then
if not OKToDelete then
eventInfo.setErrorCode( userError )
beep()
endIf
endIf

This prevents the record from being deleted with the keyboard, menu commands, toolbar buttons, and any other technique.

The OKToDelete block refers to some condition you would maintain with code that lets the record get deleted. Many people use a Logical variable that's declared at the form level for this sort of thing. You could then assign TRUE or FALSE to that variable at any given point to allow or prevent record deletions.

Hope this helps...

-- Lance
 
Thank you very much Lance, I'm working on that just know. I've read another thread I think it was placed by Kfenner where he(or she) asks for a way to prevent a record from beeing modified.

Serarmoro
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top