Hi Ibrahim,

When I have grid, I can shift to rows by arrow key and pageup/pagedown. But in my form panel(without grid) I cannot go to the next/previous rows using this method. What keys should I use?

George

asked 26 Feb '13, 09:05

George's gravatar image

George
1111333
accept rate: 0%

converted 26 Feb '13, 09:40

Ibrahim%20Sandalli's gravatar image

Ibrahim Sand... ♦♦
1.5k5


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

link

answered 26 Feb '13, 10:14

Ibrahim%20Sandalli's gravatar image

Ibrahim Sand... ♦♦
1.5k5
accept rate: 25%

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×9

Asked: 26 Feb '13, 09:05

Seen: 1,170 times

Last updated: 26 Feb '13, 10:14


© Copyright Gerger 2017