Re: macro crash problem
Thanks for answer. But i need open url in current swriter not blank page. so _blank is not suitable for me. On 5.5.2015 11:05, Salva open-office.es wrote: Hi Function OpenDoc( cPathFile As String ) As Object '--- - cPathFile = ConvertToURL(cPathFile) OpenDoc = StarDesktop.LoadComponentFromURL(cPathFile, _blank, 0, Array() ) End Function SLV-es Administrador de open-office.es Administrador del Foro Oficial en Español de Apache OpenOffice Síguenos enFacebookTwitterTuentiGoogle+ identi.ca -Original Message- From: Engin Oz [mailto:o.engi...@gmail.com] Sent: Monday, May 04, 2015 1:20 PM To: api@openoffice.apache.org Subject: macro crash problem When i run this macro 4 or 5 times application crash and close? what can i do for this problem. dim documentasobject Dim Props(0) As New com.sun.star.beans.PropertyValue document = ThisComponent.CurrentController.Frame document.loadComponentFromURL( ConvertToURL(strDosyaYol(oListBox.getSelectedItemPos())), _self, 0, Props() ) - To unsubscribe, e-mail: api-unsubscr...@openoffice.apache.org For additional commands, e-mail: api-h...@openoffice.apache.org --- El software de antivirus Avast ha analizado este correo electrónico en busca de virus. http://www.avast.com - To unsubscribe, e-mail: api-unsubscr...@openoffice.apache.org For additional commands, e-mail: api-h...@openoffice.apache.org - To unsubscribe, e-mail: api-unsubscr...@openoffice.apache.org For additional commands, e-mail: api-h...@openoffice.apache.org
Re: macro crash problem
When i run this macro 4 or 5 times application crash and close? what can i do for this problem. dim documentasobject 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
Re: macro crash problem
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 documentasobject 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 documentasobject 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
Re: macro crash problem
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