home *** CD-ROM | disk | FTP | other *** search
- Xref: sparky comp.windows.x:14165 comp.windows.x.motif:5122
- Newsgroups: comp.windows.x,comp.windows.x.motif
- Path: sparky!uunet!sun-barr!decwrl!csus.edu!netcomsv!mork!rogerr
- From: rogerr@netcom.com (roger reynolds)
- Subject: Motif Stay Up Menus with WCL
- Message-ID: <k!fm!8#.rogerr@netcom.com>
- Date: Tue, 21 Jul 92 23:26:31 GMT
- Organization: Netcom - Online Communication Services (408 241-9760 guest)
- Followup-To: poster
- Lines: 209
-
-
- Hi,
-
- Included below is a very small example to demonstrate a technique for
- implementing "stay-up" menus in Motif. I just got the idea to try
- this this morning, and this afternoon I have a reasonable hack to do
- "Stay Up", "Tear Off", "Sticky", "Pinnable", or "whatever you want to call
- this sort of thing", menus.
-
- This happens to use WCL cuz it is so cool, but you could use the
- same approach if you were writing an application in straight C.
- (does anybody actually do that anymore ?:)
- It may be easiar to see what is going on to read the second
- part of this note which is a blurb on a preprocessor for WCL which
- I have written and use.
-
- Comments welcomed,
- rogerr@netcom.com
-
-
-
-
-
- You should be able to "run" the app-defaults definitions below
- with Mri to see the example in action.
- !
- !
- ! Demostration Resource File for Stay Up Menus
- !
- !
- Mri.wcChildren: main
- *main.wcClassName: XmMainWindow
- *main.wcChildren: menuBar
- *menuBar.wcConstructor: XmCreateMenuBar
- *menuBar.wcChildren: fileMenu fileBtn
- *menuBar.*background:slategray
- *menuBar.*foreground:white
- *menuBar.# wcCallback: WcSetValueCB
- *fileBtn.wcConstructor: XmCreateCascadeButton
- *fileBtn.labelString: File
- *fileBtn.wcCallback: WcSetValueCB(this.subMenuId: ~*fileMenu) WcTranslations(this, #override Shift<Btn1Up>: WcCreateChildrenACT(~,fileBB))
- *fileMenu.wcConstructor: XmCreatePulldownMenu
- *fileMenu.wcManaged: False
- *fileMenu.wcChildren: fileOpenBtn filePropBtn\
- fileSelectAllBtn filePrintBtn fileDeleteBtn\
- showMessagesBtn fileExitBtn
- *fileBB.wcConstructor: XmCreateBulletinBoardDialog
- *fileBB.wcChildren: rc
- *fileBB.wcCallback: WcSetValueCB(^.title:File Menu)
- *fileBB.*marginWidth:0
- *fileBB.*marginHeight:0
- *fileBB.*background:slategray
- *fileBB.*foreground:white
- *fileBB.rc.wcClassName: XmRowColumn
- *fileBB.rc.wcChildren: fileOpenBtn filePropBtn\
- fileSelectAllBtn filePrintBtn fileDeleteBtn\
- showMessagesBtn fileExitBtn
- *fileOpenBtn.wcClassName: XmPushButton
- *fileOpenBtn.labelString: Open ...
- *fileOpenBtn.activateCallback: WcTraceCB
- *filePropBtn.wcClassName: XmPushButton
- *filePropBtn.labelString: Properties ...
- *filePropBtn.activateCallback: WcTraceCB
- *fileSelectAllBtn.wcClassName: XmPushButton
- *fileSelectAllBtn.labelString: Select All
- *fileSelectAllBtn.activateCallback: fileSelectAll
- *filePrintBtn.wcClassName: XmPushButton
- *filePrintBtn.labelString: Print
- *filePrintBtn.activateCallback: WcTraceCB
- *fileDeleteBtn.wcClassName: XmPushButton
- *fileDeleteBtn.labelString: Delete
- *fileDeleteBtn.activateCallback: WcTraceCB
- *showMessagesBtn.wcClassName: XmPushButton
- *showMessagesBtn.labelString: Show Messages
- *showMessagesBtn.activateCallback: WcTraceCB
- *fileExitBtn.wcClassName: XmPushButton
- *fileExitBtn.labelString: Exit
- *fileExitBtn.activateCallback: WcExitCB
- !
- !
- ! End of Resource File
- !
- !
-
-
- #
- #
- # What follows here is the "source code" which I used to generate
- # the app-defaults statements above. I include it only as in introduction
- # to the "RIL" language - you won't be able to do anyting useful with
- # it except see what it looks like.
- #
- # This "RIL" language which I have been developing over the past couple
- # of months, is basically a preprocessor for WCL.
- # I use it all the time, and think that it is a pretty neat thing.
- # The output can be written to a file (as above) or loaded directly
- # via xrm at run time.
- #
- # The first thing to note about the "RIL" version of this program is
- # that it is quite a bit more readable than a straight app-defaults file
- # would be. This becomes more and more important as the size of your
- # application (and thus app-defaults file(s)) become.
- #
- # What this example does not show is the ability of RIL to define functions,
- # set variables, use conditional statements and looping constructs,
- # include other RIL files and on and on...
- #
- # "RIL or "Roger's Interface Language" is based on TCL.
- # If you don't know what TCL is, you should make an effort to find out.
- # It will be worth it to you, I promise.
- #
- # I think that anybody that is currently using WCL should be very
- # interested in something like RIL. Particularly, this can serve
- # as a UIL replacement for those using OLIT or ATHENA.
- #
- # I am considering makeing RIL availabale for public use,
- # Positive/Constructive Negative comments would help me decide...
- #
- #
- Widget Mri {
- wcChildren: main
- }
-
- Widget *main {
- wcClassName: XmMainWindow
- wcChildren: menuBar
- }
-
- Widget *menuBar {
- wcConstructor: XmCreateMenuBar
- wcChildren: fileMenu fileBtn
- *background:slategray
- *foreground:white
- }
-
- #
- ## File menu
- #
- Widget *fileBtn {
- wcConstructor: XmCreateCascadeButton
- labelString: File
- wcCallback: WcSetValueCB(this.subMenuId: ~*fileMenu)\
- WcTranslations(this,\
- #override Shift<Btn1Up>: WcCreateChildrenACT(~,fileBB))
- }
-
- Widget *fileMenu {
- wcConstructor: XmCreatePulldownMenu
- wcManaged: False
- wcChildren: fileOpenBtn filePropBtn \
- fileSelectAllBtn filePrintBtn fileDeleteBtn \
- showMessagesBtn fileExitBtn
- }
-
- Widget *fileBB {
- wcConstructor: XmCreateBulletinBoardDialog
- wcChildren: rc
- wcCallback: WcSetValueCB(^.title:File Menu)
- *marginWidth:0
- *marginHeight:0
- *background:slategray
- *foreground:white
- rc.wcClassName: XmRowColumn
- rc.wcChildren: fileOpenBtn filePropBtn \
- fileSelectAllBtn filePrintBtn fileDeleteBtn \
- showMessagesBtn fileExitBtn
- }
-
- Resources *XmPushButton {
- activateCallback: WcTraceCB
- }
-
- Widget *fileOpenBtn {
- wcClassName: XmPushButton
- labelString: Open ...
- }
-
- Widget *filePropBtn {
- wcClassName: XmPushButton
- labelString: Properties ...
- }
-
- Widget *fileSelectAllBtn {
- wcClassName: XmPushButton
- labelString: Select All
- }
-
- Widget *filePrintBtn {
- wcClassName: XmPushButton
- labelString: Print
- }
-
- Widget *fileDeleteBtn {
- wcClassName: XmPushButton
- labelString: Delete
- }
-
- Widget *showMessagesBtn {
- wcClassName: XmPushButton
- labelString: Show Messages
- }
-
- Widget *fileExitBtn {
- wcClassName: XmPushButton
- labelString: Exit
- activateCallback: WcExitCB
- }
-
-
-