Re: Are you bound to a GUI control?
Drew Jensen <[email protected]> Fri, 12 Feb 2010 13:27:44 -0500
| Newsgroups | gmane.comp.openoffice.dba.user |
|---|---|
| Message-ID | <[email protected]> |
On 2/12/2010 10:38 AM, Frank Schoenheit, Sun Microsystems Germany wrote: > Hi Drew, > >> That question is - how do I answer that question? >> ... >> Is there a way with the api now to do that? > > Only by traversing the hierarchy of form components (starting with the > object delivered by getForms()), and checking on each element whether it > a) is a container, in which case you need to step down or b) has a > BoundField property, in which case you need to compare with what you're > looking for. > Howdy Frank, And in there is a problem - performance. In fact I cam very close to opening an issue on this - still might. Traversing the GUI controls is incredibly expensive is seems. For example taking a simple form (the form created from the Getting Started with Base section of the OO.o Getting Started Guide) with 35 controls on the main form. Then add a button and call this code: Sub Main( oEv as object ) dim cntr dim oDataForm dim CurrentControl dim sTime dim eTime oDataForm = oEv.Source.Model.Parent sTime = now() for cntr = 0 to uBound(oDataForm.ControlModels) CurrentControl = oDataForm.ControlModels(cntr) next eTime = now() print eTime - sTime *********************************************** sTime = now() for cntr = 0 to oDataForm.Columns.count -1 CurrentControl = oDataForm.Columns(cntr) next eTime = now() print etime - stime End Sub The first value is, on my XP machine, ~3.47 seconds The second value printed is 0 (too small to count) That is a problem IMO. Drew