⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 boss.man

📁 BOSS窗口开发 C 语言程序库
💻 MAN
📖 第 1 页 / 共 5 页
字号:
             };
            
             main()
             {
             WINDOWPTR w1;
             int wat, bat, rv;

               wn_init();
               w1 = wn_open(0,11,1,31,2,NORMAL,NORMAL);
               if(!w1) exit(1);
               wat = (WHITE<<4|BLACK);
               bat = (BLUE<<4|WHITE); 
               rv = wn_popup(0, 0, 0, 33, 14, wat, bat, &intelc, FALSE);
               wn_printf(w1, "wn_popup returned: %d\n",rv);
               wn_printf(w1, "Press any key to continue..");
               v_getch();
               wn_close(w1);
               wn_exit();
               exit(0);
             }
             /* End */

          To make the popup menu disappear upon return, change the call 
          to wn_popup to be:

               rv = wn_popup(0, 0, 0, 33, 14, wat, bat, &intelc, TRUE);




                                                           Page: 11
                                                     The Window BOSS



        Popup Menu Basics - continued.



        The calling sequence and setup of wn_qpopup is similar to 
        wn_popup but the functions significantly differ operationally.  
        The parameter list differs in that there is no window close flag 
        parameter.  The operational differences are more significant. 
        wn_qpopup places the popup window on the screen and then 
        immediately returns a WINDOWPTR to the open and active popup 
        window.  The calling function assumes full responsibility for  
        the window from then on (i.e. moving, closing, etc.).

        Quick popups are used to display information only and do not 
        contain action menu items.  

        Example:

             #include "windows.h"

             static struct pmenu m1 = {
               0, FALSE, 0,
               0, 0, {
               1, 2, "Presenting", 0,
               99, 99, "",99 }
             };

             main()
             {
             int wat, bat;
             WINDOWPTR w2;

               wat = (WHITE<<4|BLACK);
               bat = (BLUE<<4|WHITE);
               w2 = wn_qpopup(0,0,0,16,3,wat,bat,&m1);
               v_getch();
               wn_close(w2);
               wn_exit();
               exit();
             }
             /* End */















                                                           Page: 12
                                                     The Window BOSS



        Popup Menu Basics - continued.



        4.4.1. Notes

        Popup menu items are highlighted by moving the cursor bar with 
        the arrow keys, space bar, or by pressing the first letter/digit 
        of the menu item.  wn_popup will return as soon as the Enter or 
        Escape key is struck.  The return code specified in the pmenu 
        structure is returned when the Enter key is pressed, Escape 
        causes return code of 99 to be passed back to the calling 
        function. 

        Menu navigation is from the current to next or current to 
        previous menu item when using the cursor keys or space bar.  Item 
        skipping can only be accomplished by using the "first character" 
        selection method.  Skip selection will only work as anticipated, 
        if the first character of each action menu item is unique.

        Source code is provided (WN_HELP.C) to allow you to customize 
        and/or enhance the popup menu system to meet your needs.

        The BOSSDEMO program contains coding samples showing the use of 
        wn_popup, wn_qpopup, and how to implement pulldown menus using 
        wn_popup.






























                                                           Page: 13
                                                     The Window BOSS



        4.5. Help System Basics

        The Window BOSS includes a file based help system that can be 
        used to provide your applications with "context sensitive" help.  

        It would be helpful for you to print out a few pages of 
        "INTELC.HLP" to refer to during the following discussion.  You 
        should also run the BOSSDEMO program and exercise the Intellicom 
        Quick Help popup menu. This code uses the help system to produce 
        the displays when menu selections are made.

        The system uses plain ASCII text files you create with your 
        favorite editor.  A special, but easy to follow, file layout is 
        used.  The file layout we have chosen allows the plain ASCII text 
        files to be indexed using the supplied index generation utility 
        GENINDEX.  The indexing provides the system with the ability to 
        rapidly locate and display help messages when called upon to do 
        so.  Since the source (WN_HELP.C & GENINDEX.C) to the entire help 
        system is provided, you can modify it to meet your own needs.  

        In order to use the help system in your application you must take 
        two preparatory steps: (1) prepare the ASCII text file in the 
        specified format and (2) run the GENINDEX program.  For example, 
        you first create a text file called "TAXES.HLP" using Brief, 
        Vedit, Edlin, or your favorite word processor in non_document 
        (ASCII) mode and then run the GENINDEX program by:

                            C> GENINDEX TAXES.HLP

        The GENINDEX program reads "TAXES.HLP" and produces "TAXES.NDX".  
        Both "TAXES.HLP" and "TAXES.NDX" must be available to the 
        application program at run time.

        To actually use the help system in your application you must 
        first initialize the help system by calling wn_hlinit.  This 
        must be done before any attempt is made to display help messages.
        The help system must only be initialized once.  The call to 
        initialize the help system is of the form:

             .....                              /* code */
          rv = wn_hlinit(row, col, width, height, atrib, batrib, file)
             .....                              /* code */

        The parameters define the location, size, and attributes of the 
        window in which the help messages will be displayed along with 
        the name of the help file to be used.  wn_hlinit returns TRUE if 
        all is well, FALSE otherwise.

        Initialization does not cause a window to be displayed, it merely 
        sets the system up for later use by opening and reading the index 
        file into memory.





                                                           Page: 14
                                                     The Window BOSS



        Help System Basics - continued.



        To initialize the system for full screen help messages in a 
        window with white letters on blue background and a similar border 
        using the file "INTELC.HLP", the call to wn_hlinit would be:

         wn_hlinit(0,0,78,23,(BLUE<<4|WHITE),(BLUE<<4|WHITE),"intelc");

        The help system is now initialized to display full screen help 
        messages using "INTELC.HLP" and "INTELC.NDX" as the help message 
        database. (The BOSSDEMO program uses the above code.)

        Important - Unless you intend to modify the help system, the 
        above call to wn_hlinit should always be used - modified only to 
        reflect the name of your help file. 

        Obtaining help at run time is accomplished by calling the wn_help 
        function with a subject key word.  For example:

             rv = wn_help("%general information%");

        Subject key words are located in the ASCII help file you prepare 
        and are processed by the GENINDEX program.  The usage of 
        wn_help() should be clear once we complete the discussion of the 
        file layout.

        The text file you prepare consists of help system commands, 
        subject key words, and the actual text to be displayed which is 
        formatted to fit inside the window defined by wn_hlinit.  

        Commands 

          .cp   - signals end of page 
          *END* - signals end of page and end of help for this subject

          Text is sequentially displayed a screen at a time from the 
          subject keyword through any number of .cp delimited screens 
          through and including the screen delimited by *END*.  The 
          system allows for forward and reverse display via the PgDn and 
          PgUp keys.  The .cp signals the end of a single screen in a 
          series of 2 or more screens.  When .cp is detected the message  
          "Esc to quit help, PgUp for previous screen, any other key to 
          continue..." will be displayed.  When *END* is detected, the 
          message "End of help, PgUp for previous screen, any other key 
          to continue..." is displayed.  









                                                           Page: 15
                                                     The Window BOSS



        Help System Basics - continued.



        Keywords:

          Keywords are always enclosed within percent signs (%) and 
          signal the beginning of text on a particular subject.  They are 
          used by the GENINDEX program to create the index (NDX) file and 
          are used by you as parameters to the wn_help() function.

          In the case of "INTELC.HLP" you will find the following 
          keywords:

          %ksend%, %ksend1%, %krecv%, %krecv1%, %checksum xmit1%, 
          %checksum recv1%, %terminal/c1%, %cistty1%, %terminal%, 
          %terminal/c%, %cistty%, %status%, %dos window%, %exit to dos%,
          %close capture%, %autodial%, %ascii xmit%, %checksum xmit%,
          %checksum recv%, %general information%, %bossinfo%, 
          %end-of-file%

        Text:
             
          Each screen of text is delimited by either a keyword, the .cp 
          command, or the *END* command.  Text is always formatted to fit 
          inside the help window.  In the case of "INTELC.HLP" there are 
          two leading spaces and the text is right justified to end at 
          column 76.  The two leading and trailing spaces center the text 
          between the borders.  Blank lines at the top of each screen 
          (page full) can be used to vertically center the text.  Spaces 
          on the left can be used to horizontally center text.

          Important - Unless you intend to modify the help system, the 
          format defined by "INTELC.HLP" should always be followed for 
          any help files you create for your own use.

        4.5.1. Notes

          The help system is configured to provide a full screen text 
          message, subject keys are limited to 25 characters, and there 
          is a limit of 255 subject keys per file.  This can be changed 
          by modifying the functions found in "wn_help.c"  THERE IS A 
          DIRECT CORRELATION BETWEEN THE PARAMETERS USED TO INITIALIZE 
          THE HELP SYSTEM AND THE LAYOUT OF THE ASCII TEXT FILE READ BY 
          THE GENINDEX PROGRAM.  If you modify the code be sure to also 
          modify location and text of the messages to be displayed when 
          .cp and/or *END* are detected.
         








                                                           Page: 16
                                                     The Window BOSS



        Help System Basics - continued.



          The GENINDEX program is provided in source form.  An EXEcutable 
          will have to be created locally.  You may also have to adjust 
          the logic to account for the way the various compilers treat 
          <CR><LF> sequences.  This usually amounts to nothing more than 

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -