Re: [api-dev] small problem with starbasic in OOo 1.1.x
Thank you Christian And Peter, I will look into this now that you have shown me a sollution, and actually I do have an dialog already opened (what my system does is that it saves the document locally first, then takes the file on the disc and transfer it to a remote location using soap with attachments, when that transfer is done I need to modify that document and store some values I got in return from the soap call. this last part sometimes returned an error due to the fact that the user closed the document, but by doing this disabling of the dialog I probably can solve those errors. :-) /Christian Andersson Christian Junker wrote: Hi Peter, please read on! What can be done is to assign the macro to the receiving focus event, this event gets fired when the macro is started, so it is fired right at the beginning. Build the dialog in the Basic IDE, do define the property enabled as Yes. Thus code structure should look like this: 1.) load dialog library, createunodialog, execute dialog (thread starts) - dialog pops up and receiving focus event is fired, the assigned function is called 2.) dlg.setEnable(False) - user cannot close the dialog 2.) do everything you wanted to do now with the document (=implementation) 3.) at the end call dlg.setEnable(True) and then dlg.endexecute() - the dialog vanishes, the user can now work on with the document, control flow of the Starbasic code goes back to the .execute() statement and continues from there on (in the standard case the next line would just be End Sub or End Function). Note, that dlg should be a global variable as it is propably used in not just one function. Best Regards Christian Junker Peter Eberlein wrote: Christian Junker schrieb: and I forgot: Once the macro has finsihed you call endExecute() on the dialog and it should return to the document again. Christian, when the dialog is executed and shown on the screen, the macro stops (sleeps) at this point until the user triggers any event (pushs a button), doesn't it? That means, the user must trigger the main function (disabling the dialog, showing the progress bar, doing all the other things and ending execute the dialog). But that's not what Christian Anderson wanted. Peter - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [api-dev] small problem with starbasic in OOo 1.1.x
Christian Junker schrieb: Hi Peter, - dialog pops up and receiving focus event is fired, the assigned function is called That's it, thank you (shame on me). All the other things were clear. Peter - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [api-dev] small problem with starbasic in OOo 1.1.x
Hi Peter, should have tested this (again it shows that you should always test something before you give advice). I thought again about your problem and if your script does not run all the time but only sometimes I would propose the following to you: Either you create a dialog, or which is little bit more complicated a modular window (with the windowdescriptor service), that pops up when the macro begins its execution. In that time the user is caught in this one dialog (I would put an explanatory text like Please wait until the progress finishes... and if you want to make it professional you add some progressbar or some animation or whatever so that the user is occupied at least with something). The important thing is that the dialog itself has been disabled which means that it is not closed when the user presses the X button that you can see for every window on popular platforms. You do that by setting the enabled property in the dialog properties to the value off. Of course the macro shouldn't take too long, because a normal user probably would get angry when he clicks on the window to close it but it doesn't :). I know this is not a very user-friendly thing, but look around in other programs: They also sometimes show dialogs like Please wait... when they need to process a lot of data. Best Regards Christian Junker Peter Eberlein wrote: Hi Laurent, hi Christian, Laurent Godard schrieb: Hi, I can only agree with Laurent, the second way by locking the controllers would be the best option, I think. That way you can be very sure that your macro gets executed from beginning to end without any disturbance. for me this does not work like expected. LockControllers only disables writing into document and the toolbar buttons, not the menubar and shortkeys (1.9.74 WinNT). Peter - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [api-dev] small problem with starbasic in OOo 1.1.x
Christian Junker schrieb: and I forgot: Once the macro has finsihed you call endExecute() on the dialog and it should return to the document again. Christian, when the dialog is executed and shown on the screen, the macro stops (sleeps) at this point until the user triggers any event (pushs a button), doesn't it? That means, the user must trigger the main function (disabling the dialog, showing the progress bar, doing all the other things and ending execute the dialog). But that's not what Christian Anderson wanted. Peter - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [api-dev] small problem with starbasic in OOo 1.1.x
Hi Peter, please read on! What can be done is to assign the macro to the receiving focus event, this event gets fired when the macro is started, so it is fired right at the beginning. Build the dialog in the Basic IDE, do define the property enabled as Yes. Thus code structure should look like this: 1.) load dialog library, createunodialog, execute dialog (thread starts) - dialog pops up and receiving focus event is fired, the assigned function is called 2.) dlg.setEnable(False) - user cannot close the dialog 2.) do everything you wanted to do now with the document (=implementation) 3.) at the end call dlg.setEnable(True) and then dlg.endexecute() - the dialog vanishes, the user can now work on with the document, control flow of the Starbasic code goes back to the .execute() statement and continues from there on (in the standard case the next line would just be End Sub or End Function). Note, that dlg should be a global variable as it is propably used in not just one function. Best Regards Christian Junker Peter Eberlein wrote: Christian Junker schrieb: and I forgot: Once the macro has finsihed you call endExecute() on the dialog and it should return to the document again. Christian, when the dialog is executed and shown on the screen, the macro stops (sleeps) at this point until the user triggers any event (pushs a button), doesn't it? That means, the user must trigger the main function (disabling the dialog, showing the progress bar, doing all the other things and ending execute the dialog). But that's not what Christian Anderson wanted. Peter - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
[api-dev] small problem with starbasic in OOo 1.1.x
Hi there, I have a small problem with Starbasic in OOo that I wonder if there is any sollution to, or perheps a workaround for, I'm not sure this is a bug at all... anyway, I have a small starbasic script that will save the document locally and after that do some small updates to the document after it has been saved the problem I have is then the following 1: the document is beeing saved by the script, this takes a while for big documents 2: the user tries to close the document whil it is beeing saved (nothing will happen at this stage since the document is under saving) 3: the document has now been saved and the document is beeing closed (since the user pressed the close button) 4: my scripts tries to modify the document but encounters errors since the document is no longer opened. well that is in short what happens Is there some way that I can (in script or config) tell OOo to not close the document before the script has finished /Christian Andersson - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [api-dev] small problem with starbasic in OOo 1.1.x
Hi christian, Is there some way that I can (in script or config) tell OOo to not close the document before the script has finished i see 2 ways : - declaring a listener on the document closing event. Don't sure it suites totally your nee - lock OOo until your script has finished ThisComponent.lockControllers - save - modify ThisComponent.unlockController Then the user won't be able to close the document has the GUI is frozen for user interactions HTH laurent -- Laurent Godard [EMAIL PROTECTED] - Ingénierie OpenOffice.org Indesko http://www.indesko.com Nuxeo CPS http://www.nuxeo.com - http://www.cps-project.org Livre Programmation OpenOffice.org, Eyrolles 2004 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [api-dev] small problem with starbasic in OOo 1.1.x
I can only agree with Laurent, the second way by locking the controllers would be the best option, I think. That way you can be very sure that your macro gets executed from beginning to end without any disturbance. Best Regards Christian Junker Laurent Godard wrote: Hi christian, Is there some way that I can (in script or config) tell OOo to not close the document before the script has finished i see 2 ways : - declaring a listener on the document closing event. Don't sure it suites totally your nee - lock OOo until your script has finished ThisComponent.lockControllers - save - modify ThisComponent.unlockController Then the user won't be able to close the document has the GUI is frozen for user interactions HTH laurent - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [api-dev] small problem with starbasic in OOo 1.1.x
Hi Laurent, hi Christian, Laurent Godard schrieb: Hi, I can only agree with Laurent, the second way by locking the controllers would be the best option, I think. That way you can be very sure that your macro gets executed from beginning to end without any disturbance. for me this does not work like expected. LockControllers only disables writing into document and the toolbar buttons, not the menubar and shortkeys (1.9.74 WinNT). Peter - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]