Problem when closing a dialog and trying to open a new dialog

Good Morning,

I am making an application which requires opening a dialog. After entering proper data in the dialog, it should close the dialog (which i close using endExecute) and open a new dialog. Closing the first dialog is successful. However, when I try to open the second dialog, LO freezes. Here is the LO information:

Version: 7.4.2.3 (x86) / LibreOffice Community
Build ID: 382eef1f22670f7f4118c8c2dd222ec7ad009daf
CPU threads: 8; OS: Windows 10.0 Build 19044; UI render: Skia/Raster; VCL: win
Locale: en-US (en_US); UI: en-US
Calc: CL

Good afternoon,
I regularly work with dialogues and do not observe such an effect. Please upload an example of the problematic file and a description of the user’s actions leading to the problem.

The same configuration.

1 Like

The execute() method returns 1 in when a button of type “OK Button” has been pressed and 0 when a button of type “Cancel Button” has been pressed or when the user hit Enter/Escape respectively.

x = oDlg.execute()
  if x = 1 then 
  evaluate_Dialog1(oDlg)
  oDlg2 = load_next_Dlg
  x = oDlg2.execute()
endif
1 Like

loop_dialog.odt (13.1 KB)
hope this helps.

1 Like

i will check on this. thank you very much for your assistance. I have not looked at this, but just as a FYI. i am writing my code in Python.

The sample is written in Python embedded in the document.

1 Like

This example crashes.I have code which connects to personal oracle. Anyone is free to mod this in any way. I would appreciate a way to prevent crashing. Thank you.

TEST_ODS.odb (5.0 KB)

FYI. when the file is opened, a dialog box appears. there are three buttons. the action event of the “Exit” button is what causes the crash.

You don’t need to implement a log-in dialog.
menu.Edit>Database>Conection… Requires Login = ON

I know. I am just using that as an example. The problem is when i close a dialog LibreOffice crashes.

@ztminhas

Remove dispose:

def actionExit(evt:ActionEvent):
    lblResult.Text=str(evt)
    dlg.endExecute()
#    dlg.dispose()

So the other mistake I made was to dispose as soon as I executed the dialog. One should avoid using dispose unless necessary and I have no idea when that use case would be appropriate

In 20 years I never called dispose. I remember some code snippet where it was necessary but I forgot the context and the details.

1 Like