# In Base, how do you make navigation button that goes to a place within the same form?

I am making a data entry form that's got some different sections on it. I would like to make up some navigation buttons (a switchboard type thing) that will jump the user to a specific section that's further down the same form, so they don't have to scroll. I "could" make the sections different forms, but I'd rather it be all on the one form. Is this possible and, if so, how is it done?

edit retag close merge delete

Sort by » oldest newest most voted

Hi

If the form contains sections you do not need macros. You can insert hyperlink buttons to sections: Insert Hyperlink, on the left select Document, click the Target button, select the section target, select form Button, give the text you want as label.

See this example: Sections.odb

Note: it will change the anchor of the button to be able to move it (e.g. anchor page).

Regards

more

The simplest way to do this is just to move the focus to the first control in the section, or to the last and then first control in a manner that makes the screen scroll as desired. In the example below, the third indexed control is near the bottom of the form, and the second (actually, a button) is at the top of the section. This makes the screen go to the right place.

Sub ChangeFocus

root_doc = ThisComponent
drw = ThisComponent.DrawPage
form_container = drw.Forms
main_form = form_container.getByIndex(0)
ctrl = main_form.getByIndex(3)
butn = main_form.getByIndex(2)

cntrllr = ThisComponent.getCurrentController

cntrllr.getControl(ctrl).SetFocus()
cntrllr.getControl(butn).SetFocus()
End Sub


It probably also is possible to manually set the scroll level, but that would be difficult to maintain because the forms also have a zoom level and so the amount of the scroll that is necessary could change.

Hope this helps.

more

## Stats

Asked: 2015-11-07 02:15:44 +0100

Seen: 143 times

Last updated: Nov 12 '15