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) = ConvertToURL("C:\SINERJIGROUP\YENIICRA\app\LibreOffice\CREDITS.odt")

      strDosyaIsim(1) = "LICENSE"
strDosyaYol(1) = ConvertToURL("C:\SINERJIGROUP\YENIICRA\app\LibreOffice\LICENSE.odt")

      DialogLibraries.LoadLibrary("Standard")
      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
      Dlg.Execute()
      Dlg.dispose()
End Sub

'for select item

Sub OpenOdt()
      Dim Props() As New com.sun.star.beans.PropertyValue

document.loadComponentFromURL(strDosyaYol(oListBox.getSelectedItemPos()), "_self", 0, Props())
End Sub


---------------------------------------------------------------------
To unsubscribe, e-mail: api-unsubscr...@openoffice.apache.org
For additional commands, e-mail: api-h...@openoffice.apache.org

Reply via email to