Access Keys:
Skip to content (Access Key - 0)
iServoy.com | Servoy.com | Forum index | Store | Developers | Documentation | Events | Products | Support

History

All versions
Click for all versions
Servoy 7.1.x
Toggle Sidebar

History is a stack of form names that were visible on the screen ordered by appearance. The first/oldest item is stored in position/index 1.

Each container (the main application window or dialogs showing forms) has its own history stack. When the History object is accessed from within scripting, the methods of the History object will work with the history stack for the active container.

Only main forms ( currentcontroller) will be stored in History, so not forms displayed in tabpanels or splitpanes.

The history has a maximum size of 10 entries. When the maximum size is reached, the oldest entries are automatically removed to make place for new entries.


Property Summary
BooleanbuttonsEnabled
Set/Get the history buttons enabled.

Method Summary
voidback()
Navigates back in the history stack; shows the previous form (if present).
voidclear()
Clear the entire history stack.
voidforward()
Navigates forward in the history stack; shows the next form (if present).
NumbergetCurrentIndex()
Get the current absolute index in the history stack.
StringgetFormName(i)
Get the form name based on the specified absolute index in the history stack location.
voidgo(i)
Navigates to the relative index based on current position in the history.
BooleanremoveForm(formName)
Removes the named form item from the history stack (and from memory) if not currently shown.
BooleanremoveIndex(index)
Removes an absolute index based history stack form item.
Numbersize()
Returns the total size of the history stack.

Property Details
buttonsEnabled

Set/Get the history buttons enabled.

Returns

Boolean

Sample
history.buttonsEnabled = true;
var status = history.buttonsEnabled;

Method Details
back
voidback()

Navigates back in the history stack; shows the previous form (if present).

Returns

void

Sample
history.back();
clear
voidclear()

Clear the entire history stack.

Returns

void

Sample
history.clear();
forward
voidforward()

Navigates forward in the history stack; shows the next form (if present).

Returns

void

Sample
history.forward();
getCurrentIndex
NumbergetCurrentIndex()

Get the current absolute index in the history stack.

Returns

Number – the current absolute index

Sample
var abs_index = history.getCurrentIndex();
getFormName
StringgetFormName(i)

Get the form name based on the specified absolute index in the history stack location.

Parameters

{Number} i – the absolute index

Returns

String – the formName

Sample
var name = history.getFormName(history.getCurrentIndex());
go
voidgo(i)

Navigates to the relative index based on current position in the history.

Parameters

{Number} i – the relative index

Returns

void

Sample
history.go(-3);
removeForm
BooleanremoveForm(formName)

Removes the named form item from the history stack (and from memory) if not currently shown.
Will return false when the form can't be removed, this can happen in certain situations:
1> The form is visible,
2> The form is executing a function (is actively used),
3> There are references to this form by a global variable/array,
4> If the form has a separate foundset with edited records that can't be saved (for example autosave is false)

Parameters

{String} formName – the name of the form to remove.

Returns

Boolean – true if successful

Sample
var done = history.removeForm('mypreviousform');
removeIndex
BooleanremoveIndex(index)

Removes an absolute index based history stack form item.

Parameters

{Number} index – the index of the form to remove.

Returns

Boolean – true if successful

Sample
var done = history.removeIndex(history.getCurrentIndex()+1);
size
Numbersize()

Returns the total size of the history stack.

Returns

Number – the size

Sample
var size = history.size();
Visit our website at http://www.servoy.com or read our blogs at http://www.servoy.com/blog
Powered by Atlassian Confluence (w/ Adaptavist Theme Builder) | Terms of Use | Privacy Policy