Refresh button

The Refresh (Redisplay) button contains the code that actually fills the scrolling window for the lookup. When the user clicks the Refresh button or chooses the Refresh item in the Sort by/View options button drop list, the contents of the scrolling window is refreshed based on the sort order specified and the contents of the Find field.

[spacer]

Adding a refresh button

To add a refresh button to a lookup window, use the following procedure.

  1. Add key fields to the layout.

Add all key fields from the linked table to the layout for the lookup window and set the following properties for each:

[spacer]

Visible

False

Editable

False


You’ll use these fields in the change script you attach to the refresh button.

  1. Add the Redisplay button.

Drag the global field named ‘Redisplay Button’ onto the lookup window layout. Set the following Object properties for the button:

[spacer]

TabStop

False


Set the following Visual properties for the field:

[spacer]

Appearance

3D Highlight

BackColor

Transparent

Border

True

Style

Graphic Only


  1. Attach a change script.

Attach a change script to the field, similar to the following example. This script fills the scrolling window based on the sort order chosen, the contents of the hidden key fields, and the contents of the Find field.

if '(L) Sort By' = 1 then
	{The sort list is set to Lead ID.}
	if empty('Search Text') and empty('Lead ID') then
		fill window Lead_Lookup_Scroll by number '(L) Sort By';
	elseif empty('Search Text') and (not empty('Lead ID')) then
		'Lead ID' of table IG_Leads_MSTR = 'Lead ID';
		fill window Lead_Lookup_Scroll from current by number '(L) Sort By';
	else
		'Lead ID' of table IG_Leads_MSTR = upper(substring( 'Search Text', 1, 15));
		fill window Lead_Lookup_Scroll from current by number '(L) Sort By';
		focus field 'Lead ID' of window Lead_Lookup_Scroll;
	end if;
elseif '(L) Sort By' = 2 then
	{The sort list is set to Lead Name.}
	if empty('Search Text') and empty('Lead Name') then
		fill window Lead_Lookup_Scroll by number '(L) Sort By';
	elseif empty('Search Text') and (not empty('Lead Name')) then
		'Lead Name' of table IG_Leads_MSTR = 'Lead Name';
		fill window Lead_Lookup_Scroll from current by number '(L) Sort By';
	else
		'Lead Name' of table IG_Leads_MSTR = substring( 'Search Text', 1, 30);
		fill window Lead_Lookup_Scroll from current by number '(L) Sort By';
		focus field 'Lead Name' of window Lead_Lookup_Scroll;
	end if;
elseif '(L) Sort By' = 3 then
	{The sort list is set to Salesperson ID.}
	if empty('Search Text') and empty('Salesperson ID') then
		fill window Lead_Lookup_Scroll by number '(L) Sort By';
	elseif empty('Search Text') and (not empty('Salesperson ID')) then
		'Salesperson ID' of table IG_Leads_MSTR='Salesperson ID';
		fill window Lead_Lookup_Scroll from current by number '(L) Sort By';
	else
		'Salesperson ID' of table IG_Leads_MSTR = substring( 'Search Text',1,30);
		fill window Lead_Lookup_Scroll from current by number '(L) Sort By';
		focus field 'Salesperson ID' of window Lead_Lookup_Scroll;
	end if;
end if;


Documentation Feedback