Hi George,
There is not a built-in key functionality which enables you to navigate next/previous row in a form panel. But you can easily implement some custom generic procedures to achieve this request.
As the first option you can define keyEvents for up, down, pageup and pagedown keys at the component level, for each component in your form panel. As the second option, you can define these keyEvents at your form panel level, which is much easier. Note that in each option, you have to set the "name" attribute of your components to enable key navigation. The implementation at the form panel level looks like the following:
<panel>
<events>
<keyEvents>
<keyEvent action="previousRow" keyCombination="UP"/>
<keyEvent action="nextRow" keyCombination="DOWN"/>
<keyEvent action="firstRow" keyCombination="PAGE_UP"/>
<keyEvent action="lastRow" keyCombination="PAGE_DOWN"/>
</keyEvents>
</events>
<tableLayout>
<row height="20">
<cell>
<textField dataSource="EMPLOYEES1" column="LAST_NAME" name="tf_lastName"/>
</cell>
</row>
<row height="20">
<cell>
<textField dataSource="EMPLOYEES1" column="FIRST_NAME" name="tf_firstName"/>
</cell>
</row>
</tableLayout>
</panel>
The action codes for the key events above are as follows:
procedure nextRow is
v_currentComponent_tx varchar2(1000);
v_datasourceName_tx varchar2(255);
begin
v_currentComponent_tx := api_application.getfocusedcomponent;
v_datasourceName_tx := api_component.getdatasource(v_currentComponent_tx);
if v_datasourceName_tx is not null then -- if component is bound to a datasouce
api_datasource.nextrow(v_datasourceName_tx);
end if;
exception
when api_exception.e_invalidRowNumber or api_exception.e_invalidInputFormat then -- next row doesn't exist or component name is missing
null;
end;
procedure previousRow is
v_currentComponent_tx varchar2(1000);
v_datasourceName_tx varchar2(255);
begin
v_currentComponent_tx := api_application.getfocusedcomponent;
v_datasourceName_tx := api_component.getdatasource(v_currentComponent_tx);
if v_datasourceName_tx is not null then -- if component is bound to a datasouce
api_datasource.previousRow(v_datasourceName_tx);
end if;
exception
when api_exception.e_invalidRowNumber or api_exception.e_invalidInputFormat then -- previous row doesn't exist or component name is missing
null;
end;
procedure firstRow is
v_currentComponent_tx varchar2(1000);
v_datasourceName_tx varchar2(255);
begin
v_currentComponent_tx := api_application.getfocusedcomponent;
v_datasourceName_tx := api_component.getdatasource(v_currentComponent_tx);
if v_datasourceName_tx is not null then -- if component is bound to a datasouce
api_datasource.firstRow(v_datasourceName_tx);
end if;
exception
when api_exception.e_invalidInputFormat then -- component name is missing
null;
end;
procedure lastRow is
v_currentComponent_tx varchar2(1000);
v_datasourceName_tx varchar2(255);
begin
v_currentComponent_tx := api_application.getfocusedcomponent;
v_datasourceName_tx := api_component.getdatasource(v_currentComponent_tx);
if v_datasourceName_tx is not null then -- if component is bound to a datasouce
api_datasource.lastRow(v_datasourceName_tx);
end if;
exception
when api_exception.e_invalidInputFormat then -- component name is missing
null;
end;
Hope this helps,
Ibrahim
answered
26 Feb '13, 10:14
Ibrahim Sand... ♦♦
1.5k●5
accept rate:
25%