! EVE_BUTTON_BOX.TPU 8-SEP-1989 15:32 Page 1 !++ ! Table of Contents ! ! EVE_BUTTON_BOX.TPU ! 8-SEP-1989 15:32 ! ! Procedure name Page Description ! -------------- ---- ------------ ! ! eve_button_box 2 User commands => pushbuttons ! evex$button_dialog_box 2 Make a button dialog box ! eve_dismiss_box 3 Button box. Exec.frm callback ! evex$create_button 3 create single button (recursive) !-- ! This module implements "button boxes" in DECwindows. Command format is: ! button box eve_command1 eve_command2 eve_command3 eve_command4 eve_command5 ! Examples: ! button top bottom ! button box "Set Keypad Edt" "Set Keypad WPS" "Set Keypad VT100" ! button box One Split "Split 3" ! TPU Declarations for DECWindows Toolkit constants constant eve$kt_pushbuttonwidgetclass := "pushbuttonwidgetclassrec"; constant eve$kt_nactivate_callback := "activateCallback"; ! Use these constants as arguments to the DEFINE_WIDGET builtin. ! (the strings are actually the symbols which evaluate to the ! widget class records for the DECwindows widgets.) constant evex$kt_dialogwidgetclass := "dialogwidgetclassrec", evex$dwt$c_ntitle := "title"; ! These constants defined and used only by these routines - constant evex$kt_x_pos := 500, ! Screen position for box evex$kt_y_pos := 500, evex$kt_x_border := 5, ! Spacing between left borders of button & box evex$kt_y_increment := 20, ! Vertical spacing between buttons evex$kt_dismiss_increment := 5; ! x and y offset of final dismiss button ! EVE_BUTTON_BOX.TPU Page 2 procedure eve_button_box ! User commands => pushbuttons (c1; c2, c3, c4, c5, c6, c7, c8, c9, c10) ! The commands ! This is the EVE command which implements button boxes if evex$button_dialog_box ("EVE") ! Create a dialog box then if evex$create_button (evex$kt_x_border, 0, ! Populate it with buttons c1, c2, c3, c4, c5, c6, c7, c8, c9) then manage_widget (evex$x_dialog_box); ! Now display the resulting box return (TRUE); endif; endif; return (FALSE); endprocedure ! procedure evex$button_dialog_box (the_title) ! Make a button dialog box ! Define the dialog box widget class and pushbutton widget class evex$kt_dialog_class := define_widget_class (evex$kt_dialogwidgetclass, "dwt$dialog_box_popup_create"); evex$kt_pushbutton_class := define_widget_class (eve$kt_pushbuttonwidgetclass, "dwt$push_button_create"); evex$x_dialog_box := create_widget (evex$kt_dialog_class, "EVE Button", SCREEN, "message('callback activated')", "closure not used ", evex$dwt$c_ntitle, the_title, eve$dwt$c_nx, evex$kt_x_pos, eve$dwt$c_ny, evex$kt_y_pos); if get_info (evex$x_parent_widgets, 'type') <> ARRAY then ! Create an array of button box dialog widgets for later use evex$x_parent_widgets := create_array; endif; return TRUE; endprocedure ! EVE_BUTTON_BOX.TPU Page 3 procedure eve_dismiss_box ! Button box. Exec.frm callback local status, temp_array, this_widget; status := get_info (WIDGET, "callback_parameters", temp_array); this_widget := temp_array {'widget'}; ! array of button box dialog widgets is indexed by their dismiss button widgets delete (evex$x_parent_widgets {this_widget}); endprocedure ! eve_dismiss_box procedure evex$create_button ! create single button (recursive) (my_x, my_y, c1; c2, c3, c4, c5, c6, c7, c8, c9, c10) local button_widget; ! Temp storeage for widget we will create button_widget := create_widget ! Display first button in list (evex$kt_pushbutton_class, "Key", evex$x_dialog_box, compile (eve$$parse (c1)), ! NOTE: This is not considered ! an acceptable programming ! practice as it calls an EVE ! procedure which is NOT part ! of the EVE public interface. ! This code may fail to work ! under future EVE releases. ! "eve$process_command('" + c1 + "')", ! This alternative to ! the eve$$parse call ! above, while slower ! is supported as part ! of the EVE public ! interface. "closure not used ", eve$dwt$c_nx, my_x, eve$dwt$c_ny, my_y, eve$kt_nactivate_callback, 0, eve$dwt$c_nlabel, c1); manage_widget (button_widget); if my_x <> evex$kt_x_border then ! We just mapped the dismiss box evex$x_parent_widgets {button_widget} := evex$x_dialog_box; return TRUE; endif; if c2 <> tpu$k_unspecified then if c2 <> "" then ! The next command is unspecified when this routine is called from ! itself for the last command in the list, but the EVE parser uses ! null strings for missing parameters, hence the double check. ! The next command is valid; recurse over remaining command parameters. evex$create_button (my_x, my_y + evex$kt_y_increment, c2, c3, c4, c5, c6, c7, c8, c9); return TRUE; endif; endif; evex$create_button (evex$kt_x_border + evex$kt_dismiss_increment, my_y + evex$kt_y_increment + evex$kt_dismiss_increment, "Dismiss Box"); return TRUE; endprocedure ! evex$create_button