Problem solved (well at least under way). Posted because it might help someone else. Listing 15 in AndrewBase.pdf gets the control objects that are grouped (ie within shapes). Control items not in shapes are found in the second part of the if statement if the Elseif condition is removed. Once found by index, the control names are available and the naming conventions used by the Base forms wizard can be understood. The names assigned are not those shown in the property sheet for the (ungrouped) control..

Modified listing 15  is:

sGroupShape = "com.sun.star.drawing.GroupShape"
sControlShape = "com.sun.star.drawing.ControlShape"
oDrawPage = ThisComponent.getDrawPage()
For i = 0 To oDrawPage.getCount() - 1
oShape = oDrawpage.getByIndex(i)
If oShape.supportsService(sGroupShape) Then
REM The group shape supports the methods getCount()
REM and getByIndex() to obtain the contained shapes.
REM You should probably use a recursive routine to
REM extract the shapes, because the contained shape
REM may be another group shape.
For j = 0 To oShape.getCount() -1
o=oShape.getByIndex(j)
print o.control.name
Next
Else
print oshape.control.name
End If
Next


Jim Gardner
Jim Gardner wrote:
OK found the form name from the properties page.
Then:
oObj=ThisComponent.DrawPage.GetForms()
oForm=oObj.getbyName("MainForm") 'index(0) also works on GetByIndex
print oForm.name  'verifies all is OK
o=findform(oForm,"txtTest")


According to AndrewBase.odt, the findform function should find all the controls on a form if the input is a form. The routine does find the form "MainForm" if the input object is set to the DrawPage. But at runtime, the above fails on the findform line with the message "Object variable not set" at the calling stage (breakpoint set on the line).

Any thoughts?
Cheers,
Jim Gardner

Andrew Douglas Pitonyak wrote:
Jim Gardner wrote:
Hi:
First posting. Reasonable experience in VBA and Microsoft Office, now migrating to OOo to avoid those continual upgrade problems with different versions of Access. Bit of a steep learning curve with plenty of Googling. Successful reprogramming of an Excel application to Calc. Currently want to migrate from Access to OOoBase. The problem: I have a form "test" generated by the Wizard, showing the database fields. I want a mouse leaving event to make other controls visible/non visible, but to do that I need the control and form objects. Andrew Pityonak's book was very helpful for Calc but doesn't cover Base and I can't find code examples for this on the web. I've tried the code examples in AndrewBase.odt for getting controls and forms by name using the form name "test" and the names of the controls on the form layout (after ungrouping the label and control) but the return is always empty. I'm probably missing something in the application object name. Any help appreciated.
Cheers,
Jim Gardner
Try this:

http://www.pitonyak.org/database/

or, more specifically,

http://www.pitonyak.org/database/AndrewBase.odt

It is not really the best document for forms, but it at least discusses a few things about them (such as how to obtain controls and such).

http://www.oooforum.org/forum/viewforum.phtml?f=10

Look at the sticky posts near the top!

We are in the "talking" stage with respect to Base documentation at the authors web site. That said, I believe that there is a chapter on "Using Forms in Writer" that may be at least somewhat applicable, but I have not read it.

http://documentation.openoffice.org/manuals/oooauthors2/index.html


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to