Turn on Form Naviagtion Bar with macro

Creating and using forms
Post Reply
gtv625
Posts: 18
Joined: Mon Dec 15, 2008 4:16 pm
Location: Kukljica, Croatia

Turn on Form Naviagtion Bar with macro

Post by gtv625 »

hi,
with this macro i can toggle off Form Design and Form Controls bars but the Form Navigation bar is not showing

Code: Select all

Public Sub InitToolbars 
   Dim oComponent as Object 
   Dim oFrame As Object 
   Dim oLayoutManager As Object 
   Dim oController as Object 
   Set oComponent = ThisComponent    
   Set oController = ThisComponent.CurrentController  
   Set oFrame = ThisComponent.CurrentController.Frame 
   Set oLayoutManager = oFrame.LayoutManager 
     
   oLayoutManager.ShowElement("private:resource/toolbar/formsnavigationbar") 
   oLayoutManager.HideElement("private:resource/toolbar/formdesign")
   oLayoutManager.HideElement("private:resource/toolbar/formcontrols")
 End Sub 
OOo 3.0.X on Ms Windows XP
User avatar
Villeroy
Volunteer
Posts: 31345
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: turn on Form Naviagtion Bar with macro

Post by Villeroy »

The visibility and scope of that bar is handled by the form, I believe.
http://api.openoffice.org/docs/common/r ... ionBarMode
http://api.openoffice.org/docs/common/r ... rMode.html
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
gtv625
Posts: 18
Joined: Mon Dec 15, 2008 4:16 pm
Location: Kukljica, Croatia

Re: Turn on Form Naviagtion Bar with macro

Post by gtv625 »

hi villeroy

on that toolbar that can be added inside form is missing find record function (binoculars icon) and without that i have to make my own functions to find record, just taught it will be nice to use that toolbar and i'm not sure is it possilble to configure whole oo to always display that toolbar?
that macro i found here http://www.oooforum.org/forum/viewtopic ... highlight=


vanja
OOo 3.0.X on Ms Windows XP
User avatar
Villeroy
Volunteer
Posts: 31345
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Turn on Form Naviagtion Bar with macro

Post by Villeroy »

This toolbar can be annoying with read-only forms, subforms and alike. This is why you can control it's visibility by means of a form-property.
gtv625 wrote:it possilble to configure whole oo to always display that toolbar?
How many forms do you design per day?
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
gtv625
Posts: 18
Joined: Mon Dec 15, 2008 4:16 pm
Location: Kukljica, Croatia

Re: Turn on Form Naviagtion Bar with macro

Post by gtv625 »

now i'm completly lost. i have two machines, both win xp service pack 3, OOo 3.00, same mainprocessors (even mainboards) and on first when i change form property navigation bar to yes nothing happens but until now i didn't tried this function that for my suprise is working fine.
on secod machine changing form property is behaveing just as expected but function not and on this machine i tested this function.
i'm using OOo as front end and the base engine is ms access
what it means?
Last edited by gtv625 on Thu Feb 26, 2009 4:06 pm, edited 1 time in total.
OOo 3.0.X on Ms Windows XP
User avatar
Villeroy
Volunteer
Posts: 31345
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Turn on Form Naviagtion Bar with macro

Post by Villeroy »

Are you shure that none of your macros interferes with the property? It works just fine for me. The toolbar pops up when I focus any control where the form has this property set and it disappears when I focus any subform where I disabled the toolbar.
Always use the form navigator (while in edit mode, button #5 on toolbar "Form Design"). Store the form document when closing from edit mode, store the database.
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
gtv625
Posts: 18
Joined: Mon Dec 15, 2008 4:16 pm
Location: Kukljica, Croatia

Re: Turn on Form Naviagtion Bar with macro

Post by gtv625 »

sorry i wasn't clear enaught
on first machine where i tried changing form properties without efect after your post i never tried macro before and macro is working.
on second machine where i started to test macro that macro still is not working but changing form properties toggle on and off bar as expected
OOo 3.0.X on Ms Windows XP
gtv625
Posts: 18
Joined: Mon Dec 15, 2008 4:16 pm
Location: Kukljica, Croatia

Re: Turn on Form Naviagtion Bar with macro

Post by gtv625 »

the answer why two machines are behaving differently is that on one of them i had installed SWITCHBOARD extension that is controling menu configuration so i ask the autor of that extension and he suggested me some possible changes in taht extension but i don't know how to make changes in extension and is it even possible?
OOo 3.0.X on Ms Windows XP
glj
Posts: 10
Joined: Fri Mar 06, 2009 1:25 am

Re: Turn on Form Naviagtion Bar with macro

Post by glj »

Have you found a way to make the changes to the Switchboard extension?
gtv625 wrote:the answer why two machines are behaving differently is that on one of them i had installed SWITCHBOARD extension that is controling menu configuration so i ask the autor of that extension and he suggested me some possible changes in taht extension but i don't know how to make changes in extension and is it even possible?
I, too, need the Find Record button the missing Form Navigation Bar would provide.

I tried to edit the Switchboard extension but found that its macros are read-only. In fact, all the macros in the OpenOffice.org library container are read-only. So as far as I can tell there is no way to edit the Switchboard extension. If anyone knows how to make those macros writable, please reply to this post. Thank you.
OOo 3.0.X on Ms Windows XP + Ubuntu
User avatar
Villeroy
Volunteer
Posts: 31345
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Turn on Form Naviagtion Bar with macro

Post by Villeroy »

The Basic modules are simple XML-files with file-suffix ".xba". On my system they reside in /opt/openoffice.org/basis3.0/share/basic/Tools where Tools is the directory of library "Tools". Side-note: Every module is registered in a "script.xlb" and every library is registered in ../script.xlc
The code is put in a single script-tag below the xml-declaration:

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd">
<script:module xmlns:script="http://openoffice.org/2000/script" script:name="Debug" script:language="StarBasic">
It is plain text with the usual XML-encoding for quotes, apostrophes, & < >

You must have installed the extension with admin-privileges into the installation directory rather than user-profile.
You could uninstall the extension, reinstall in your user-profile and edit the code in "My Macros" then.
But how to merge the edited code with the rest of the extension then? I don't know. I would try exporting the library as extension and then copy the rest from the original extension over to the edited one (we are talking about ordinary zip archives).
OK, so you could uninstall the thing, extract the extension file, edit the Basic code and repackage the extension.

Other scripting languages are by far easier to use than Basic.
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
glj
Posts: 10
Joined: Fri Mar 06, 2009 1:25 am

Re: Turn on Form Naviagtion Bar with macro

Post by glj »

Thanks for the prompt reply!
Villeroy wrote:You must have installed the extension with admin-privileges into the installation directory rather than user-profile.
I'm using WinXP Pro and always logon using an account with full administrator privileges. On my Windows system, the Switchboard .xba files are located at C:\Program Files\OpenOffice.org 3\share\uno_packages\cache\uno_packages\A.tmp_\Switchboard-1.0.6.oxt\SwitchBoard.

Opening Utils.xba (which is where the ShowWantedToolbars subroutine is located) with Notepad tells me right away that I can't edit it with a simple text editor. Opening Utils.xba with OOo Writer gives me a readable document, but if I edit it and save it will it be readable as an XML file for use by the Switchboard extension? (NEWBIE ALERT) What does one use to edit XML files?
OOo 3.0.X on Ms Windows XP + Ubuntu
glj
Posts: 10
Joined: Fri Mar 06, 2009 1:25 am

[SOLVED]Re: Turn on Form Naviagtion Bar with macro

Post by glj »

glj wrote:What does one use to edit XML files?
I answered my own question. I used OOo Writer to edit the Utils.xba file. I replaced the original code:

Code: Select all

Sub showWantedToolbars(Doc As Object,Allowed As Variant)
	Dim Frame As Object
	Dim Layout As Object
	Dim I As Integer	
	BubbleSort(Allowed)
	Frame=Doc.CurrentController.Frame
	Layout=Frame.LayoutManager
	For I=0 To UBound(Allowed)
		Layout.showElement( Allowed(I) )
	Next I
End Sub
with

Code: Select all

Sub showWantedToolbars(Doc As Object,Allowed As Variant)
	Dim Frame As Object
	Dim Layout As Object
	Dim I As Integer	
	Frame=Doc.CurrentController.Frame
	Layout=Frame.LayoutManager
	For I=0 To Ubound(Allowed)
		If IsNull( Layout.getElement(Allowed(I)) ) Then
			Layout.createElement(Allowed(I))
		End If
		Layout.showElement( Allowed(I) )
	Next I
End Sub
Credit for the code change goes to QuazzieEvil.

Now when using Switchboard to open forms, the forms open with the Form Navigation Bar including the Find Record button. That's just what I wanted.

Thanks for the help you guys. It is very much appreciated.
OOo 3.0.X on Ms Windows XP + Ubuntu
User avatar
Villeroy
Volunteer
Posts: 31345
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Turn on Form Naviagtion Bar with macro

Post by Villeroy »

glj wrote:I'm using WinXP Pro and always logon using an account with full administrator privileges.
glj wrote:Opening Utils.xba (which is where the ShowWantedToolbars subroutine is located) with Notepad tells me right away that I can't edit it with a simple text editor.
This sounds horrible and ridiculous at the same time and fits with other things I read in this forum. I will never ever install any Windows system anymore.
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
Post Reply