Browse buttons

Browse buttons include four push button fields that allow the user to move to the first record in the table, to the previous record, the next record or to the last record in the table:

[spacer]

Use browse buttons with almost any “parent,” or main window. Do not use browse buttons with a true “child” window (a window only accessible from a parent window), or with a window used to maintain a single record only (such as a setup window).

Creating browse buttons

To add browse buttons to a window in your application, display the window’s layout and perform the following steps:

  1. Add browse buttons to the window status area.

Add the following four global fields, positioned from left to right in the order listed, to the window’s status area (the lower-left corner of the window):

[spacer]

Global field

Control

Top of File Button - Toolbar

Previous Button - Toolbar

Next Button - Toolbar

End of File Button - Toolbar


  1. Add a sort list.

If the table you’re browsing has multiple keys, add a sort list (a drop-down list). The sample script shown in step 3 uses the field named ‘Sort By’ as the sort list. This list specifies the key by which the user can browse records. Refer to Sort lists for more information.

  1. Attach scripts to each browse button.

Attach a change script similar to the following example to each control. Be sure to substitute the change first clause of the change statement for the appropriate browse button.

 

local integer l_answer;

if changed (window 'Lead Maintenance') then
		l_answer = ask("Save the current record?", "Yes", "No", "Cancel");
		if l_answer = ASKBUTTON1 then
			{The user clicked Yes.}
			if required(window 'Lead Maintenance') then
				copy to table IG_Leads_MSTR;
				save table IG_Leads_MSTR;
			else
				warning "Not all required fields have been entered.";
				abort script;
			end if;
		elseif l_answer = ASKBUTTON2 then
			{The user clicked No.}
			release table IG_Leads_MSTR;
			clear changes window 'Lead Maintenance';
		else
			{The user clicked Cancel.}
			abort script;
		end if;
end if;

release table IG_Leads_MSTR;
change first table IG_Leads_MSTR by number 'Sort By';
if err() = OKAY then
		copy from table IG_Leads_MSTR;
		clear changes form IG_Lead_Maintenance;
		lock 'Lead ID' of window 'Lead Maintenance';
		enable 'Delete Button';
else
		beep WARNSOUND;
end if;

  1. Set the value of the sort list field.

Add a window pre script to set the value of the sort list field prior to the window opening. In the following example, the script sets the default position of the sort list field to 1 (By Lead ID).

'Sort By' = 1;


Documentation Feedback