[Calc] Statusbar, displaying text at the bottom

Shared Libraries
Forum rules
For sharing working examples of macros / scripts. These can be in any script language supported by OpenOffice.org [Basic, Python, Netbean] or as source code files in Java or C# even - but requires the actual source code listing. This section is not for asking questions about writing your own macros.
Post Reply
User avatar
onidarbe
Posts: 84
Joined: Thu Nov 29, 2007 8:03 pm
Location: Belgium, Mechelen

[Calc] Statusbar, displaying text at the bottom

Post by onidarbe »

Just to be able to add text to the statubar in Calc with OOoBasic. ;)

Code: Select all

sub main()
   sStatusBar "Start to display only this text"
   sStatusBar , " and add this text"
   sStatusBar , " and even add more text"
   sStatusBar  'This will clear and restore the StatusBar 
end sub

global vStatusBarText as string '=text that is been displayed on the statusbar
sub sStatusBar(optional vNewText, optional vAddText) 'set or add text to the statusbar, nothing = clear&reset it.
   if isError(vNewText) then
      if isError(vAddText) then 'clear statusbar
         vStatusBarText=""
      else 'add text to the previous statusbar
         vStatusBarText=vStatusBarText & vAddText 
      endif
   else
      if isError(vAddText) then 'use new text
         vStatusBarText=vNewText
      else 'use new text and add the other text as well
         vStatusBarText=vNewText & vAddText
      endif
   endif
   vStatusBarText=right(vStatusBarText,int(ThisComponent.CurrentController.VisibleArea.Width/150)) 'Select last part that could be displayed.
   if isNull(ThisComponent.CurrentController) then exit sub 'Because the last XEventListener-event can't be written to the statusbar, because it's no longer there!
   if vStatusBarText="" then 'reset statusbar
      ThisComponent.CurrentController.StatusIndicator.Reset
   else 'change the text in the statusbar
      ThisComponent.CurrentController.StatusIndicator.Start(vStatusBarText,0)
   endif
end sub
opensanta
Posts: 1
Joined: Sat Dec 27, 2008 1:28 pm

Re: Statusbar, displaying text at the bottom. Calc-OOoBasic

Post by opensanta »

the statusbar can show some info now, thanks fro your codes. :lol:
love openoffice for everyone
OOo 2.3.X on openSuse 11
Post Reply