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.

for show dialog

Sub ShowOdtDialog()
    strDosyaIsim(0) = "CREDITS"
strDosyaYol(0) = "C:\SINERJIGROUP\YENIICRA\app\LibreOffice\CREDITS.odt"

    strDosyaIsim(1) = "LICENSE"
strDosyaYol(1) = "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
    Dlg.Execute()
    Dlg.dispose()
End Sub

for select item

Sub OpenOdt()

    dim document    as    object
    Dim Props(0)     As New com.sun.star.beans.PropertyValue
    document   = ThisComponent.CurrentController.Frame

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

End Sub




On 5.5.2015 15:36, Mathias Röllig wrote:
     When i run this macro 4 or 5 times application crash and close?
what can i do for this problem.

     dim document    as    object
     Dim Props(0)     As New com.sun.star.beans.PropertyValue
     document   = ThisComponent.CurrentController.Frame

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

How strDosyaYol() is defined? Please go step by step through the macro and look if oListBox.getSelectedItemPos() always give a defined value for strDosyaYol().

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


Reply via email to