On 2010-12-21 10:52, imacat wrote:
Zindy Minshava said:
I am creating an add-on for OpenOffice Writer in java. In my application I have 
the need to refresh the text displayed in a GUI on a time basis manner.
Do I need to use separate thread for my add- on to achieve this? Or how can I 
achieve these idle time intervals without effecting the Writer application?
     I do not think you can do this.  OpenOffice.org extension is not
running in a thread-safe environment.

Hmmm... code like below runs OK in Calc allowing you to continue your work while the counter ticks in an open dialog window. So I guess that you could see how Wait() is implemented - it reschedules the Basic code so the UI is responsive. Or if callback timers are available in Java ? Check e.g. the section "Special Behavior of OpenOffice.org Basic" (around page 50) in

http://wiki.services.openoffice.org/w/images/8/8f/DevelopersGuide_OOo3.1.0_11OOoBasic.odt


<Dialog1 is a dialog with a single Label field called "Label1">

Global Dlg As Variant

Sub Main
  Dlg = CreateUnoDialog(DialogLibraries.Standard.Dialog1)

  Dlg.Model.Label1.Label = "Hey"

  Dlg.SetVisible(True)

  Dim I As Integer
  For I = 1 to 20
    Dlg.Model.Label1.Label = I
    Wait 1000
  Next I
End Sub

Cheers
-- Jan

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@openoffice.org
For additional commands, e-mail: dev-h...@openoffice.org

Reply via email to