- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I'm new to Intel FORTRAN long as well as Quick-Win and I'm getting stuck trying to rescale a graph I made using Scigraph. I've tried different things and all my changes keep either not showing the graph or messing the child window completely.
What I'm trying to do in this program is to graph in a child window and be able to make the graph smaller or larger as the child window changes dimensions. The dimensions of the child window are changed with the mouse cursor, by clicking and dragging a corner. An example of what I'm trying to do is when you have a picture on your computer and you open it for example using Windows Photo Viewer and you reshape the window, the image resizes accordingly. I would like my program to be able to do the same thing. I've been trying to understand how to be able to do it reading the documentation that I can find but have had no luck.
Here is my full program. I apoligize for the lengh it's taking up, I dind't know what would be relevent to get the help I need.
[fortran]
PROGRAM SGPlotting
USE IFQWIN !required to use setexitqq(QWIN$EXITPERSIST)
USE DFLIB
integer i,n
real,ALLOCATABLE:: c(:),p(:,:),sumP(:)
open(19,file="data.dat") !data file from SASi, named "test.dat" in SASi
! open(20,file="arrays.dat") !not needed, used for testing arrays
! open(21,file="graph_points.dat") !testing if correct values of summations are in array sumP
read(19,*) n !reads in number of rows in file
allocate (c(n),p(n,18),sumP(n)) !18 values, 20 accual columbs
do i=1,n
read(19,*) c(i) ,(p(i,j),j=1,18)
! write(20,*) c(i), (p(i,j),j=1,18)
end do
do i=1,n
sumP(i) = 0
do j=1,18
sumP(i) = p(i,j) + sumP(i)
end do
! write(21,*) i,sumP(i)
end do
open(10,file='user',title='Line Graph 1')
call PlotLineGraph(c,sumP,n)
!open(11,file='user',title='Line Graph 2')
!call PlotLineGraph(c,sumP,n)
i = setexitqq(QWIN$EXITPERSIST) !required to exit the plots
close(19) !close file data.dat
! close(20) !close file arrays.dat
! close(21) !close file graph_points.dat
END PROGRAM SGPlotting
SUBROUTINE PlotLineGraph(x,y,numPoints)
USE SCIGRAPH !required to use /GraphSettings/ and so on
integer numPoints
real, dimension(2*numPoints+1) :: array
real, dimension(numPoints) :: x,y
! real, parameter :: H1(10)= (/1,2,2,3,3,4,4,5,5,6/) !testing array, groupings of (x,y) cordinates
RECORD /GraphSettings/ graph
RECORD /DataSettings/ dSettings
RECORD /AxisSettings/ axis(2)
INTEGER retcode,status,ex
RECORD /windowconfig/ wc
LOGICAL statusmode
TYPE (QWINFO) winfo
! numPoints2 = 5 !testing number of points, use with H1(10) array, indicates the number of (x,y) groups
if( .not. GetWindowConfig(wc) ) stop 'Window Not Open'
! sets the acual size of the child window
winfo.H = 200
gwinH = winfo.H
winfo.W =300
gwinW = winfo.W
winfo.TYPE = QWIN$SET
status = SETWSIZEQQ(10, winfo)
! Get current size of child window associated with unit 4.
status = GETWSIZEQQ(10, QWIN$SIZECURR, winfo)
WRITE (*,*) "Child window size is ", winfo.H, " by ", winfo.W
! Get maximum size of frame window.
status = GETWSIZEQQ(QWIN$FRAMEWINDOW, QWIN$SIZEMAX, winfo)
WRITE (*,*) "Max frame window size is ", winfo.H, " by ", winfo.W
ex = 1
! sets the size of the actual graph
wc%numxpixels = gwinW *2
wc%numypixels = gwinH* 2
wc%numtextcols = -1
wc%numtextrows = -1
wc%numcolors = -1
wc%mode = QWIN$SCROLLDOWN
statusmode = SETWINDOWCONFIG(wc)
IF (.NOT. statusmode) statusmode = SETWINDOWCONFIG(wc)
ct = 1
do ix=1,numPoints
array(ct) = x(ix)
! print *, x(ix),y(ix), ct, array(ct)
do jy=1,2
array(ct+1) = y(ix)
ct = ct + 1
! print *, ct, array(ct), x(ct), y(ct)
! pause(11)
end do
end do
! do ix=1, numPoints !shows that im passing the correct values
! print *, x(ix),y(ix)
! pause(11)
! end do
!11 continue
retcode=GetGraphDefaults($GTXY,graph)
graph.graphColor=$CIBRIGHTWHITE
graph.graphBgColor=$CIBLACK!$CIBRIGHTWHITE!$CIBROWN
graph.setGraphMode=.False.
graph.x2=wc.numxpixels-1
graph.y2=wc.numypixels-1
graph.title='Intensity Vs. Bin #' !Main Title of Graph
! retcode=GetDataDefaults(graph,numPoints2,H1,dSettings) !testing H1(10)
retcode=GetDataDefaults(graph,numPoints,array,dSettings)
dSettings.markerType = $MKNONE
dSettings.lineType = $LTSOLID
dSettings.lineColor = $CIYELLOW
retcode=GetAxisDefaults(graph,dSettings,$ATX,$AFLINEAR,axis(1))
axis(1).title='Bin #'
axis(1).axisPos=$APBOTTOM!$APTOP
axis(1).tickType=$TTINSIDE
axis(1).tickColor=$CILIGHTRED
axis(1).minorTickColor=$CIRED
axis(1).gridStyle=$GSNONE
!axis(1).gridLineType = $LTNONE
retcode=GetAxisDefaults(graph,dSettings,$ATY,$AFLINEAR,axis(2))
axis(2).title='Intensity'
axis(2).tickType=$TTINSIDE
axis(2).tickColor=$CILIGHTRED
axis(2).minorTickColor=$CIRED
axis(2).gridStyle=$GSNONE
!axis(2).gridLineType = $LTNONE
retcode=PlotGraph(graph,2,axis,1)
! retcode=PlotData(graph,H1,dSettings,axis(1),axis(2)) !testing H1(10)
retcode=PlotData(graph,array,dSettings,axis(1),axis(2))
!do while (ex == 1)
!status = GETWSIZEQQ(10, QWIN$SIZECURR, winfo)
!statusmode = SETWINDOWCONFIG(wc)
!wc%numxpixels = winfo.W *12
!wc%numypixels = winfo.H *14
!status = SETWSIZEQQ(10, winfo)
!!! Get current size of child window associated with unit 4.
!!status = GETWSIZEQQ(10, QWIN$SIZECURR, winfo)
!!WRITE (*,*) "Child window size is ", winfo.H, " by ", winfo.W
!go to 11
! do while (ex == 0)
! continue
! end do
!end do
END SUBROUTINE
[/fortran]
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Your PlotLineGraph appears to size the graph based on the windows size. When you resize the window this routine is not called again so the graph sizing will not change. In a windows app you would have an automatic resize and repaint in the windows message loop. You do not have access to the message loop in quickwin to add code to it. An easy fix would be to put a resize option on a menu item and re-create the graph based on the current size.
You could detect a size change in the inifinate loop in your main program and do it there but if you are not careful you can make the quickwin message loop unresponsive.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You can get at a window's message loop by subclassing it when it is created (search for forum posts mentioning 'subclassing', which uses the SetWindowLong API function)) and adding a new window procedure of your own whose function is to intercept the WM_RESIZE messages. At each intercept, it should make a call to PlotLineGraph in order to redraw the graph in the newly-resized window, returning zero as the function value. It should pass all other windows messages to the default window procedure and then exit.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks a lot for your input and time. I wasn't able to figure out how to do a subclassing but I was able to use a series of 'GO TO's to get it to resize and enabling the size to fit with it. Now I'm running into the problem of closing the child window without getting a runtime error.

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page