The Fortran example works identically to the C example. The call to setfillstyle() is using some predefined colors provided by AppGraphics the developer may also specify a color in red-green-blue values using the creatergb() function. The next call draws a blue, filled ellipse over this rectangle with the same dimensions. The above example first draws a red rectangle measuring 150 pixels wide and 100 pixels tall. The examples below both create a few simple shapes within the main window. These can all be called from the main program or any callback function without any problems. Drawing in the WindowĪppGraphics provides a significant number of different line, text, and shape drawing procedures. Like their C counterparts, the save() and quit() subroutines will be executed from a separate thread. These subroutines can be module procedures also, as long as they are within the scope of the subprogram that is calling addmenuitem. Note that the save and quit procedures are subroutines without arguments. In the Fortran example, we’re adding “Save” and “Quit” items to a “File” menu as well. Item = addmenuitem("Quit", file_menu, quit) Item = addmenuitem("Save", file_menu, save) See the section on threads for more information. One should note, however, that the call to save() will be within another thread. The above creates a “File” menu on a window’s menu bar with two options, “Save” and “Quit.” When the user clicks “Save,” for example, the function save() will be called. Root_menu = addmenu(NULL, MENU_FOR_WINDOW) * Some functions prototypes to be called from menu clicks *./ When adding a menu item, though, we can also add a subroutine to be called when the menu item is clicked. These drop-down menus can also have submenus if you wish by again calling addmenu and referencing our drop-down menu as the parent parameter.įinally, we can menu items to our file menu using the addmenuitem function. To add menus to our window, we first need to create a root menu for the window, which represents the menu bar, using the function addmenu and passing MENU_FOR_WINDOW as the parent parameter.Īfter adding the root menu, we can add a useful file menu by again calling addmenu and using our new root menu as the parent parameter. Menus contain additional menus and menu items, and menu items are usually a single-click action when selected. In AppGraphics applications, there is a distinction between menus and menu items. By default, it will be positioned by the operating system, disable double buffering, and end the program when the window closes. This call will create a window 800 pixels wide by 600 pixels tall with the title Example Application in the titlebar. In the Fortran example, we’ve relied on some default values, although all the same parameters as the C version are also available. Window = initwindow(800, 600, title="Example Application") Finally, the TRUE parameter instructs AppGraphics to close the program when the window closes. The FALSE entry disables double buffering double buffering is useful for fast draw operations, but it is unnecessary here. The DEFAULT_POSITION constants tell Windows to position the window on the screen as it sees fit. In the C example, we create a window 800 pixels wide by 600 pixels tall with the title Example Application in the titlebar. The initwindow function is used to open a new window, and it returns an integer identifying this new window: C #include Creating a Windowīefore most functions in AppGraphics cna be called, we need to first create a window. The following guide will walk new users through the process of creating a window, adding menus, and drawing in both C and Fortran. Using this library, developers can create simple, yet powerful, graphical user interfaces with ease. AppGraphics is designed with simplicity in mind.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |