home *** CD-ROM | disk | FTP | other *** search
/ The Developer Connection…ice Driver Kit for OS/2 3 / DEV3-D1.ISO / devtools / dataflex / kp_helpe.pkg < prev    next >
Encoding:
Text File  |  1993-05-19  |  6.7 KB  |  188 lines

  1. // KP_HELPE.PKG
  2. // May 23, 1991
  3. // LS
  4. //
  5. // Keyproc_Help_Edit package for editing help in non-ui and "mixed" ui programs
  6.  
  7. #CHKSUB 1 1 // Verify the UI subsystem.
  8.  
  9. use Helpedit
  10.  
  11. class Keyproc_Help_Edit_Name is an Array
  12.     procedure Construct_Object
  13.         forward send Construct_Object
  14.  
  15.         property integer Keyproc_Help_Edit_State Public
  16.         property integer Help_Name_ID            Public
  17.     end_procedure
  18. end_class
  19.  
  20. //----------------------  KEYPROC_HELP_SAVE_CONFIRM -----------------------//
  21.  
  22. /Keyproc_Help_Save_Confirm_Img
  23. ╔════════════════════════════════════════════════════════════════════╗
  24. ║____________________________________________________________________║
  25. ║                                                                    ║
  26. ║      Create Link for Group: _________________________________      ║
  27. ║                and Subject: _________________________________      ║
  28. ║                                                                    ║
  29. ║           ┌─ Create Link and assign to Context: ───────┐           ║
  30. ║           │  ________________________________________  │           ║
  31. ║           │  ________________________________________  │           ║
  32. ║           │  ________________________________________  │           ║
  33. ║           └────────────────────────────────────────────┘           ║
  34. ║   _______________________   ________________   ________   ______   ║
  35. ║                                                                    ║
  36. ╚════════════════════════════════════════════════════════════════════╝
  37. /*
  38. //  <Save Link and Context>   <Save Link Only>   <Cancel>   <Help>
  39. sub_page Keyproc_Help_Title_Img     from Keyproc_Help_Save_Confirm_Img 1
  40. sub_page Keyproc_Help_Name_List_Img from Keyproc_Help_Save_Confirm_Img 4 5 6
  41. sub_page Keyproc_Help_Save_Btns_Img from Keyproc_Help_Save_Confirm_Img 7 8 9 10
  42.  
  43. register_object Keyproc_Help_Editor
  44. register_object Window_Help
  45.  
  46. object Keyproc_Help_Save_Confirm is a Client Keyproc_Help_Save_Confirm_Img
  47.     set Location    to 4 4 Relative
  48.     set Popup_State to True
  49.     set Scope_State to True
  50.  
  51.     object Title is a Title Keyproc_Help_Title_Img
  52.         set Center_State item 0 to True
  53.         set Value        item 0 to "Save Help"
  54.     end_object
  55.     
  56.     object Name_List is a Menu Keyproc_Help_Name_List_Img
  57.         set Select_Mode        to Auto_Select
  58.         set Local_Rotate_State to False
  59.  
  60.         item_list
  61.             on_item "" send Switch
  62.             on_item "" send Switch
  63.             on_item "" send Switch
  64.         end_item_list
  65.     end_object
  66.  
  67.     object Buttons is a Button Keyproc_Help_Save_Btns_Img
  68.         item_list
  69.             on_item "<Save Link and Context>" send Save_Both
  70.             on_item "<Save Link Only>"        send Save_Link
  71.             on_item "<Cancel>"                send Cancel
  72.             on_item "<Help>"                  send Help
  73.         end_item_list
  74.     end_object
  75.  
  76.     on_key key_Shift+key_F1 send None
  77.     on_key kCancel          send Cancel
  78.     on_key kHelp            send Help
  79.  
  80.     procedure Save_Both returns integer
  81.         procedure_return Current_Message
  82.     end_procedure
  83.  
  84.     procedure Save_Link returns integer
  85.         procedure_return Current_Message
  86.     end_procedure
  87.  
  88.     procedure Activating
  89.         local integer Obj Nam_Lst
  90.  
  91.         forward send Activating
  92.  
  93.         move (Name_List( Current_Object )) to Nam_Lst
  94.         move (Keyproc_Help_Editor( Desktop )) to Obj
  95.         set Value item 1 to (Current_Group( Help_Editor( Desktop ) ))
  96.         set Value item 2 to (Current_Subject( Help_Editor( Desktop ) ))
  97.         set Value of Nam_Lst item 0 to ("WINDOW_" + ;
  98.           string( Help_Name_ID( Window_Help( Obj ) ) ))
  99.         set Value of Nam_Lst item 1 to ("IMAGE_" + ;
  100.           string( Help_Name_ID( Obj ) ))
  101.         set Value of Nam_Lst item 2 to (Help_Name( Desktop ))
  102.         set Current_Item of Nam_Lst to 0
  103.     end_procedure
  104.  
  105.     function Keyproc_Save_Name returns string
  106.         function_return (Value( Name_List( Current_Object ), Current ))
  107.     end_function
  108. end_object
  109.  
  110. //-------------------------  KEYPROC_HELP_EDITOR --------------------------//
  111.  
  112. object Keyproc_Help_Editor is a Keyproc_Help_Edit_Name
  113.     object Window_Help is a Keyproc_Help_Edit_Name
  114.         function Help_Name returns String
  115.             local string Hlp_Nam
  116.  
  117.             if (Keyproc_Help_Edit_State( Parent( Current_Object ) )) ;
  118.               function_return ;
  119.               ("WINDOW_" + string( Help_Name_ID( Current_Object ) ))
  120.             else begin
  121.                 forward get Help_Name to Hlp_Nam
  122.                 function_return Hlp_Nam
  123.             end
  124.         end_function
  125.     end_object
  126.  
  127.     function Help_Name returns String
  128.         local string Hlp_Nam
  129.  
  130.         if (Keyproc_Help_Edit_State( Current_Object )) function_return ;
  131.           ("IMAGE_" + string( Help_Name_ID( Current_Object ) ))
  132.         else begin
  133.             forward get Help_Name to Hlp_Nam
  134.             function_return Hlp_Nam
  135.         end
  136.     end_function
  137.  
  138.     procedure Request_Edit_Help integer Img integer Win
  139.         set Keyproc_Help_Edit_State to True
  140.         set Help_Name_ID to Img
  141.         set Help_Name_ID of (Window_Help( Current_Object )) to Win
  142.         send Request_Edit_Help to (Help_Editor(Desktop)) (Window_Help( Current_Object ))
  143.         start_ui
  144.     end_procedure
  145. end_object
  146.  
  147. // override procedures in help_editor object
  148.  
  149. procedure Save_Help FOR (Class( Help_Editor( Desktop ) ))
  150.     local integer Ret_Val Obj Msg_Val Orig
  151.     local string Hlp_Name
  152.  
  153.     get Focus to Obj
  154.  
  155.     get Original_Focus to Orig
  156.     if Orig EQ 0 move Desktop to Orig
  157.  
  158.     if (Keyproc_Help_Edit_State( Keyproc_Help_Editor( Desktop ) )) begin
  159.         ui_accept Keyproc_Help_Save_Confirm to Msg_Val
  160.         get Keyproc_Save_Name of Keyproc_Help_Save_Confirm to Hlp_Name
  161.         get Find_Help_Context (Application_Name( Orig )) (Module_Name( Orig )) ;
  162.             Hlp_Name to Ret_Val
  163.     end
  164.     else begin
  165.         get Context_Help_Name of (Original_Focus( Current_Object )) to Hlp_Name
  166.         get Find_Help_Context (Application_Name( Orig )) (Module_Name( Orig )) ;
  167.             Hlp_Name to Ret_Val
  168.         ui_accept (Keyproc_Help_Save_Confirm( Current_Object )) to Msg_Val
  169.     end
  170.  
  171.     send Save_Help_Records Msg_Val Obj Hlp_Name
  172. end_procedure
  173.  
  174. procedure Request_Cancel FOR (Class( Help_Editor( Desktop ) ))
  175.     send Deactivate_Area
  176.  
  177.     if (Keyproc_Help_Edit_State( Keyproc_Help_Editor( Desktop ) )) begin
  178.         set Keyproc_Help_Edit_State of Keyproc_Help_Editor to False
  179.         procedure_return 1
  180.     end
  181. end_procedure
  182.  
  183. // global procedure to access help_editor (keyproc version)
  184.  
  185. procedure Keyproc_Edit_Help FOR DESKTOP
  186.     send Request_Edit_Help to Keyproc_Help_Editor Current_Image Current_Window
  187. end_procedure
  188.