Home » Developer & Programmer » Forms » Please Help : Creating dynamic Menu
icon9.gif  Please Help : Creating dynamic Menu [message #152290] Thu, 22 December 2005 05:32 Go to next message
imhamedi
Messages: 5
Registered: December 2005
Location: Rabat
Junior Member
I want to create dynamic menu, i've searched on metalink and this is what i've found, but i haven't understoot how to use this!!!! because first i haven't an "Administration" menu item, and i know how to create menus but i cant understand the way they explain to create menus!!!! please can some one explain me how to do, thanks :
Assumptions
-----------
1. This bulletin assumes that you are fairly comfortable with Forms and
Menu Concepts and also assumes that you have some coding experience.
If you are uncertain how to create a menu application or how to connect
a form and a menu application, refer to the Oracle Forms User's Guide.

2. This bulletin assumes that the application being built has
an "Administration" Menu item, which contains different form modules
for administering the different database objects related to the
application.
If "Administration" menu item is not available, you need to contact your Project Manager for placing this under appropriate menu item.

3. The approximate maximum number of Customer specific modules for
Forms/Reports is known during the design time.

Forms Design
------------
1. Name of the Form : APP-MENU.FMB
2. The Forms interface is created with "CUSTOMIZE_MENU" as the base table,
the fields description of which is given above.
3. Unique Value for the Module name should be ensured in the form.
(Of course, at the database level also).
4. If the CM_DISPLAYED is 'Y' and CM_ENABLED' is 'N', the corresponding
menu item should be visible but greyed out.

Menu Design
-----------
1. Name of the Menu : MAIN.MMB
2. In the Menu editor, add a menu item to the Main menu with the name
"CUSTOMIZE" and without any label. The Label of this menu item will be
read from the database dynamically and replaced.
3. Create the sub menu items called 'FORMS' and 'REPORTS'.
4. In the Object Navigator, change the "Command Text" property for
"CUSTOMIZE" to "CUSTOMIZE_MENU" and the parent menu item of "FORMS" and
"REPORTS" to "CUSTOMIZE_MENU".
5. Create the sub items with names 'FRM01', 'FRM02', ..., 'FRM0n' and
'REP01', 'REP02', ..., 'REP0n' under 'FORMS' and 'REPORTS' respectively.
6. Insert a menu item called "DYNAMIC" under "Administration" Menu Item
and label it as "Customize &Menu".

7. Add or append the following PL/SQL code to the "Startup Code" property
of the Menu.
    BEGIN
      /* First hide all the menu items under Forms and reports and display 
         only the needed  ones from table */
      HIDE_FORMS_REPORTS_ITEM;   /* Please see the code for these
                                    procedures below. */
      POPULATE_MENU_ITEMS;
    END;


8. PL/SQL code for "Customize &Menu" under Administration is :
    BEGIN
      Call_Form('APP-MENU',NO_HIDE,DO_REPLACE);
      Replace_Menu('MAIN');

      /* First hide all the menu items under forms and reports and display
         only  */

      Hide_Forms_Reports_Item;
      Populate_Menu_Items;
    END;


9. PL/SQL code for the MenuItems FRM01 to FRM0n is
    BEGIN
      Call_Module('FRM0x');  /* Where x ranges from 1 to n */
    END;


10. PL/SQL code for the MenuItems REP01 to REP0n is
    BEGIN
      Call_Module('REP0x');  /* Where x ranges from 1 to n */
    END;



Program Units
-------------

Program Unit: Hide_Forms_Reports_Item
PROCEDURE Hide_Forms_Reports_Item IS
  mi_id  MENUITEM;
  I      INTEGER;
  v_forms NUMBER(2);
  v_reports NUMBER(2);
BEGIN
  FOR I IN 1..5 LOOP 
    /*
    ** NOTE : Assumption was that the maximum modules are known at 
    **        design time. Change the loop counter accordingly. 
    */
    mi_id := Find_Menu_Item('FORMS_MENU.FRM0'||TO_CHAR(I));
    Set_Menu_Item_Property( mi_id, DISPLAYED, PROPERTY_FALSE );      
    mi_id := Find_Menu_Item('REPORTS_MENU.REP0'||TO_CHAR(I));
    Set_Menu_Item_Property( mi_id, DISPLAYED, PROPERTY_FALSE );      
  END LOOP;  

  SELECT COUNT(*)
  INTO v_forms
  FROM customize_menu
  WHERE cm_type = 'FORMS'
    AND cm_displayed = 'Y'
  ;     
  mi_id := Find_Menu_Item('CUSTOMIZE_MENU.FORMS');   
  IF v_forms = 0 THEN
     Set_Menu_Item_Property(mi_id, DISPLAYED, PROPERTY_FALSE);
  ELSE
     Set_Menu_Item_Property(mi_id, DISPLAYED, PROPERTY_TRUE);
  END IF;

  SELECT COUNT(*)
  INTO v_reports
  FROM customize_menu
  WHERE cm_type = 'REPORTS'
    AND cm_displayed = 'Y'
  ;     
  mi_id := Find_Menu_Item('CUSTOMIZE_MENU.REPORTS');   
  IF v_reports = 0 THEN
     Set_Menu_Item_Property(mi_id, DISPLAYED, PROPERTY_FALSE);
  ELSE
     Set_Menu_Item_Property(mi_id, DISPLAYED, PROPERTY_TRUE);
  END IF;


  mi_id := Find_Menu_Item('MAIN_MENU.CUSTOMIZE');   
  Set_Menu_Item_Property(mi_id, DISPLAYED, PROPERTY_TRUE);
  IF v_forms = 0 and v_reports = 0 THEN
    Set_Menu_Item_Property(mi_id, DISPLAYED, PROPERTY_FALSE);
  ELSE
    Set_Menu_Item_Property(mi_id, DISPLAYED, PROPERTY_TRUE);
  END IF;
END;  /* End of Procedure Hide_Forms_Reports_Item */


Program Unit: Populate_Menu_Items
PROCEDURE Populate_Menu_Items IS

  mi_id         MenuItem;
  menufound     BOOLEAN := FALSE;

  Cursor C1 is
        Select * from customize_menu; 

BEGIN

  FOR C IN C1 LOOP
     IF c.cm_type = 'MENUITEM' THEN
        menufound := TRUE;
        mi_id := Find_Menu_Item('MAIN_MENU.CUSTOMIZE');
        Set_Menu_Item_Property(mi_id, LABEL, c.cm_label);
     ELSE
        mi_id := Find_Menu_Item(c.cm_type || '_MENU.' || c.cm_name);   
        Set_Menu_Item_Property(mi_id, LABEL, c.cm_label);
        mi_id := Find_Menu_Item(c.cm_type || '_MENU.' || c.cm_name);   
        Set_Menu_Item_Property(mi_id, LABEL, c.cm_label);
        IF c.cm_module IS NULL THEN
             Set_Menu_Item_Property(mi_id, DISPLAYED, PROPERTY_FALSE);
        ELSE    
              Set_Menu_Item_Property(mi_id, DISPLAYED, PROPERTY_TRUE); 
              IF UPPER(c.cm_displayed) = 'N' THEN
                 Set_Menu_Item_Property(mi_id, DISPLAYED, PROPERTY_FALSE);
              ELSIF UPPER(c.cm_displayed) = 'Y' and UPPER(c.cm_enabled) = 'N' THEN
                 Set_Menu_Item_Property(mi_id, ENABLED, PROPERTY_FALSE);
              ELSE
                 Set_Menu_Item_Property(mi_id, ENABLED, PROPERTY_TRUE);              
              END IF;
        END IF;
     END IF;                      
  END LOOP;
  /* If Modulename is not entered for the Menu item, defaults to Customize. */
  IF NOT menufound THEN
        Set_Menu_Item_Property('MAIN_MENU.CUSTOMIZE', LABEL, 'C&ustomize');
  END IF;
END; /* End of Procedure Populate_Menu_Items */


Program Unit: Call_Module
PROCEDURE Call_module ( p_cm_name Varchar2) IS
        v_cm_type varchar2(30);
        v_cm_module varchar2(30);

BEGIN
        SELECT cm_type, cm_module 
        INTO v_cm_type, v_cm_module
        FROM customize_menu
        WHERE cm_name = p_cm_name;

        IF v_cm_type = 'FORMS' THEN
                Call_Form( v_cm_module, HIDE, NO_REPLACE );
        ELSE
                Run_Product( REPORTS, v_cm_module, SYNCHRONOUS, RUNTIME, FILESYSTEM, NULL, NULL );
        END IF;

EXCEPTION
        WHEN OTHERS THEN
        MESSAGE('When Others error...'||sqlerrm);
END;


Mod-upd: Add 'code' blocks.

[Updated on: Mon, 26 December 2005 19:28] by Moderator

Report message to a moderator

Re: Please Help : Creating dynamic Menu [message #152722 is a reply to message #152290] Mon, 26 December 2005 19:35 Go to previous messageGo to next message
djmartin
Messages: 10181
Registered: March 2005
Location: Surges Bay TAS Australia
Senior Member
Account Moderator
This is a really nice example. It would be nice if you would add the field description of the CUSTOMIZE_MENU table.

The word "Administration" is just that, a word. You can use anything. Just create yourself a menu, or take your current menu and add a new top level entry, call it "Administration", or "Test", or "xyzzy". It does not make any difference.

The rest of the explanation looks fairly start forward.

David
Re: Please Help : Creating dynamic Menu [message #202332 is a reply to message #152290] Thu, 09 November 2006 03:09 Go to previous messageGo to next message
jivnath
Messages: 14
Registered: May 2005
Location: Kathmandu
Junior Member
Could you please post .fmb file.
Re: Please Help : Creating dynamic Menu [message #202511 is a reply to message #152290] Fri, 10 November 2006 02:26 Go to previous messageGo to next message
jivnath
Messages: 14
Registered: May 2005
Location: Kathmandu
Junior Member
I am using form6i Version 6.0.8.8.0 and Confused on below line
where can i found that command Text property of Menu Customize.

4. In the Object Navigator, change the "Command Text" property for "CUSTOMIZE" to "CUSTOMIZE_menu" and the parent menu item of "FORMS" and "REPORTS" to "CUSTOMIZE_menu".
Re: Please Help : Creating dynamic Menu [message #631099 is a reply to message #152290] Fri, 09 January 2015 02:06 Go to previous messageGo to next message
pakgmd
Messages: 1
Registered: June 2014
Location: Pakistan
Junior Member

Dear Concern

Plz. share me form of Creating dynamic Menu A.S.A.P

thanks in advance

awaiting your reply
Re: Please Help : Creating dynamic Menu [message #631166 is a reply to message #631099] Fri, 09 January 2015 15:44 Go to previous messageGo to next message
joy_division
Messages: 4963
Registered: February 2005
Location: East Coast USA
Senior Member
Not a good way to make a first post in the forum.
Re: Please Help : Creating dynamic Menu [message #648905 is a reply to message #631166] Mon, 07 March 2016 02:29 Go to previous messageGo to next message
iliachh
Messages: 1
Registered: December 2011
Location: Dhaka
Junior Member

Please give screen short for all points.

thanks in advance
awaiting your reply
Re: Please Help : Creating dynamic Menu [message #648906 is a reply to message #648905] Mon, 07 March 2016 02:53 Go to previous message
Littlefoot
Messages: 21806
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
This is turning into another "me too" topic and is, therefore, locked for further "discussion".

If anyone needs a FMB, screenshots etc., feel free to contact the original poster - imhamedi. Note that his last visit to this forum was in December 2005 so - don't be too optimistic.
Previous Topic: find visual_attribute item
Next Topic: How to know from which input device data is entered into application
Goto Forum:
  


Current Time: Thu Mar 28 03:20:18 CDT 2024