In the following program a very simple graph is plotted using %pl. To the right of the plot there is a button “NEXT”, whose call back calls change_plot_chr@ and simpleplot_redraw@ to change the y_axis label on the %pl graph. This works updating the plot as expected.
However, when the window is closed after the button “NEXT” has been clicked on, an unknown exception is generated. If the calls to the function change_plot_chr@ in the function next_y_cb are commented out (so that the change of label is not applied) the unknown exception is not generated.
I have observed this with the 64 bit compiler, the 32 bit compiler does not fail in this way. Similar failures can be observed for changing the x_axis label and the title of the plot – again only with the 64 bit compiler.
module test_change_plot_chr
use clrwin
implicit none
integer :: plot_number = 1
real*8 :: x(2) = [0,1], y(2) = [0,1]
contains
integer function start()
integer :: iw
iw = winio@('%mn[Exit]&','exit')
iw = winio@('%fn[Tahoma]%ts%bf&',1.5d0)
call winop@('%pl[n_graphs=1,native,x_array]')
call winop@('%pl[Title='A simple graph']')
call winop@('%pl[yaxis='Frequency']')
call winop@('%pl[xaxis=' X ']')
iw = winio@('%pl&',900,600,2,x,y)
iw = winio@('%^bn[Next Y]', next_y_cb)
start = 2
end function start
integer function next_y_cb()
integer i
plot_number = plot_number + 1
if (plot_number .gt. 2) plot_number = 1
if (plot_number .eq. 1) then
i = change_plot_chr@(0,'y_axis',0,'Sin(x)')
else
i = change_plot_chr@(0,'y_axis',0,'Cos(x)')
end if
print*, i
call simpleplot_redraw@()
next_y_cb = 2
end function next_y_cb
end module test_change_plot_chr
program p
use test_change_plot_chr
i = start()
end program p