ClearWin+ is an easy to use GUI builder which is designed for Fortran programmers. By learning a few simple subroutine calls and format strings you can take any existing Win32 Fortran program and add a full GUI interface with windows, menus, popup dialog boxes, list boxes, edit boxes, bitmaps, toolbars, etc. etc. Callback mechanisms and similar functionality is handled for the programmer by ClearWin+.

ClearWin+ is very concise, 'Hello World' requires only four lines of Fortran code. Whilst ClearWin+ provides the majority of interaction with the Win32 API full direct access is also possible. Applications written using ClearWin+ can also contain graphics regions, enabling charts and graphs of all descriptions to be included within applications. OpenGL graphics can also be included and sample code is provided.

Here is an example of how easy it is to produce graphics with ClearWin+. The graph below was produced by the Fortran below it.

PROGRAM main winapp use clrwin integer iw,winio@ integer ctrl integer last_y, mid_y integer new_y integer, parameter :: width = 800, height = 350, gutter = 20 real x iw=winio@('%ca[exp(-x/10)sin(x)]&') ! draw the equation iw=winio@('%cn%eq[y(x)=e{sup -{divide x;10}}sin x]%nl&', 0, 0) ! set up the surface to draw onto. Remove [smooth4] to see what anti-aliasing has given you iw=winio@('%gr[smooth4]&', width, height) iw=winio@('%lw', ctrl) ! draw axes mid_y = height / 2 call draw_line_between@(gutter, gutter, gutter, width-gutter, RGB@(0,0,0) ) call draw_line_between@(gutter, mid_y, width-gutter, mid_y, RGB@(0,0,0) ) do i = 0,width-(2*gutter) ! make the width of the x-axis span 0..8pi. REAL(width-(2*gutter) is the width of that axis x = (i/REAL(width-(2*gutter)))*8*3.1415926D0 new_y = mid_y + exp(-x / 10)*sin(x)*(mid_y-gutter) if (i > 0) then call draw_line_between@(gutter+i-1, last_y, gutter+i, new_y, RGB@(255,0,0) ) end if last_y = new_y end do END PROGRAM main

Watch some of our Silverfrost Fortran Videos for more inspiration.

Basket

Empty