openoffice-api mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mathias Röllig <>
Subject Re: macro crash problem
Date Tue, 05 May 2015 14:25:03 GMT
> Actually i have a listbox in dialog , Listbox have 2 items. when i click item,
> it opens the odt file. when i show dialog and click many times on listbox items
> program crashed.

Depends it only on the amount of clicks or also on its speed?
Do you change the window between clicks?
Do you use Option Explicit?

Please try to hold the frame in a global variable:

'for show dialog

Option Explicit
Private document as object
Private oListBox As Object
Private strDosyaIsim(1) As String
Private strDosyaYol(1) As String

Sub ShowOdtDialog()
       Dim Dlg As Object
       Dim i As Integer
       strDosyaIsim(0) = "CREDITS"
       strDosyaYol(0) = 

       strDosyaIsim(1) = "LICENSE"
       strDosyaYol(1) = 

       Dlg = CreateUnoDialog(DialogLibraries.Standard.showOdt)
       oListBox = Dlg.getControl("listOdt")

       For i=0 to Ubound(strDosyaIsim())
            oListBox.addItem(strDosyaIsim(i), i)
       next i
       document = ThisComponent.CurrentController.Frame
End Sub

'for select item

Sub OpenOdt()
       Dim Props() As New
document.loadComponentFromURL(strDosyaYol(oListBox.getSelectedItemPos()), "_self", 
0, Props())
End Sub

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message