How to get type of controls in a form / dialog

Creating and using forms
Post Reply
Calmhey
Posts: 38
Joined: Tue Apr 15, 2008 11:50 am

How to get type of controls in a form / dialog

Post by Calmhey »

I can get the names of tables, queries, forms and reports from a database context but I need to go one level down particularly with forms.

I want to get the data that is in the control so that I can use it to update transactions but each control has different attributes and I cannot find out what type each control is - i.e. is it a button, a text field, a listbox etc etc. The following works ............... so far

Sub Enumerate_Database_Forms
Dim Context As Object
Dim DB As Object
Dim FormDoc as Object
Dim Connection As Object
Dim NumControls as Integer
Dim iCount as integer

Context=CreateUnoService("com.sun.star.sdb.DatabaseContext")
DB=Context.getByName("HERBS") ' my database name
Connection=DB.getConnection("","")

FormDoc=DB.DatabaseDocument.FormDocuments()

sMyMess = FormDoc.Count
sMyMess = sMyMess + " Forms"
MsgBox sMyMess

NumControls = FormDoc.Count()
For iCount = 0 To NumControls -1
MsgBox FormDoc(iCount).Name ' I need to iterate the controls here for each form to see what they are
Next
End Sub

Any help would be appreciated.

David
QuazzieEvil
Volunteer
Posts: 283
Joined: Tue Dec 04, 2007 6:38 pm
Location: Houston, TX

Re: How to get type of controls in a form / dialog

Post by QuazzieEvil »

you can check the ImplementationName property of the control. For example, the implementation name for a label is com.sun.star.comp.forms.OFixedTextModel
Néstor Londoño B.
Posts: 3
Joined: Thu Jun 12, 2008 6:42 pm

Re: How to get type of controls in a form / dialog

Post by Néstor Londoño B. »

Ha intentado:
Shape = Doc.DrawPage (i)
Campo = Shape.Control.Name
´Obtiene el texto que está en el control
Shape.Control.Text = "Su Texto" 'En forma de texto se visualiza en el formulario y en
'en la impresión o se carga el control de datos
OOo 2.3.X on Ms Windows XP + Ubuntu3g+ds
Post Reply