Displaying interface elements in a form

Hello, I have a database whose forms have a clean interface; apart from the elements necessary for data entry, only the navigation bar is displayed and used for its very great utility, including the addition and deletion of records and the very complete LOBase search function.

I’m using a very well designed macro that I found on this site or maybe another site that I had to do very little to adapt to my needs.

However, I would like from this macro to be able to make the statusbar appear at the bottom of the form below the navigation bar. In fact, the only thing that interests me about this status bar is the zoom factor which on occasion can be very handy.

I tried to modify the conditional part of this macro in a different way using the “private:resource/$type/$name” syntax, but without success. I know that XLayoutManager.idl is essential to achieve the display of this one and that statusbar is one of the five elements or types defined. Not being a programmer, it is not easy to achieve a result with such complex functions.

See this link for details related to XLayoutManager: LibreOffice: XLayoutManager Interface Reference

So, can someone give me a solution so that the navigation bar and the was bar are both visible? Here is the procedure used:


Sub HideSomeMenuToolbars
   Dim oCurrentController as Object
   Dim oLayoutManager as Object
   Dim oElements as Object
   Dim oXUIElement As Object
   Dim iStart As Integer
   Dim iEnd As Integer
   Dim x As Integer
   Dim sResourceURL As String
   
' If Design mode, just exit the routine and display standard menu and toolbars
   oCurrentController = thisComponent.CurrentController
   If oCurrentController.isFormDesignMode Then
      ExitSub
   End If
   oLayoutManager = thisComponent.CurrentController.Frame.LayoutManager
'xLayoutManager.visible=false
   oElements = oLayoutManager.getElements()
   iStart = LBound(oElements)
   iEnd = UBound(oElements)
   For x = iStart to iEnd
      oXUIElement = oElements(x)
      sResourceURL = oXUIElement.ResourceURL
      If sResourceURL <> "private:resource/toolbar/formsnavigationbar" Then
          oLayoutManager.hideElement(sResourceURL)
      End If
   next
End Sub

Renel

Remark. Replacing EndIf with End If (3rd line from the bottom) will improve the display of your macro in the forum.

Statusbar you will get with

"private:resource/statusbar/statusbar"

Zoom you could set with

 ThisComponent.CurrentController.ViewSettings.ZoomValue = 100

You could also set zoom to the maximum your form would allow:

 oFrame = oEvent.Source.CurrentController.Frame
 oWin = oFrame.getContainerWindow()
 oWin.IsMaximized = true
 ' Screenshot with all element of the form: 1487*765
 ' 96 dpi of monitor is 3779 PixelPerMeter
 inx = Int(oWin.Info.Width * 100 * 3779 / (1487 * oWin.Info.PixelPerMeterX))
 iny = Int(oWin.Info.Height * 100 * 3779 / (765 * oWin.Info.PixelPerMeterY))
 IF inx < iny THEN
 inZoom = inx
 ELSE
 inZoom = iny
 END IF
 ThisComponent.CurrentController.ViewSettings.ZoomValue = inZoom

RogerG,

It’s nice of you to take the time to offer me a possible solution. This isn’t quite the solution I’m looking for, but I believe it might be useful to me. Actually, I’m just looking for a way to show the status bar at the bottom of the form. However, what you suggest might fix a problem I’m having with Base and displaying my database forms.

With LibreOffice, if you modify the zoom function in Writer or Calc, Base is automatically affected. DB forms will open with the Zoom setting made in them.

Although what you proposed does not correspond to what I am looking for, I can still force my form to open with a Zoom preset. I’ll give it a shot and if it works, I may no longer see the need to show the status bar when the form opens.

And this is the solution:

Replace

If sResourceURL <> "private:resource/toolbar/formsnavigationbar" Then

by

If sResourceURL <> "private:resource/toolbar/formsnavigationbar" AND sResourceURL <> "private:resource/statusbar/statusbar" Then

For zoom have a look at the Base Guide. It will work like I described. Include The line for zoom at the end of your procedure.

RobertG,

The zoom code line you gave me works great. Even though I zoom to 150% in Writer, when I open my DB forms, it zooms to 100%. Very functional and for the moment I can be satisfied with that.

However, I tried the proposed solution with the line of code to replace in the HideSomeMenuToolbars procedure - If sResourceURL… - and it still doesn’t work, the status bar stays invisible.

For now, being able to set a zoom percentage when opening a form suits me. Don’t waste time with this. Thank you so much.

Hello,
The routine you use is not designed to turn on items not currently in view. This appears to be the reason it is not working for you. It is only to turn off, with exception, items not wanted on.
.
To insure the status bar is on, at the end of your posted code and just before End Sub, add the following lines:

document   = ThisComponent.CurrentController.Frame
dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
dispatcher.executeDispatch(document, ".uno:StatusBarVisible", "", 0, Array())
oLayoutManager.showElement("private:resource/statusbar/statusbar")

This is a toggle so if on the dispatch command will turn off. The showElement makes it visible again.
.
Using showElement alone is not viable as it will not work if the status bar is off to start with - needs LO to re-start. Can do with a macro command but the above requires no restart.

Rastlinger,

You have definitely fixed this status bar display problem. You are also absolutely right about the procedure I use to make all menu bars invisible except the navigation bar. That’s exactly what it does. I thought that RobertG gave me a viable solution with the fact of adding as exceptions the navigation bar and the status bar, but unfortunately it did not work. However the routine linked to the zoom preset that he proposed to me works very well.

However, with the lines of code that you offer me, it allows to have the status bar in sight and if for one reason or another, I need to adjust the zoom, the adjustment bar of the zoom is at my fingertips.

Thank you very much, I am very grateful to you both.

@Renel
.
Please note that when you are cross-posting (same question, multiple locations) provide an applicable link to each. This will eliminate duplicate effort as one or the other post may have a solution not known to someone else working on the question.
.
Thank You

Sorry! I will remedy the situation and for the next times I will only post in English, because the pool of users seems to be larger.