Forms : Toolbar Trigger

From: BAMAN MOTIVALA <bmotivala_at_swipnet.se>
Date: Thu, 1 Jul 1999 08:16:58 +0100
Message-ID: <aRDe3.1192$nZ5.1652_at_nntpserver.swip.net>



Hello,

[Quoted] 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?

[Quoted] My code:

/* Form level WHEN-BUTTON-PRESSED */

DECLARE
     button_pressed varchar2(50);
BEGIN
     button_pressed := :SYSTEM.TRIGGER_ITEM;
--save button

[Quoted]      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; Received on Thu Jul 01 1999 - 09:16:58 CEST

Original text of this message