Add menu
scripts to trigger user events
Where you are
> Add menu scripts
to trigger user events
Attach the new menu and
run the application
Now you add scripts to trigger user events from the sheet window
menu bar. You added these user events in Modifying the Ancestor
Window. The Menu painter should still be open for the m_my_sheet
menu. If it is not, you can open it using the Open button in the
PowerBar.
-
Select m_edit.m_insert in the first list box in the Script
viewor
Double-click the Insert menu item in the WYSIWYG view.
The full name of the Insert menu item displays in the first list
box of the Script view. It includes the m_edit prefix to indicate that
it is in the Edit menu. -
Select Clicked in the second drop-down box if it is not already
selected.Type these lines for the Clicked event:
123w_master_detail_ancestor lw_activesheetlw_activesheet = w_pbtutor_frame.GetActiveSheet()lw_activesheet.EVENT ue_insert()The first two lines determine which sheet in the MDI frame is
currently active. The third line triggers the user event ue_insert for
the active sheet. -
Repeat steps 1 and 2 for the following menu items and
scripts:Menu name
Script for Clicked event
m_edit.m_update
123w_master_detail_ancestor lw_activesheetlw_activesheet=w_pbtutor_frame.GetActiveSheet()lw_activesheet.EVENT ue_update()m_edit.m_delete
123w_master_detail_ancestor lw_activesheetlw_activesheet = w_pbtutor_frame.GetActiveSheet()lw_activesheet.EVENT ue_delete() -
Select File>Save from the PowerBuilder menu bar.
PowerBuilder compiles and saves the menu scripts.
-
Click the Close button in PainterBar1
or
Select File>Close from the PowerBuilder menu bar.