home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #16 / NN_1992_16.iso / spool / comp / windows / x / 14165 < prev    next >
Encoding:
Internet Message Format  |  1992-07-21  |  6.3 KB

  1. Xref: sparky comp.windows.x:14165 comp.windows.x.motif:5122
  2. Newsgroups: comp.windows.x,comp.windows.x.motif
  3. Path: sparky!uunet!sun-barr!decwrl!csus.edu!netcomsv!mork!rogerr
  4. From: rogerr@netcom.com (roger reynolds)
  5. Subject: Motif Stay Up Menus with WCL
  6. Message-ID: <k!fm!8#.rogerr@netcom.com>
  7. Date: Tue, 21 Jul 92 23:26:31 GMT
  8. Organization: Netcom - Online Communication Services  (408 241-9760 guest) 
  9. Followup-To: poster
  10. Lines: 209
  11.  
  12.  
  13. Hi, 
  14.     
  15. Included below is a very small example to demonstrate a technique for
  16. implementing "stay-up" menus in Motif.  I just got the idea to try
  17. this this morning, and this afternoon I have a reasonable hack to do
  18. "Stay Up", "Tear Off", "Sticky", "Pinnable", or "whatever you want to call
  19. this sort of thing", menus.
  20.  
  21. This happens to use WCL cuz it is so cool, but you could use the 
  22. same approach if you were writing an application in straight C.
  23. (does anybody actually do that anymore ?:)
  24. It may be easiar to see what is going on to read the second
  25. part of this note which is a blurb on a preprocessor for WCL which
  26. I have written and use.
  27.  
  28. Comments welcomed,
  29. rogerr@netcom.com
  30.  
  31.  
  32.  
  33.  
  34.  
  35. You should be able to "run" the app-defaults definitions below
  36. with Mri to see the example in action.
  37. !
  38. !
  39. !  Demostration Resource File for Stay Up Menus
  40. !
  41. !
  42. Mri.wcChildren: main
  43. *main.wcClassName: XmMainWindow
  44. *main.wcChildren: menuBar
  45. *menuBar.wcConstructor:    XmCreateMenuBar
  46. *menuBar.wcChildren:    fileMenu fileBtn
  47. *menuBar.*background:slategray
  48. *menuBar.*foreground:white
  49. *menuBar.#    wcCallback: WcSetValueCB
  50. *fileBtn.wcConstructor:    XmCreateCascadeButton
  51. *fileBtn.labelString:         File
  52. *fileBtn.wcCallback:    WcSetValueCB(this.subMenuId: ~*fileMenu)        WcTranslations(this, #override Shift<Btn1Up>: WcCreateChildrenACT(~,fileBB))
  53. *fileMenu.wcConstructor: XmCreatePulldownMenu
  54. *fileMenu.wcManaged:     False
  55. *fileMenu.wcChildren:    fileOpenBtn filePropBtn\
  56.      fileSelectAllBtn filePrintBtn fileDeleteBtn\
  57.      showMessagesBtn fileExitBtn
  58. *fileBB.wcConstructor: XmCreateBulletinBoardDialog
  59. *fileBB.wcChildren:   rc
  60. *fileBB.wcCallback:   WcSetValueCB(^.title:File Menu)
  61. *fileBB.*marginWidth:0
  62. *fileBB.*marginHeight:0
  63. *fileBB.*background:slategray
  64. *fileBB.*foreground:white
  65. *fileBB.rc.wcClassName: XmRowColumn
  66. *fileBB.rc.wcChildren: fileOpenBtn filePropBtn\
  67.     fileSelectAllBtn filePrintBtn fileDeleteBtn\
  68.     showMessagesBtn fileExitBtn
  69. *fileOpenBtn.wcClassName:    XmPushButton
  70. *fileOpenBtn.labelString:      Open ...
  71. *fileOpenBtn.activateCallback:  WcTraceCB
  72. *filePropBtn.wcClassName:    XmPushButton
  73. *filePropBtn.labelString:      Properties ...
  74. *filePropBtn.activateCallback:  WcTraceCB
  75. *fileSelectAllBtn.wcClassName:    XmPushButton
  76. *fileSelectAllBtn.labelString:      Select All
  77. *fileSelectAllBtn.activateCallback:    fileSelectAll
  78. *filePrintBtn.wcClassName:    XmPushButton
  79. *filePrintBtn.labelString:      Print
  80. *filePrintBtn.activateCallback:  WcTraceCB
  81. *fileDeleteBtn.wcClassName:    XmPushButton
  82. *fileDeleteBtn.labelString:      Delete
  83. *fileDeleteBtn.activateCallback:  WcTraceCB
  84. *showMessagesBtn.wcClassName:    XmPushButton
  85. *showMessagesBtn.labelString:      Show Messages
  86. *showMessagesBtn.activateCallback:  WcTraceCB
  87. *fileExitBtn.wcClassName:    XmPushButton
  88. *fileExitBtn.labelString:      Exit
  89. *fileExitBtn.activateCallback:  WcExitCB
  90. !
  91. !
  92. ! End of Resource File
  93. !
  94. !
  95.  
  96.  
  97. #
  98. #
  99. # What follows here is the "source code" which I used to generate
  100. # the app-defaults statements above.  I include it only as in introduction
  101. # to the "RIL" language - you won't be able to do anyting useful with
  102. # it except see what it looks like.
  103. #
  104. # This "RIL" language which I have been developing over the past couple
  105. # of months, is basically a preprocessor for WCL.
  106. # I use it all the time, and think that it is a pretty neat thing.
  107. # The output can be written to a file (as above) or loaded directly
  108. # via xrm at run time.
  109. #
  110. # The first thing to note about the "RIL" version of this program is
  111. # that it is quite a bit more readable than a straight app-defaults file
  112. # would be.  This becomes more and more important as the size of your
  113. # application (and thus app-defaults file(s)) become.
  114. #
  115. # What this example does not show is the ability of RIL to define functions,
  116. # set variables, use conditional statements and looping constructs,
  117. # include other RIL files and on and on...
  118. # "RIL or "Roger's Interface Language"  is based on TCL.
  119. # If you don't know what TCL is, you should make an effort to find out.
  120. # It will be worth it to you, I promise.
  121. #
  122. # I think that anybody that is currently using WCL should be very 
  123. # interested in something like RIL.  Particularly, this can serve
  124. # as a UIL replacement for those using OLIT or ATHENA.
  125. # I am considering makeing RIL availabale for public use,
  126. # Positive/Constructive Negative comments would help me decide...
  127. #
  128. #
  129. Widget Mri {
  130.     wcChildren: main
  131. }
  132.  
  133. Widget *main {
  134.     wcClassName: XmMainWindow
  135.     wcChildren: menuBar
  136. }
  137.  
  138. Widget *menuBar {
  139.     wcConstructor:    XmCreateMenuBar
  140.     wcChildren:    fileMenu fileBtn
  141.     *background:slategray
  142.     *foreground:white
  143. }
  144.  
  145. #
  146. ## File menu
  147. #
  148. Widget *fileBtn {
  149.     wcConstructor:    XmCreateCascadeButton
  150.     labelString:         File
  151.     wcCallback:    WcSetValueCB(this.subMenuId: ~*fileMenu)\
  152.         WcTranslations(this,\
  153.             #override Shift<Btn1Up>: WcCreateChildrenACT(~,fileBB))
  154. }
  155.  
  156. Widget *fileMenu {
  157.     wcConstructor: XmCreatePulldownMenu
  158.     wcManaged:     False
  159.     wcChildren:    fileOpenBtn filePropBtn \
  160.         fileSelectAllBtn filePrintBtn fileDeleteBtn \
  161.         showMessagesBtn fileExitBtn
  162. }
  163.  
  164. Widget *fileBB {
  165.     wcConstructor: XmCreateBulletinBoardDialog
  166.     wcChildren:   rc
  167.     wcCallback:   WcSetValueCB(^.title:File Menu)
  168.     *marginWidth:0
  169.     *marginHeight:0
  170.     *background:slategray
  171.     *foreground:white
  172.     rc.wcClassName: XmRowColumn
  173.     rc.wcChildren: fileOpenBtn filePropBtn \
  174.         fileSelectAllBtn filePrintBtn fileDeleteBtn \
  175.         showMessagesBtn fileExitBtn
  176. }
  177.  
  178. Resources *XmPushButton {
  179.     activateCallback:  WcTraceCB
  180. }
  181.  
  182. Widget *fileOpenBtn {
  183.     wcClassName:    XmPushButton
  184.     labelString:      Open ...
  185. }
  186.  
  187. Widget *filePropBtn {
  188.     wcClassName:    XmPushButton
  189.     labelString:      Properties ...
  190. }
  191.  
  192. Widget *fileSelectAllBtn {
  193.     wcClassName:    XmPushButton
  194.     labelString:      Select All
  195. }
  196.  
  197. Widget *filePrintBtn {
  198.     wcClassName:    XmPushButton
  199.     labelString:      Print
  200. }
  201.  
  202. Widget *fileDeleteBtn {
  203.     wcClassName:    XmPushButton
  204.     labelString:      Delete
  205. }
  206.  
  207. Widget *showMessagesBtn {
  208.     wcClassName:    XmPushButton
  209.     labelString:      Show Messages
  210. }
  211.  
  212. Widget *fileExitBtn {
  213.     wcClassName:    XmPushButton
  214.     labelString:      Exit
  215.     activateCallback:  WcExitCB
  216. }
  217.  
  218.  
  219.