Frank Schönheit - Sun Microsystems Germany wrote:
Hi Andrew,
I have not been able to use the event slots exposed on the property
editor either.
How so?
Frank, you are being to kind. I believe the proper response should have
been 'What the ---- are you talking about, it works just fine!'
The macro must be a function that returns a boolean, not a sub procedure
of course. This simple example works fine:
function onConfirmDelete( oEv ) as boolean
select case msgBox( "Are you sure?", 1, "Delete Invoice Detail" )
case 1 : onConfirmDelete = True
case 2 : onConfirmDelete = False
end select
end function
While this macro would simply delete the record with no prompt at all.
function onConfirmDelete( oEv ) as boolean
onConfirmDelete = True
end function
As for how I was so wrong - this is rather funny, if you have a sick
sense of humor like mine anyway.
The Basic IDE is very nice, but now and then it causes a problem. This
was one case and here are the steps needed to reproduce it.
I have a form with a sub-form. The function is assigned to the Confirm
Delete event on the sub-form.
While the form was open, not in edit mode, I toggled over to the IDE and
made a change to a different procedure in a different module but in the
same library as this function. ( working on two things at once in other
words )
I then went to delete a record from the grid on the sub-form. Instead of
my message box, the system supplied message box appeared, I answered YES.
All records in the sub-form where deleted, the record in the main form
was also deleted. This is not a good thing.
But as it turns out the only way to make this happen is to have the
library containing the function open in the IDE when a change is made to it.
Today I tested further.
I can open my form, then open a writer document. Record a macro and save
it into the module containing the onConfirmDelete function, so that it
over writes the main sub procedure. This will not cause the problem.
Do this with the IDE open and the library loaded into it and POW - ALL
records showing on the Main and Sub forms are deleted. Of course you can
avoid this by simply answering NO should the system message box appear
in place of my message box.
Sorry for jumping to a conclusion.
Drew :-[