OpenOffice.org Forum at OOoForum.orgThe OpenOffice.org Forum
 
 [Home]   [FAQ]   [Search]   [Memberlist]   [Usergroups]   [Register
 [Profile]   [Log in to check your private messages]   [Log in

How to update the status bar?
Goto page 1, 2  Next
 
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Macros and API
View previous topic :: View next topic  
Author Message
rdlsmith
General User
General User


Joined: 18 Oct 2008
Posts: 18
Location: Houston

PostPosted: Tue Oct 21, 2008 8:21 am    Post subject: How to update the status bar? Reply with quote

I'm using LotusScript (Basic) to automate opening a new calc document in Symphony from the notes client. So far so good as I can open, write, format and save the document.

What I don't know how to do is write/update the Status Bar in Symphony.

Here's how I'm getting to the calc application and worksheet:

Set SM=CreateObject("com.sun.star.ServiceManager")
Set Desktop=SM.createInstance("com.sun.star.frame.Desktop")
Set calcApplication = Desktop.loadComponentFromURL("private:factory/scalc","_blank",0, noArgs)
Set Worksheet=CalcApplication.Sheets.getByIndex(0)

Any ideas?
Back to top
View user's profile Send private message
rdlsmith
General User
General User


Joined: 18 Oct 2008
Posts: 18
Location: Houston

PostPosted: Tue Oct 21, 2008 1:07 pm    Post subject: Reply with quote

I did find some more code example on this forum that look like they should work but nothing happens. That is, the status bar doesn't update.

Here's what I tried:

Dim controller As Variant
Set controller = calcApplication.CurrentController
Dim bar As Variant
Set bar = controller.StatusIndicator
Call bar.start("blah blah blah!", 0)
Call bar.setText("more blah blah blah and maybe even some yada yada yada")

There were no errors. The objects were created but I couldn't inspect them. I'm using LotusScript but that should be the same as Visual Basic except for things like Object vs. Variant etc.

It must be something really simple or I would have found many more posts asking about it.

Please respond if you know the answer.

Thanks
Back to top
View user's profile Send private message
rdlsmith
General User
General User


Joined: 18 Oct 2008
Posts: 18
Location: Houston

PostPosted: Fri Oct 24, 2008 8:06 am    Post subject: Reply with quote

Anyone?

There has to be a way to update the status bar via a Visual Basic program.
Back to top
View user's profile Send private message
B Marcelly
Super User
Super User


Joined: 12 May 2004
Posts: 1414
Location: France

PostPosted: Fri Oct 24, 2008 9:38 pm    Post subject: Reply with quote

Hi,
On top of this page you have a link to the search function.
Did you search for statusbar in this forum section ?

Here is an answer, still valid.
Set Text in Status Bar OpenOffice 1.9.125
______
Bernard
Back to top
View user's profile Send private message Visit poster's website
jazzcat
General User
General User


Joined: 29 Sep 2005
Posts: 19

PostPosted: Sat Oct 25, 2008 11:57 pm    Post subject: Reply with quote

B Marcelly wrote:

Here is an answer, still valid.
Set Text in Status Bar OpenOffice 1.9.125


This does not address the following question.

On the statusbar of my OpenOffice, there are many fields. From left to right, there is "Page 1/1", then "Default", then "English (USA)", then "INSRT", etcetera.

I modified one of the GUI XML files to add a field to this bar; the new field is directly to the left of the page selector. I can see the field. How do I write something in this field so that it is always visible? I do not want a progress bar that disappears.
Back to top
View user's profile Send private message
rdlsmith
General User
General User


Joined: 18 Oct 2008
Posts: 18
Location: Houston

PostPosted: Sun Oct 26, 2008 6:11 pm    Post subject: Reply with quote

B Marcelly wrote:
Hi,
On top of this page you have a link to the search function.
Did you search for statusbar in this forum section ?

Here is an answer, still valid.
Set Text in Status Bar OpenOffice 1.9.125
______
Bernard


B Marcelly,

Thanks for writing a response. I have indeed used the search function and that link you gave me was one of the first things I tried. That's how I came up with the attempt you see in my second post.

I went back and tried the code again. Here's a more complete listing:

Dim sm As Variant
Dim desktop As Variant
Dim calcApp As Variant
Dim controller As Variant
Dim bar As Variant

Dim noArgs() As Variant

Set sm=CreateObject("com.sun.star.ServiceManager")
Set desktop=sm.createInstance("com.sun.star.frame.Desktop")
Set calcApp = desktop.loadComponentFromURL("private:factory/scalc","_blank",0, noArgs)

Set controller = calcApp.CurrentController

Set bar = controller.StatusIndicator
Call bar.start("blah blah blah!", 0)
Call bar.setText("more blah blah blah and maybe even some yada yada yada")



Thanks.
Back to top
View user's profile Send private message
hanya
Super User
Super User


Joined: 04 May 2005
Posts: 543
Location: Japan

PostPosted: Sun Oct 26, 2008 7:59 pm    Post subject: Reply with quote

jazzcat wrote:
B Marcelly wrote:

Here is an answer, still valid.
Set Text in Status Bar OpenOffice 1.9.125


This does not address the following question.

On the statusbar of my OpenOffice, there are many fields. From left to right, there is "Page 1/1", then "Default", then "English (USA)", then "INSRT", etcetera.

I modified one of the GUI XML files to add a field to this bar; the new field is directly to the left of the page selector. I can see the field. How do I write something in this field so that it is always visible? I do not want a progress bar that disappears.

You need to implement own statusbar component, see:
http://wiki.services.openoffice.org/wiki/Framework/Tutorial/Statusbar_Controller
Back to top
View user's profile Send private message
rdlsmith
General User
General User


Joined: 18 Oct 2008
Posts: 18
Location: Houston

PostPosted: Mon Oct 27, 2008 12:03 pm    Post subject: Reply with quote

hanya wrote:
jazzcat wrote:
B Marcelly wrote:

Here is an answer, still valid.
Set Text in Status Bar OpenOffice 1.9.125


This does not address the following question.

On the statusbar of my OpenOffice, there are many fields. From left to right, there is "Page 1/1", then "Default", then "English (USA)", then "INSRT", etcetera.

I modified one of the GUI XML files to add a field to this bar; the new field is directly to the left of the page selector. I can see the field. How do I write something in this field so that it is always visible? I do not want a progress bar that disappears.

You need to implement own statusbar component, see:
http://wiki.services.openoffice.org/wiki/Framework/Tutorial/Statusbar_Controller



Can this be used to address the original question and intent of this thread? It seems like it is addressing a different matter from what I was asking about.
Back to top
View user's profile Send private message
probe1
Moderator
Moderator


Joined: 18 Aug 2004
Posts: 2465
Location: Chonburi Thailand Asia

PostPosted: Mon Oct 27, 2008 1:24 pm    Post subject: Reply with quote

jazzcat wrote:
I modified one of the GUI XML files

You have been hacking the config files and don't tell us what you did. How should we know how to help you?
_________________
Cheers
Winfried
My Macros
DateTime2 extension: insert date, time or timestamp, formatted to your needs
Back to top
View user's profile Send private message Visit poster's website
rdlsmith
General User
General User


Joined: 18 Oct 2008
Posts: 18
Location: Houston

PostPosted: Mon Oct 27, 2008 6:03 pm    Post subject: Reply with quote

probe1 wrote:
jazzcat wrote:
I modified one of the GUI XML files

You have been hacking the config files and don't tell us what you did. How should we know how to help you?



I just want to write to the Status Bar. I have code that I've included in this thread that I have tried. I need a Visual Basic example if possible. This should be stupid simple and yet, it has proven to be very difficult.

Thanks for any help.
Back to top
View user's profile Send private message
BrianS
General User
General User


Joined: 10 Jun 2008
Posts: 38

PostPosted: Tue Oct 28, 2008 5:38 am    Post subject: Reply with quote

rdlsmith wrote:
probe1 wrote:
jazzcat wrote:
I modified one of the GUI XML files

You have been hacking the config files and don't tell us what you did. How should we know how to help you?



I just want to write to the Status Bar. I have code that I've included in this thread that I have tried. I need a Visual Basic example if possible. This should be stupid simple and yet, it has proven to be very difficult.

Thanks for any help.


What are you actually needing to do with the status bar?

I know this isn't the status bar in OOo, but we needed a progress indicator in Notes client 7.0.2 because Calc is slower to load up a spreadsheet than Excel and we didn't want our users to think nothing was happening...

We are using this function to build a progress indicator for a spreadsheet build using the print area...

Code:

Function PerComplete(FTGDefault As Integer, FTGCurrent As Long, FTGTotal As Long) As String
%REM
Purpose: Displays a percent complete progress indicator in the print area at the bottom of users screen.
Calls: NewIndicator(),
%END REM
      Dim FTGLength As Integer
      Dim FTGCount As Integer
      If (FTGCurrent > FTGTotal) Then FTGCurrent = FTGTotal   'Just in case, don't allow it to go past 100%...
      PerComplete = NewIndicator(FTGDefault, FTGCurrent)
      FTGLength = (FTGCurrent*FTGDefault)/FTGTotal
      If FTGlength >0 Then
         For FTGcount = 2 To FTGlength +1
            Mid( PerComplete , FTGCount, 1) = Chr(127)
         Next FTGcount
      End If
      Mid (PerComplete,FTGDefault + 4,4)=Cstr(Cint((FTGCurrent/FTGTotal)*100)) + "%"
   End Function
   
   Function NewIndicator(FTGDefault As Integer, FTGCurrent As Long) As String
%REM
Purpose: Create a Blank Progress Indicator
%END REM
      Dim FTGCount As Integer
      NewIndicator = Chr(127)
      For FTGcount = 1 To FTGDefault
         NewIndicator = NewIndicator + "-"
      Next FTGCount
      NewIndicator = NewIndicator + Chr(127) + "     Building spreadsheet %  Complete..."
   End Function


We call it by:
Code:

Print PerComplete(50, currentCell, totalCellCount)


You could argue about using 50 as the default value, but it works pretty slick... I don't know if a progress indicator is what you had in mind, but I'm sure the code can be adapted if you're actually needing something in Notes/Symphony and not in the actual Calc document...
Back to top
View user's profile Send private message
hanya
Super User
Super User


Joined: 04 May 2005
Posts: 543
Location: Japan

PostPosted: Tue Oct 28, 2008 6:20 am    Post subject: Reply with quote

rdlsmith wrote:
I went back and tried the code again. Here's a more complete listing:

Dim sm As Variant
Dim desktop As Variant
Dim calcApp As Variant
Dim controller As Variant
Dim bar As Variant

Dim noArgs() As Variant

Set sm=CreateObject("com.sun.star.ServiceManager")
Set desktop=sm.createInstance("com.sun.star.frame.Desktop")
Set calcApp = desktop.loadComponentFromURL("private:factory/scalc","_blank",0, noArgs)

Set controller = calcApp.CurrentController

Set bar = controller.StatusIndicator
Call bar.start("blah blah blah!", 0)
Call bar.setText("more blah blah blah and maybe even some yada yada yada")

It works with OOo 2.4.1 via OLE. So, I think your problem related to Symphony.
Back to top
View user's profile Send private message
rdlsmith
General User
General User


Joined: 18 Oct 2008
Posts: 18
Location: Houston

PostPosted: Wed Oct 29, 2008 7:47 pm    Post subject: Reply with quote

"What are you actually needing to do with the status bar? "


I'm taking data from a Notes DB and building a Calc worksheet. The writing of the data to the worksheet is so slow I wanted to write to the Status Bar something like:

"Now processing document 1 of 110, you might as well go get coffee."

Or maybe something close to that.

What I'm doing instead is opening up a second Worksheet and writing all the status information to that along with a message of "Please do not close or ... blah blah blah this the calc program..."

It is just so hackish. I think the Status Bar is probably a better solution as it is more like the Excel Export process we have but there may not be another choice.

Thanks for your help anyway.
Back to top
View user's profile Send private message
BrianS
General User
General User


Joined: 10 Jun 2008
Posts: 38

PostPosted: Thu Oct 30, 2008 4:51 am    Post subject: Reply with quote

rdlsmith wrote:
"What are you actually needing to do with the status bar? "


I'm taking data from a Notes DB and building a Calc worksheet. The writing of the data to the worksheet is so slow I wanted to write to the Status Bar something like:

"Now processing document 1 of 110, you might as well go get coffee."

Or maybe something close to that.

What I'm doing instead is opening up a second Worksheet and writing all the status information to that along with a message of "Please do not close or ... blah blah blah this the calc program..."

It is just so hackish. I think the Status Bar is probably a better solution as it is more like the Excel Export process we have but there may not be another choice.

Thanks for your help anyway.


That is exactly what we're doing, but I don't even display Calc to the user until the spreadsheet has been fully rendered. The code I gave you works just fine for doing that. Once it is loaded, you make Calc visible and the user is then free to do whatever...

Code:

   Sub MakeVisible()
      ' Get some other parts of the document.
      Set oDocCtrl = objDocument.getCurrentController()
      Set oDocFrame = oDocCtrl.getFrame()
      Set oDocWindow =  oDocFrame.getContainerWindow()
      oDocWindow.setVisible( True )
   End Sub


I think the best route is to use what I gave you for putting the status in the print area in the Notes client, keep Calc hidden, then call the MakeVisible routine I just pasted above...
Back to top
View user's profile Send private message
rdlsmith
General User
General User


Joined: 18 Oct 2008
Posts: 18
Location: Houston

PostPosted: Thu Oct 30, 2008 1:39 pm    Post subject: Reply with quote

BrianS wrote:
rdlsmith wrote:
"What are you actually needing to do with the status bar? "


I'm taking data from a Notes DB and building a Calc worksheet. The writing of the data to the worksheet is so slow I wanted to write to the Status Bar something like:

"Now processing document 1 of 110, you might as well go get coffee."

Or maybe something close to that.

What I'm doing instead is opening up a second Worksheet and writing all the status information to that along with a message of "Please do not close or ... blah blah blah this the calc program..."

It is just so hackish. I think the Status Bar is probably a better solution as it is more like the Excel Export process we have but there may not be another choice.

Thanks for your help anyway.


That is exactly what we're doing, but I don't even display Calc to the user until the spreadsheet has been fully rendered. The code I gave you works just fine for doing that. Once it is loaded, you make Calc visible and the user is then free to do whatever...

Code:

   Sub MakeVisible()
      ' Get some other parts of the document.
      Set oDocCtrl = objDocument.getCurrentController()
      Set oDocFrame = oDocCtrl.getFrame()
      Set oDocWindow =  oDocFrame.getContainerWindow()
      oDocWindow.setVisible( True )
   End Sub


I think the best route is to use what I gave you for putting the status in the print area in the Notes client, keep Calc hidden, then call the MakeVisible routine I just pasted above...


That helped. A step in the right direction.

I was able to hide the worksheet, write to it and display.

I still get the outline of the calc application though which is on top of the Notes Client so the user has no idea what is going on. I even used the the code to hide the application and it still showed up.

Set Reflection= sm.createInstance("com.sun.star.reflection.CoreReflection")
Set args(0) = exportCreatePropertyStruct("com.sun.star.beans.PropertyValue", Reflection)
args(0).Name = "Hidden"
args(0).Value = True

Then pass the args in when loading.


Here's how I got the worksheet to hide/show:

Dim controller As Variant
Set controller = calcApp.CurrentController
Dim oDocWindow As Variant
Set oDocWindow = controller.Frame.ContainerWindow()
oDocWindow.setVisible( False )


Set sheet=CalcApp.Sheets.getByIndex(0) ' this works regardless of what IBM decides to call their default worksheet
Call sheet.setName("Export")
Set cell = sheet.getCellByPosition(0,0) ' zero based: col, row
Call cell.setString("Hello World!")
Set cell = sheet.getCellByPosition(0,1) ' zero based: col, row
Call cell.setString("row 2")
Set cell = sheet.getCellByPosition(0,2) ' zero based: col, row
Call cell.setString("row 3")

oDocWindow.setVisible( True )


Which is very cool to know how to do.


Not sure I understand your progress bar thing. Where exactly are you showing that? Isn't that OOo basic your using?

Thanks for your contribution to this thread.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Macros and API All times are GMT - 8 Hours
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group