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

  1. // key_btn.pkg
  2. // April 17, 1991
  3. // LS
  4. //
  5. // package for Key_Button class: moves to focus of key_button's parent's scope,
  6. // then sends message
  7. //
  8. // example:
  9. //          use key_btn
  10. //          ...
  11. //
  12. //          sub_page keys_img from client_img 6 7 8 9
  13. //          
  14. //          object keys is a key_button keys_img
  15. //              set location to 5 10 relative
  16. //
  17. //              item_list
  18. //                  on_item "<F4=Prompt>"   send prompt
  19. //                  on_item "<F5=Clear>"    send zoom
  20. //                  on_item "<Alt+F9=Zoom>" send clear
  21. //                  on_item "<Alt+R=Read>"  send read_file to file_object
  22. //              end_item_list
  23. //          end_object
  24.  
  25. #CHKSUB 1 1 // Verify the UI subsystem.
  26.  
  27. use UI
  28.  
  29. class Key_Button is a Button
  30.     procedure Construct_Object integer Img
  31.         forward send Construct_Object Img
  32.  
  33.         set Focus_Mode  to Pointer_Only
  34.         set Scope_State to True
  35.  
  36.         on_key kEnter send Redirect_Message // redirect msg for kEnter (mouse_up)
  37.     end_procedure
  38.  
  39.     procedure Redirect_Message returns integer
  40.         local integer Msg Ret_Val Obj Sco
  41.  
  42.         if (Shadow_State( Current_Object, Current )) procedure_return 0
  43.                                         // ignore shadowed buttons
  44.         get Message to Msg
  45.         get Aux_Value to Obj
  46.  
  47.         move 0 to Ret_Val
  48.  
  49.         get Find_Scope of (Parent(Current_Object)) to Sco
  50.  
  51.         if Sco EQ 0 move Desktop to Sco
  52.  
  53.         if (Focus( Desktop )) NE (Scope_Focus( Sco )) ;
  54.           set Current_Scope to Sco
  55.  
  56.         if Obj EQ 0 get Focus of Desktop to Obj
  57.         get Msg of Obj to Ret_Val
  58.         procedure_return Ret_Val
  59.     end_procedure
  60. end_class
  61.