Refresh and go to current record
Refresh and go to current record
Hi,
I'm creating small database with few information field and categories on listbox (in main form).
Next to listbox I'm trying to add button which will be linked to "add category form" ( with field: id, category name and one buton: save and return). At this moment it will popup new window where I can add new category and return, but it will not display it. I was trying to figure it out by myself… But refresh button will refresh but also jump to first record … is there way to make it work? I was trying to recreate few ideas from forum but they don't work.
I'm creating small database with few information field and categories on listbox (in main form).
Next to listbox I'm trying to add button which will be linked to "add category form" ( with field: id, category name and one buton: save and return). At this moment it will popup new window where I can add new category and return, but it will not display it. I was trying to figure it out by myself… But refresh button will refresh but also jump to first record … is there way to make it work? I was trying to recreate few ideas from forum but they don't work.
OpenOffice 4.1.5 on Windows 10
Re: Refresh and go to current record
There are two refresh buttons on the navigator toolbar. The second one becomes enabled when a combo or list box is focussed. It refreshes the content of the control without affecting the state of the form.
Last edited by Villeroy on Tue Aug 21, 2018 12:50 pm, edited 2 times in total.
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
Re: Refresh and go to current record
Yes I know, but with i.e. 20 records after refresh it will jump to first record, and you will need to go back to last edited record manualy. I was trying with macro to somehow "remember" record numer, refresh form, and go to remembered record but with no luck ;/Villeroy wrote:There are two refresh buttons on the navigator toolbar. The second one becomes enabled when a combo or list box is focussed. It refreshes the content of the control without affecting the state of the form.
aaa You were talking about second one It's working : Thank you!
OpenOffice 4.1.5 on Windows 10
Re: Refresh and go to current record
The pop-up-other-window kind of approach is not viable with Base forms unless you are a very routined programmer. Simply use a small input form for new records in the same form hierarchy. Then refresh the form control.
You can use a custom toolbar button with the buttons you need.
You can use a toolbar control where you can hide sections.
You can even use a push button with property "Open Document or URL" and the URL .uno:RefreshFormControl which fails silently when no refreshable control is focussed
You can use one of the simple macros on this forum which operate within the same hierarchy of forms.
You can use a custom toolbar button with the buttons you need.
You can use a toolbar control where you can hide sections.
You can even use a push button with property "Open Document or URL" and the URL .uno:RefreshFormControl which fails silently when no refreshable control is focussed
You can use one of the simple macros on this forum which operate within the same hierarchy of forms.
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
-
- Volunteer
- Posts: 1544
- Joined: Wed Jun 24, 2015 12:56 am
- Location: Colorado, USA
Re: Refresh and go to current record
Maybe this might help
Code: Select all
Sub reloadForm(oEvent As Object)
Dim oForm As Object
Dim CurrRow As Integer
oForm=oEvent.Source.Model.Parent
CurrRow=oForm.Row
oForm.reload()
oForm.absolute(CurrRow)
End Sub
If your problem has been solved, please edit this topic's initial post and add "[Solved]" to the beginning of the subject line
Apache OpenOffice 4.1.14 & LibreOffice 7.6.2.1 (x86_64) - Windows 10 Professional- Windows 11
Apache OpenOffice 4.1.14 & LibreOffice 7.6.2.1 (x86_64) - Windows 10 Professional- Windows 11
Re: Refresh and go to current record
Huh? Does that really work?
Indeed, it does!
(unless the mere row number changes due to the reload process)
Base does not support bookmarking as MS Access does:
bm = form.Bookmark
form.reload()
form.gotoBookmark(bm)
Indeed, it does!
(unless the mere row number changes due to the reload process)
Base does not support bookmarking as MS Access does:
bm = form.Bookmark
form.reload()
form.gotoBookmark(bm)
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
-
- Volunteer
- Posts: 1544
- Joined: Wed Jun 24, 2015 12:56 am
- Location: Colorado, USA
Re: Refresh and go to current record
Thanks Villeroy, the following also appears to work
Code: Select all
Sub reloadForm(oEvent As Object)
Dim oForm As Object
Dim Bmk
oForm=oEvent.Source.Model.Parent
Bmk = oForm.getBookmark()
oForm.reload()
oForm.moveToBookmark(Bmk)
End Sub
If your problem has been solved, please edit this topic's initial post and add "[Solved]" to the beginning of the subject line
Apache OpenOffice 4.1.14 & LibreOffice 7.6.2.1 (x86_64) - Windows 10 Professional- Windows 11
Apache OpenOffice 4.1.14 & LibreOffice 7.6.2.1 (x86_64) - Windows 10 Professional- Windows 11
Re: Refresh and go to current record
Thanks, for response, maybe it's bad idea to use record macro option, but in this case it's working. Is it correct to use such a macro?
I've connected it to event "push button" actionsub refresh_small
rem ----------------------------------------------------------------------
rem define variables
dim document as object
dim dispatcher as object
rem ----------------------------------------------------------------------
rem get access to the document
document = ThisComponent.CurrentController.Frame
dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
rem ----------------------------------------------------------------------
dispatcher.executeDispatch(document, ".uno:RefreshFormControl", "", 0, Array())
end sub
OpenOffice 4.1.5 on Windows 10
Re: Refresh and go to current record
This is exactly the same as an URL button with URL .uno:RefreshFormControl instead of a macroSzaibot wrote:Thanks, for response, maybe it's bad idea to use record macro option, but in this case it's working. Is it correct to use such a macro?
I've connected it to event "push button" actionsub refresh_small
rem ----------------------------------------------------------------------
rem define variables
dim document as object
dim dispatcher as object
rem ----------------------------------------------------------------------
rem get access to the document
document = ThisComponent.CurrentController.Frame
dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
rem ----------------------------------------------------------------------
dispatcher.executeDispatch(document, ".uno:RefreshFormControl", "", 0, Array())
end sub
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
-
- Volunteer
- Posts: 1544
- Joined: Wed Jun 24, 2015 12:56 am
- Location: Colorado, USA
Re: Refresh and go to current record
There is nothing wrong with using a recorded macro, as long as it does what you need it to do.Is it correct to use such a macro?
Recorded macros use Dispatcher commands, rather than dealing directly with the OpenOffice API so there are some limitations and Dispatcher commands are poorly documented. Then and there is the issue that the macro recorder only works in the Writer and Calc modules, but not Base.
Either one of the two Basic macros presented earlier should work when invoked by the Appove action event of a Push Button control on the form that needs to be refreshed. The Action property on the General tab of the Properties: Push Button dialog should be set to None. They both refresh the form and return to the row number where the button was pressed.
If your problem has been solved, please edit this topic's initial post and add "[Solved]" to the beginning of the subject line
Apache OpenOffice 4.1.14 & LibreOffice 7.6.2.1 (x86_64) - Windows 10 Professional- Windows 11
Apache OpenOffice 4.1.14 & LibreOffice 7.6.2.1 (x86_64) - Windows 10 Professional- Windows 11