* Tested both solutions on OOo for Windows 2.0.2 (exactly same files as on Linux): same result - does not work with returning false from handler of form's "Confirm deletion". * Tested both solutions on OOo for Windows 2.0.3 (same files again): Now both solutions work!
It seems like this was a bug in v2.0.2. /Emil Emil Karlen wrote: > Andrew Jensen wrote: > >> 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 >> > > I tried this before and it didn't work for me. Now I copy-and-pasted your > code and bound it to the form's "Confirm deletion" event. > I put a breakpoint in the function to step through it, clicks "Cancel" in > the dialog, and watch so that False is returned. But the deletion process > continues anyway and the record is deleted!!! > > I am running OOo 2.0.2 on Linux. > > Now I am using an event listener as you described. I use one of the form's > events to register it. This works! Thanks! > > >> 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 :-[ --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
