       IDENTIFICATION DIVISION.
       PROGRAM-ID. NAVIGATE.
       ENVIRONMENT DIVISION.
       DATA DIVISION.
       WORKING-STORAGE SECTION.

           COPY "MOBILECOBOL.WS".

       01 any-key pic x.

       PROCEDURE DIVISION.
       MAIN-LOGIC.
           PERFORM SHOW-PAGE-1.
           PERFORM HANDLE-EVENTS
               UNTIL MC-EVENT = "QUIT".
           GOBACK.

       HANDLE-EVENTS.
           CALL MC USING GETEVENT MC-EVENTINFO.
           DISPLAY MC-EVENT-CONTROL (1:30) "  " MC-EVENT (1:30).
           EVALUATE MC-EVENT
               WHEN "Clicked"
                   EVALUATE MC-EVENT-CONTROL
                       WHEN "BTN1" PERFORM SHOW-PAGE-2
                       WHEN "BTN3" PERFORM SHOW-PAGE-3
                       WHEN "BTN6" PERFORM SHOW-PAGE-4
                       WHEN "BTN2" PERFORM GO-BACK-ONE-PAGE
                       WHEN "BTN4" PERFORM GO-BACK-ONE-PAGE
                       WHEN "BTN5" PERFORM GO-BACK-ONE-PAGE
                   END-EVALUATE
           END-EVALUATE.

       SHOW-PAGE-1.
           CALL MC USING CREATEPAGE  "Name=Page1|".
           CALL MC USING ADDCHILD  
               "Type=StackLayout;Padding=20;Spacing=15|". 
           CALL MC USING ADDCHILD "Type=Label;Text=HELLO|".
           CALL MC USING SETPROP   "FontSize=24|".
           CALL MC USING ADDCHILD "Type=Entry;Placeholder=Text|".
           CALL MC USING ADDCHILD                                       
                            "Type=Button;Name=BTN1;Text=Show Page 2|".           
           CALL MC USING SETPROP   "Event=Clicked|".
           CALL MC USING ADDCHILD                                        
                            "Type=Button;Name=BTN6;Text=Show Page 4|".
           CALL MC USING SETPROP   "Event=Clicked|".
           CALL MC USING SHOWPAGE.

       SHOW-PAGE-2.
           CALL MC USING CREATEPAGE  "Name=Page2|".
           CALL MC USING ADDCHILD  
               "Type=StackLayout;Padding=20;Spacing=15|". 
           CALL MC USING ADDCHILD "Type=Label;Text=WELCOME TO PAGE 2|".
           CALL MC USING SETPROP   "FontSize=24|".
           CALL MC USING ADDCHILD "Type=Entry;Placeholder=Text|".
           CALL MC USING ADDCHILD "Type=Button;Name=BTN2;Text=Go Back|".
           CALL MC USING SETPROP   "Event=Clicked|".
           CALL MC USING ADDCHILD                                        
                            "Type=Button;Name=BTN3;Text=Show Page 3|".
           CALL MC USING SETPROP   "Event=Clicked|".
           CALL MC USING SHOWPAGE.

       SHOW-PAGE-3.
           CALL MC USING CREATEPAGE  "Name=Page3|".
           CALL MC USING ADDCHILD  
               "Type=StackLayout;Padding=20;Spacing=15|". 
           CALL MC USING ADDCHILD "Type=Label;Text=WELCOME TO PAGE 3|".
           CALL MC USING SETPROP   "FontSize=24|".
           CALL MC USING ADDCHILD "Type=Entry;Placeholder=Text|".
           CALL MC USING ADDCHILD "Type=Button;Name=BTN4;Text=Go Back|".
           CALL MC USING SETPROP    "Event=Clicked|".
           CALL MC USING SHOWPAGE.
           
       SHOW-PAGE-4.
           CALL MC USING CREATEPAGE "Name=Page4|".
           CALL MC USING ADDCHILD  
               "Type=StackLayout;Padding=20;Spacing=15|". 
           CALL MC USING ADDCHILD "Type=Label;Text=WELCOME TO PAGE 4|".
           CALL MC USING SETPROP   "FontSize=24|".
           CALL MC USING ADDCHILD "Type=Entry;Placeholder=Text|".
           CALL MC USING ADDCHILD "Type=Button;Name=BTN5;Text=Go Back|".
           CALL MC USING SETPROP    "Event=Clicked|".
           CALL MC USING SHOWPAGE.
           
       GO-BACK-ONE-PAGE.
           CALL MC USING NAVBACK.

