home *** CD-ROM | disk | FTP | other *** search
/ PC Online 1998 November / PCO_1198.ISO / filesbbs / os2 / tspg202s.arj / TSPG202S.ZIP / Scripts / OBJPROP.CWX < prev    next >
Encoding:
Text File  |  1997-05-04  |  1.6 KB  |  68 lines

  1. /*
  2.   objprop.cwx
  3.  
  4.   This script displays the properties of the currently selected object.
  5.  
  6.  Copyright 1997 by TrueSpectra Inc.                                  
  7.                                                                      
  8.  This code is provided purely for demonstration purposes and is not  
  9.  supported or under warranty.  Feel free to modify and examine this  
  10.  example script for your own purposes.                               
  11.  
  12. */
  13.  
  14.  
  15. /* Get the currently selected object. */
  16.  
  17. handle = CwGetSelectedObject();
  18.  
  19. if \CwIsHandleValid(handle) then do
  20.     say "No object selected."
  21.     exit
  22.     end
  23.  
  24.  
  25. /* Currently, there's no way to do multiline output, so I'm going to try something
  26.    cute here. */
  27. cr = x2c('0A');
  28.  
  29. /* Get info about the object. */
  30. name = 'Name:' CwGetName(handle);
  31.  
  32. call CwGetPosition handle, pos;
  33. position = 'Position:' pos.x||', '||pos.y||cr||'Dim:' pos.width||'X'||pos.height   ,
  34.     cr||'Rotation:' pos.rotation||cr||'Shear:' pos.xshear;
  35.  
  36. property = getProps(handle)
  37.  
  38. if CwGetHandleType(handle) \= "Group" then do
  39.     toolprop = getProps(CwGetTool(handle))
  40.     regprop = getProps(CwGetRegion(handle))
  41.     end
  42.  
  43. /* Display results. */
  44. say name||cr||position||cr||'Properties: '||cr||property
  45.  
  46. if CwGetHandleType(handle) \= "Group" then do
  47.     say 'Tool properties:'||cr||toolprop
  48.     say 'Region properties:'||cr||regprop
  49.     end
  50. exit
  51.  
  52.  
  53.  
  54.  
  55. getprops:procedure expose cr
  56. arg handle
  57.  
  58. p = CwGetFirstProperty(handle)
  59. property=''
  60. do while p \= ''
  61.     property = property||"  '" || p || "' = '"||CwGetProperty(handle,p)||"'" , 
  62.         '('|| CwGetPropertyType(handle,p) || ')' || cr;
  63.     p = CwGetNextProperty()
  64.     end
  65.  
  66. return property
  67.  
  68.