For forms displaying a single record i developed an easy to access search functionality.
Missing is code to switch on/off the table view (listview) at the top of the form (now set manually), see the screenshot below.
The interface is inspired by DataPerfect back in the 80's. With the cursor on a control one would hit a function key, say F3, and then
- an input field opens in the border of the form
- the recordset is sorted on the field bounded to the control
- a listview of 4-6 rows shows up
- upon each character entered, the recordpointer moves further downwards
- backspace cleares the input field, recordpointer moves to the first record
- ENTER terminates the search and formview is restored as before entering the search
(in fact DP was even more flexible, to each control an index (eg. more than one column) could be assigned, as well as a specification of the column sequence in the listview)
solutions / comments are welcome
[Solved] Code to invoke the table view in a form
-
- Posts: 13
- Joined: Sat May 10, 2014 1:38 pm
[Solved] Code to invoke the table view in a form
Last edited by debewerker on Wed Dec 02, 2015 7:55 pm, edited 10 times in total.
OpenOffice 4.1.1 on LINUXmint quiana
Re: code to invoke the table view in a form
Add a push button with Action="Open Document or URL" and URL= .uno:ViewFormAsGrid
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
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
-
- Posts: 13
- Joined: Sat May 10, 2014 1:38 pm
Re: code to invoke the table view in a form
dear Villeroy,
The answer given is not recognizable to me.
In formdesignmode with wizard switched to on, and putting a button on the form, no wizard guidance is given in my case (for a listbox the wizard is operational)
I found no match on ViewFormAsGrid in the API or developersguide.
From Andrew the max i can come up with is
However this does not give the desired effect.
Can you give a more detailed answer?
The answer given is not recognizable to me.
In formdesignmode with wizard switched to on, and putting a button on the form, no wizard guidance is given in my case (for a listbox the wizard is operational)
I found no match on ViewFormAsGrid in the API or developersguide.
From Andrew the max i can come up with is
Code: Select all
apropertyvalues(0).Name = "ActiveConnection"
apropertyvalues(0).Value = dbconnection
apropertyvalues(1).Name = "OpenMode"
apropertyvalues(1).Value = "open"
aPropertyValues(2).Name = "URL"
aPropertyValues(2).Value = ".uno:ViewFormAsGrid" ' also tried "ViewFormAsGrid"
oFormDocuments.loadComponentFromURL( sFormName ,"_blank",0,aPropertyValues())
Can you give a more detailed answer?
OpenOffice 4.1.1 on LINUXmint quiana
-
- Volunteer
- Posts: 1160
- Joined: Mon Oct 08, 2007 1:26 am
- Location: France, Paris area
Re: Code to invoke the table view in a form
Use the button properties.
Bernard
OpenOffice.org 1.1.5 / Apache OpenOffice 4.1.1 / LibreOffice 5.0.5
MS-Windows 7 Home SP1
OpenOffice.org 1.1.5 / Apache OpenOffice 4.1.1 / LibreOffice 5.0.5
MS-Windows 7 Home SP1
-
- Posts: 13
- Joined: Sat May 10, 2014 1:38 pm
Re: Code to invoke the table view in a form
Thanks for propagating the suggestion of Villeroy.
By MRI of a button on the form, the targetURL property became visible (apparently different in functionality from the targetURL property in the com.sun.star.form.component.HTMLForm.)
Don't ask me how, but after hours with targetURL and developers guide and buttonItemListeners and Util, i stumbled upon:
Apparently there is a dispatcher for forms/frames as well. (For writer documents the macro recorder simply introduces you to the dispatcher)
The dispatcher does toggle the last button of the navigation toolbar.
The elegance of this general search functionality is now complete: with one keystroke (F3), you can start typing the search term, and see the immediate (+/-) values adjacent to the searchstring
It allows to search numbers, strings, dates, and search in the displayed value of an associated listbox (be it by a workaround filtering the form, after three charaters are entered)
No idea how performance is with large recordsets. Without trials i guess that sorting the form is greatly enhanced if an index is present based on the column you want to search in. After sorting, the search is done by bisection.
By MRI of a button on the form, the targetURL property became visible (apparently different in functionality from the targetURL property in the com.sun.star.form.component.HTMLForm.)
Don't ask me how, but after hours with targetURL and developers guide and buttonItemListeners and Util, i stumbled upon:
Code: Select all
Dim oURL as new com.sun.star.util.URL
Dim oDispatcher as Object
Dim args(0) As New com.sun.star.beans.PropertyValue
oURL.Complete = ".uno:ViewFormAsGrid"
createUnoService( "com.sun.star.util.URLTransformer" ).parseStrict( oURL)
oDispatcher = oForm.getParent.getParent.CurrentController.Frame.queryDispatch( oURL, "",0 )
oDispatcher.dispatch( oURL,args() )
The dispatcher does toggle the last button of the navigation toolbar.
The elegance of this general search functionality is now complete: with one keystroke (F3), you can start typing the search term, and see the immediate (+/-) values adjacent to the searchstring
It allows to search numbers, strings, dates, and search in the displayed value of an associated listbox (be it by a workaround filtering the form, after three charaters are entered)
No idea how performance is with large recordsets. Without trials i guess that sorting the form is greatly enhanced if an index is present based on the column you want to search in. After sorting, the search is done by bisection.
OpenOffice 4.1.1 on LINUXmint quiana