[Solved] Main form at Startup

Creating and using forms

[Solved] Main form at Startup

Postby skylendar » Thu Sep 16, 2010 12:15 am

Hi there again, and thank you for reading and possibly answering this post.

When you double-click on the icon of an .odb file, ooo base is loaded and displays a main window with a left bar proposing accesses to the available tables, requests, forms and reports, a central bar with tasks etc...

So far nothing new, but I'd like to replace this main window at startup by a form designed by me with buttons for the various tasks proposed to the users; the form itself isn't the problem, of course.

Just point out on the doc or wiki (if it is possible, obviously !) the section regarding this issue.

Thanks in advance for answering.
Last edited by Hagar Delest on Sat Sep 18, 2010 1:20 am, edited 1 time in total.
Reason: tagged [Solved].
OpenOffice 3.2.0.9 on Linux 2.6.33
skylendar
 
Posts: 26
Joined: Thu Sep 02, 2010 6:46 pm

Re: Main form at Startup

Postby Villeroy » Thu Sep 16, 2010 12:24 am

Store your form as an ordinary Writer document, reconnect the forms and subforms and load them read-only (swriter -view form.odt) or make the file read-only.
Now you can use desktop links, hyperlinks between form documents and you can connect forms and subforms with different databases.
http://www.oooforum.org/forum/viewtopic ... ht=#390528
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04, no OpenOffice, LibreOffice 6.x
User avatar
Villeroy
Volunteer
 
Posts: 26730
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Main form at Startup

Postby skylendar » Thu Sep 16, 2010 4:05 pm

Mmmh, this operation seems to me still unclear.

Ok, I created an .odt file with a form containing only 1 button. I recall the odt file with oowriter, then I select Display->Datasources. There, I choose my db file and a table.

So far, I suppose that my form is connected with my db, but how to attribute a basic script to my button ? I can click on it, but can't display its controls.

Thanks beforehand for reading and answering my post.
OpenOffice 3.2.0.9 on Linux 2.6.33
skylendar
 
Posts: 26
Joined: Thu Sep 02, 2010 6:46 pm

Re: Main form at Startup

Postby Villeroy » Thu Sep 16, 2010 6:50 pm

Edit the form.
View>Toolbars>Form Design
This is the most important toolbar when you want to edit or design a form.
Button #5 reveals the whole hierarchy of forms and subforms within the embedding form document. The form wizzard creates form skeletons at best.
viewtopic.php?f=39&t=11228&p=52666#p52666
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04, no OpenOffice, LibreOffice 6.x
User avatar
Villeroy
Volunteer
 
Posts: 26730
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Main form at Startup

Postby skylendar » Fri Sep 17, 2010 12:03 am

Ok, I got that and was able to create a form with a button calling a BASIC script, but the issue is still fuzzy to me.

Do you suggest me to save all my forms in .odt files, then to reassociate them with a table or a request ? :?

The main form that I wish to create doesn't need any direct connexion with the db. It just displays buttons or icons which would show up a form or report stored within my .odb database file. with an API such as StarDesktop.loadComponentFromURL(). Maybe I missed something... :(
OpenOffice 3.2.0.9 on Linux 2.6.33
skylendar
 
Posts: 26
Joined: Thu Sep 02, 2010 6:46 pm

Re: Main form at Startup

Postby Villeroy » Fri Sep 17, 2010 8:05 pm

You are free to combine any collection of forms, reports, spreadsheets, buttons and macros to your liking as long as your macros are accessible and your reports are stored in the Base document (AFAIK dynamic reports need to be in the Base container). Simply write a macro which opens the Base document and the report therein.
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04, no OpenOffice, LibreOffice 6.x
User avatar
Villeroy
Volunteer
 
Posts: 26730
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Main form at Startup

Postby skylendar » Sat Sep 18, 2010 1:00 am

Eventually, I got a tutorial containing BASIC examples about how to display a form from an .odb file i.e. http://www.pitonyak.org/database/AndrewBase.odt

Nevertheless I'm surprised to see how complex is a task as simple as that one.

IMHO, it could be a good idea to offer the opportunity to display a form directly within ooo Base, instead of creating an external form.

But after all, it work ! Finally... :super:

Thank you again for your support.
OpenOffice 3.2.0.9 on Linux 2.6.33
skylendar
 
Posts: 26
Joined: Thu Sep 02, 2010 6:46 pm

Re: [Solved] Main form at Startup

Postby Villeroy » Thu Sep 23, 2010 11:26 am

IMHO, it could be a good idea to offer the opportunity to display a form directly within ooo Base, instead of creating an external form.

Many features, commands and locations in OOo have URLs.
Something like this would be useful:
embedded:forms/MyStartupForm?'file:///path/database.odb'
embedded:reports/MyFinalResults?'file:///path/database.odb'

If not a protocol handler for "embedded:", even a simple command line switch would help.
Register and vote for http://www.openoffice.org/issues/show_bug.cgi?id=85120
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04, no OpenOffice, LibreOffice 6.x
User avatar
Villeroy
Volunteer
 
Posts: 26730
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: [Solved] Main form at Startup

Postby neptuneuk » Thu Apr 14, 2011 5:42 am

I was looking to do the same thing, open base and load a form of my choosing (one I had created in base with various menu options to open other forms etc).

After much looking I created the following:

Sub Menu_Main( )
Dim ObjTypeWhat
Dim ObjName As String
ObjTypeWhat = com.sun.star.sdb.application.DatabaseObject.FORM
ObjName = "Menu_Main" 'The name of the form you want to open at Base start-up, this needs to exist.
If ThisDatabaseDocument.FormDocuments.hasbyname(ObjName) Then 'Check the form exists
ThisDataBaseDocument.CurrentController.Connect() 'If the form exists connect to the database
ThisDatabaseDocument.CurrentController.loadComponent(ObjTypeWhat, ObjName, FALSE) 'Open the form
Else
MsgBox "This is embarrassing, sorry, can't find the requested form to open!"+chr(10)+"Form Name = " & ObjName + chr(10)+"Check the details." , 48, "DS4A SBM encountered a problem!"
End if
End Sub

You will also need to do the following (assuming you only want to run this in a particular Base odb file (your current project)).
Tools -> Customise->
Then assign the macro to the 'Open Document' event.
Save in - select the appropriate location (probably the current odb file is what you will want), this will only then run when that odb file is loaded.

Hope that it works OK for you all.
OpenOffice 3.2.0 nestling comfortably within the warm and embracing arms of Ubuntu Linux 10.04 (Lucid Lynx)
neptuneuk
 
Posts: 2
Joined: Mon Mar 07, 2011 11:25 pm


Return to Forms

Who is online

Users browsing this forum: No registered users and 2 guests