Re: Forms : Toolbar Trigger

From: Valeri Sorokine <vsorokin_at_dd.ru>
Date: Fri, 09 Jul 1999 18:03:34 +0400
Message-ID: <37860136.C3E0CE9_at_dd.ru>


Hello,

I think it would be better if you will use IF...ELSIF... instead of IF...ELSE IF... And you can name toolbar buttons as the actions they destined for (just use the names of the built-ins). In that case you can use something like this:   ...
  action := Get_Item_Property(NAME_IN('SYSTEM.TRIGGER_ITEM'), ITEM_NAME);   --
  IF action IN ('EXIT_FORM', 'EXIT', 'QUIT') THEN     action := 'EXIT_FORM';
  END IF;
  ...
  IF action = ... THEN
    ...
  ELSIF action = ... THEN
    ...
  ELSE
    Do_Key(action);
  END IF;
  ...

Hope this helps.

BAMAN MOTIVALA wrote:
>
> Hello,
>
> I have created a simple 4 button toolbar with buttons for Save, Enter Query,
> Execute Query and Exit. I have also created a form level WHE-BUTTON-PRESSED
> trigger to respond to toolbar events. In the trigger I have used IF and ELSE
> IF statements to handle the button pressed events. As I think about adding
> more buttons to the toolbar I wonder if this is the best way to write the
> code.
>
> My question:
>
> Is there a better way to write this trigger than using :SYSTEM.TRIGGER_ITEM
> and a bunch of ELSE IFs?
>
> My code:
>
> /* Form level WHEN-BUTTON-PRESSED */
>
> DECLARE
> button_pressed varchar2(50);
> BEGIN
> button_pressed := :SYSTEM.TRIGGER_ITEM;
> --save button
> IF button_pressed = 'TOOLBAR.SAVE'
> THEN
> COMMIT_FORM;
> --enter query button
> ELSE IF button_pressed = 'TOOLBAR.EQUERY'
> THEN
> SET_ITEM_PROPERTY('TOOLBAR.SAVE', ENABLED, PROPERTY_FALSE);
> ENTER_QUERY;
> --query button
> ELSE IF button_pressed = 'TOOLBAR.QUERY'
> Then
> EXECUTE_QUERY;
> SET_ITEM_PROPERTY('TOOLBAR.SAVE', ENABLED, PROPERTY_TRUE);
> --exit button
> ELSE IF button_pressed = 'TOOLBAR.EXIT'
> THEN EXIT_FORM;
> END IF;
> END IF;
> END IF;
> END IF;
> END;

-- 
Valeri Sorokine
ProSoft, Russia, Moscow, Information Systems Division
Phone: +7 (095) 234 0636 (6 lines) FAX: +7 (095) 234 0640
E-mail: vsorokin_at_dd.ru OR vsorokin_at_prosoft.ru
http://www.dd.ru
Received on Fri Jul 09 1999 - 16:03:34 CEST

Original text of this message