Hi folks,

I have an application which has five tables. A single table columns may be displayed in both grid and form panels. The form has multi-tab format. At the start of the application I want to set the labels, tooltip, enable/disable for different columns. How do I go ahead with this? Kindly give me some example code. I am new to formspider. Therefore, your help is greatly appreciated.

George.

asked 24 Feb '13, 01:52

George's gravatar image

George
1111226
accept rate: 0%


Hi George,

When designing a panel in the Formspider IDE, you define the initial state of the panel components via the XML editor. Labels, tooltips, enable/disable etc are all attributes to the different components. So for example you create a panel (named testPanel) with a textfield and textlabel like this:

<panel>
  <tableLayout cellSpacing="2">
    <row height="20" >
      <cell width="100" >
        <textLabel name="labelName" label="The label/prompt"/>
      </cell>
      <cell width="300" hAlign="Full">
        <textField name="textFieldName" column="COLUMN_NAME" dataSource="DATASOURCE_NAME" tooltip="The tooltip"  />
      </cell>
    </row>
  </tableLayout>
</panel>

This will give you the state at startup. If you want different runtime settings based on some rules, you can use the API's to set the properties at runtime. So for example, if you want to change the tooltip, use:

api_component.setToolTip (in_paneldotcomponentname_tx => 'testPanel.textFieldNAme'
                         ,in_tooltip_tx               => 'The text of the new tooltip')

To set the label, use api_component.setLabel, to enable or disable the component, use api_component.setEnable, and so on..

The moment you want to set the new properties depends onthe use case. You can use for example the postInitialize event on a panel when you want to change the settings once on panel startup, like this:

  <panel>
    <events>
      <postInitialize action="action_name" />
    </events>
    <tableLayout cellSpacing="2">
    ....

Or on any other event you like you have control over all components attributes.

Good luck,
Michiel

link

answered 24 Feb '13, 05:40

Michiel%20A's gravatar image

Michiel A
5161544
accept rate: 13%

Thanks for the great explanation Michiel.

(24 Feb '13, 05:48) Ibrahim Sand... ♦♦

Hi George,

Just some more explanation about why the postIntialize event is the best place to change the panel settings:

Formspider doesn't initialize(load) the entire application when it's started, instead, it initializes a panel(screen) when it's necessary, it's one of the performance related advantages that Formspider provides.

In Formspider, the initialization of a panel is necesary when it's displayed on the screen for the first time or when any of the components existing in this panel or the panel itself is accessed through an API call. Therefore, if you set the label, tooltip, enable/disable state.. of any component existing in a panel just at the start of the application, you will cause this panel to be initialized too early (and possibly unnecessarily since it may not be displayed on the screen).

Therefore, as Michiel mentioned, the best place to change the panel settings is the postIntialize event of the panel. The postIntialize event triggers only once just after the panel is initialized.

You can find the APIs to set the label, tooltip, enable/disable of a component in the api_component package.

Best Regards,
Ibrahim

link

answered 24 Feb '13, 05:53

Ibrahim%20Sandalli's gravatar image

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

Hi Michiel,

I guess you have deleted your comment but I think it can be very useful for others: "When a panel has a grid, and you do api_datasource.executeQuery for the grid datasource, will it cause the panel to initialize?"

The answer is no, datasource executions don't cause the panel to initialize.

(24 Feb '13, 06:15) Ibrahim Sand... ♦♦

Hi Ibrahim,

True, i deleted my comment, while i tested it and found the answer, but indeed, it might be usefull for others.

Thanks,
Michiel

(24 Feb '13, 06:28) Michiel A

Hi Michiel and Ibrahim,

Thank you very much for your answers. I understand that the command is

api_component.setToolTip (in_paneldotcomponentname_tx => 'testPanel.textFieldNAme' ,in_tooltip_tx => 'The text of the new tooltip')

and the event to be raised is postInitialize action.

And that api_datasource.executeQuery will not initialize a panel with grid.

I have one more question in this regard. How do I loop through the items in the panel?. I have multiple items in a panel. Therefore I need to go through each of the items in the panel and issue the api_component commands where applicable.

Thank you and best regards.

George

(24 Feb '13, 10:19) George

Hi George,

There is not an API which make you able you loop through the items in the panel. But as mentioned in this thread, you can query t_bdf_panelins and t_bdf_paneldtlins tables existing in Formspider schema to retrieve all components existing in a panel. As a simple example, you can use the following cursor to loop through the items of a panel:

cursor c1 is
select d.name_tx, d.componenttype_cd
from t_bdf_panelins    p,
     t_bdf_paneldtlins d
where  p.bdf_application_oid = api_application.getid
and    p.name_tx = '<panel name>'
and    d.bdf_panelins_oid =  p.bdf_panelins_oid
and    d.componenttype_cd is not null;

You can customize this query following your needs.

Regards,
Ibrahim

(24 Feb '13, 11:15) Ibrahim Sand... ♦♦

Thank you again Ibrahim.

(24 Feb '13, 11:22) George

Hi Michiel and Ibrahim,

As instructed I have given the postInitialize event as follows:

      <events>
        <focusGain action="ds_emp_changed"/>
      </events>
      <events>
        <postInitialize action="post_initialize"/>
      </events>
      <column headerLabel="First Name" width="70">
        <textField column="FIRST_NAME"/>
      </column>

Unfortunately validation error occurs as under:

cvc-complex-type.2.4.a: Invalid content was found starting with element 'events'. One of '{"":column}' is expected. At Line: 10 , Column: 21 cvc-complex-type.2.4.a:

Invalid content was found starting with element 'postInitialize'. One of '{"":click, "":rightClick, "":focusGain, "":focusLost, "":doubleClick, "":selectionChanged, "":valueChanged, "":keyEvents, "":headerClick}' is expected. At Line: 11 , Column: 56

Please help.

George

(24 Feb '13, 12:39) George

Hi George,

postInitialize is an event of the Panel not the Grid.

The Intellisense feature of the XML Editor guides you through what's valid to type and what's not in a given context. So I suggest you to follow its suggestions and only write tags, attributes that the XML Editor suggests.

(24 Feb '13, 12:43) Yalim K. Gerger ♦♦

Hi Yalim,

That worked. Thanks a lot.

Regards,

George.

(24 Feb '13, 12:53) George

Hi Ibrahim,

cursor c1 is

select d.name_tx, d.componenttype_cd

from t_bdf_panelins p,

 t_bdf_paneldtlins d

where p.bdf_application_oid = api_application.getid

and p.name_tx = '<panel name="">'

and d.bdf_panelins_oid = p.bdf_panelins_oid

and d.componenttype_cd is not null;

This query does not bring the panel component name for datasource grid. What I am getting is as follows. It does not have column names in the grid panel. I have checked all the panel related formspider tables and there is no column in table that holds the column names in the panel.

Panel=>empGridPanel::name_tx=>grid::componenttype_cd=>Grid Panel=>empGridPanel::name_tx=>NULL::componenttype_cd=>Column Panel=>empGridPanel::name_tx=>NULL::componenttype_cd=>TextField Panel=>empGridPanel::name_tx=>NULL::componenttype_cd=>Column Panel=>empGridPanel::name_tx=>NULL::componenttype_cd=>TextField

My procedure is:

PROCEDURE post_initialize(p_panel VARCHAR2) IS

CURSOR c1(p_panel VARCHAR2) IS

SELECT d.name_tx, d.componenttype_cd

FROM t_bdf_panelins p

,t_bdf_paneldtlins d

WHERE p.bdf_applicationsession_oid = api_application.getid

AND p.name_tx = p_panel

AND d.bdf_panelins_oid = p.bdf_panelins_oid

AND d.componenttype_cd IS NOT NULL;

BEGIN

FOR p IN c1(p_panel) LOOP

msg.show( 'Panel=>' || p_panel || '::name_tx=>' || NVL(p.name_tx, 'NULL') || '::componenttype_cd=>' || p.componenttype_cd );

END LOOP;

END;

msg.show is my re-write for your api_application.showpopupmessage because the name is very long.

Can you kindly tell me where is my mistake?

George.

(24 Feb '13, 14:42) George

hi George,

The reason that the component name does not show, is that you have to give the component a name by using the name="componentName" attribute for each component.

So, in you example, set the textField as follows:

<textfield name="first_name" column="FIRST_NAME"/>

Best regards, Michiel

(24 Feb '13, 15:49) Michiel A
showing 5 of 10 show 5 more comments
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:

×5
×2
×2

Asked: 24 Feb '13, 01:52

Seen: 1,166 times

Last updated: 24 Feb '13, 15:49


© Copyright Gerger 2017