Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
28434 Discussions

Inserting a Menu resource in a Visual Fortran program

joaonegrao
Beginner
956 Views
Hi! I've been updating my old Fortran code to Visual Fortran 6.0 and replacing the old alphanumeric by a Windows-type interface. For the effect, I am designing a QuickWin project. My problem is that I still couldn't understand how one can manage to create a pop-up submenu in the task bar. Everything is clear in what concerns to editing and defining the submenu, but not on how to insert/activate it within the code (in a way similar to that of DLGINIT and DLGMODAL, used to activate dialogs). Is there anyone who can help me? Thanks a lot.
1 Reply
isn-removed200637
956 Views
For QUICKWIN projects, Look up 'INITIALSETTINGS' under help and follow the instructions (see below for excerpt)
Program Control of Menus
You do not have to use the default QuickWin menus. You can eliminate and alter menus, menu item lists, menu titles or item titles. The QuickWin functions that control menus are described in the following sections:

Controlling the Initial Menu and Frame Window 
Deleting, Inserting, and Appending Menu Items 
Modifying Menu Items 
Creating a Menu List of Available Child Windows 
Simulating Menu Selections 
Controlling the Initial Menu and Frame Window

You can change the initial appearance of an application's default frame window and menus by defining an INITIALSETTINGS function. If no user-defined INITIALSETTINGS function is supplied, QuickWin calls a predefined (default) INITIALSETTINGS routine that provides a default frame window and menu.

Your application does not call INITIALSETTINGS. If you supply the function in your project, QuickWin calls it automatically.

If you supply it, INITIALSETTINGS can call QuickWin functions that set the initial menus and the size and position of the frame window. Besides the menu functions, SETWSIZEQQ can be called from your INITIALSETTINGS function to adjust the frame window size and position before the window is first drawn. 

The following is a sample of INITIALSETTINGS: 

   LOGICAL(4) FUNCTION INITIALSETTINGS( )
     USE DFLIB
     LOGICAL(4) result
     TYPE (qwinfo) qwi
 ! Set window frame size.
     qwi%x = 0
     qwi%y = 0
     qwi%w = 400
     qwi%h = 400
     qwi%type = QWIN$SET
     i = SetWSizeQQ( QWIN$FRAMEWINDOW, qwi )
 ! Create first menu called Games.
     result = APPENDMENUQQ(1, $MENUENABLED, '&Games'C, NUL )
 ! Add item called TicTacToe.
     result = APPENDMENUQQ(1, $MENUENABLED, '&TicTacToe'C, WINPRINT)
 ! Draw a separator bar.
     result = APPENDMENUQQ(1, $MENUSEPARATOR, ''C, NUL )
 ! Add item called Exit.
     result = APPENDMENUQQ(1, $MENUENABLED, 'E&xit'C, WINEXIT )
 ! Add second menu called Help.
     result = APPENDMENUQQ(2, $MENUENABLED, '&Help'C, NUL )
     result = APPENDMENUQQ(2, $MENUENABLED, '&QuickWin Help'C, WININDEX)
     INITIALSETTINGS= .true.
  END FUNCTION INITIALSETTINGS

QuickWin executes your INITIALSETTINGS function during initialization, before creating the frame window. When your function is done, control returns to QuickWin and it does the remaining initialization. The control then passes to the Visual Fortran application. 

You only need to include the code for an INITIALSETTINGS function in your project. If it is part of your project, you do not need to call your INITIALSETTINGS function.

The INITIALSETTINGS function can specify the position and size of the frame window and the contents of the menus. Because the INITIALSETTINGS function is executed before creating the frame window, it must not call any routines that require that frame window initialization be complete. For example, routines that refer to the child window in focus (such as SETWINDOWCINFIG) or a specific child window unit number (such as OPEN) should not be called from the INITIALSETTINGS function.

Your INITIALSETTINGS function should return .TRUE. if it succeeds, and .FALSE. otherwise. The QuickWin default function returns a value of .TRUE. only. 

Note that default menus are created after INITIALSETTINGS has been called, and only if you do not create your own menus. Therefore, using DELETEMENUQQ, INSERTMENUQQ, APPENDMENUQQ, and the other menu c
onfiguration QuickWin functions while in INITIALSETTINGS affects your custom menus, not the default QuickWin menus. 

0 Kudos
Reply