Lewy,
I've been fiddling with this for a few minutes and I've found two solutions: one is easy, but ugly to the end user and the second looks more professional, but requires substantially more work.
The easy solution is to add code to the form that toggles the state of the Confirm Record Deletes setting. You'd need to do this twice: when the form opens (e.g. in the Init() event) and when it closes (e.g. its Close() event.
The code to toggle the setting in Paradox 10 is:
Code:
sendkeys( "%TSE^{tab 2}%C~" )
Now, sendKeys() does what it sounds like, it simulates pressing keys on the keyboard. In this use, we're simulating the keystrokes needed to open the Preferences dialog, select the Tables tab, and click the Confirm Record deletes checkbox, and then choose OK. Here's how the keystrokes map out:
-- %T is Alt+T, the shortcut for the Tool menu.
-- S opens the Settings sub-menu
-- E chooses the Preferences command
-- ^{tab 2} presses Ctrl+Tab twice and selects the Table tab.
-- %C is the shortcut for toggling the Confirm Record Deletes check box.
-- ~ is the shortcut for accepting the dialog, e.g. clicking the OK button.
(I go into this in case you're not using Paradox 10. Corel reorganized them menus between versions, so things tend to move around. If you are using a different version, you'll need to determine necessary keystrokes and update the sendKeys() command accordingly.)
When you run this, it basically does the work you'd do interactively to change the setting. Unfortunately, you also see this process "flash" by. This is the ugly part.
If you do this when your form opens and when it closes, you'll get the behavior you're after, but you will also get complaints from your users that it looks unprofessional.
Which, admittedly, it does. It's a hack for something that Corel didn't provide a convenient and effective way to do this from ObjectPAL.
The second approach will look more professional, but it's substantially more work. The basic idea is to turn Confirm Record Deltes off permanently and then add code to all your forms to handle the confirmation process yourself.
This sounds like a lot of work, but it really isn't. You basically override the dataDeleteRecord action to display a confirmation dialog and then cancel the action if the user does.
For example, you could add code to the action() event of a record object to confirm deletes:
Code:
method action(var eventInfo ActionEvent)
if eventInfo.id() = dataDeleteRecord then
if not isEdit() then
beep()
else
if msgQuestion( "Confirm",
"Are you sure?" ) <> "Yes" then
eventInfo.setErrorCode( userError )
endIf
endIf
endIf
endMethod
This is much cleaner (and more professional, imho), but it means you'll have to add it to all data entry forms in your application.
Now, you might be tempted to experiment with changing the underlying Registry value that holds this, but it won't work. At least, it didn't work for me in Paradox 10.
The reason it doesn't work is, I suspect, due to the fact that Paradox only updates its internal variable for this setting from the Registry when you use the Preferences dialog. I suspect there's library call in the original code, but I haven't the slightest idea of how to research that.
Hope this helps...
-- Lance