Created attachment 117013 [details] Just open the Form TryMe ,then push the Push Me button. When I try to get one of four Forms,using GetByName method,it always returns the first Form(see the macro for details).
Hi vlad, Thanks for your post, but I think the macro is not correct. Please try the following: Sub Main Dim oForm As Object Dim n% 'Globalscope.BasicLibraries.LoadLibrary("XrayTool") 'xray ThisComponent.DrawPage.Forms For n = 0 to ThisComponent.DrawPage.Forms.Count -1 oForm=ThisComponent.DrawPage.Forms.getByIndex(n) '(oFormName) MsgBox "The value of oFormName const is - " & oFormName & Chr(13) &_ "The name of getting form is -" & oForm.Name Next End Sub I set this as worksForMe. Regards, Cor
Hi vlad, We only set to Fixed if we know what commit fixed it... So unless you know, we must set as WorksForMe. Thanks for replying. Cor
Ok,very well.The problem is not the method GetByName(it works nice),but ..mmm..to get by name from a collection.If we have something like: ThisComponent.Sheets.GetByName("MySheetName") it returns the sheet "MySheetName",ok? It is possible to take this sheet using the collections form,like ThisComponent.Sheets("MySheetName"),because Sheets() is a collection of these values,you can access a value using the index,like your example,or using the name,like main. So,in my example I have used the name-call method,and it not works,because returned always the same Form,the first one. The method GetByName works fine: ThisComponent.DrawPage.Forms.GetByName("NameOfForm") not work(for me ) the name-call method of collection: ThisComponent.DrawPage.Forms("NameOfForm") -------------------------------------------------------- I am not good in explanation and I do not know how to make a correct bug name.
Hi Vlad, I seldom work with those forms, so should study it a bit to get a possible problem. Better is to ask it a ask.libreoffice.org or the users list, where there will be people that work in this area a lot. Anyway glad that you have a working solution now :) Cheers