Kenneth_Smith
Joined: 18 May 2012 Posts: 697 Location: Hamilton, Lanarkshire, Scotland.
|
Posted: Sat Mar 27, 2021 12:52 pm Post subject: %pv%pl � how to recover new graphics size? |
|
|
%pv%pl � how to recover new graphics size?
Is it possible to recover the new size of the %pl graphics region with a %pv after a user has resized the parent window? This one had me up to the �wee� hours of this morning.
%pl does not accept the [user_resize] option.
After the resize, within the pl call back clearwin_string@('CALLBACK_REASON') returns �PLOT_ADJUST� (and never �RESIZE� as it would for a %gr region � this is OK since a requires PLOT_ADJUST).
However within the %pl callback Clearwin_info@('GRAPHICS_RESIZING') returns 0. Ignoring that this is not 1, clearwin_info@('GRAPHICS_WIDTH') and clearwin_info@('GRAPHICS_DEPTH') always returns the same value irrespective of the extent of resize.
I cannot see a *direct* way to recover the new %pl graphics x-y extents within the %pl call back. This information must exist within the Clearwin data?
Below is the code I have been experimenting with, a %gr is first then a %pl. Can anybody identify what I cannot see either in the code or the documentation?
Ken
Code: | WINAPP
USE clrwin
INTEGER, parameter :: N=5
integer i,gw,gh
REAL*8 x(N),y(N)
integer, external :: pl_cb, gr_cb
DO i=1,N
x(i)=0.1d0*(i-1) ; y(i)=x(i)*x(i)
ENDDO
gw=600
gh=300
i=winio@('%ca[GR]%bg[blue]%tc[white]Use mouse to drag edges of main window%nl&')
i=winio@('%`bg[white]%pv%^gr[user_resize]&',gw,gh, gr_cb)
i=winio@('%sf%ff%nl%cn%tt[OK]')
i=winio@('%ca[PL]%bg[blue]%tc[white]Use mouse to drag edges of main window%nl&')
i=winio@('%`bg[white]%tc[black]&')
CALL winop@("%pl[x_array,link=curves,symbol=9,colour=red,framed]")
call winop@("%pl[margin=(100,100,100,100)]")
i=winio@('%pv%^pl&',gw,gh,N,x,y,pl_cb) ![user_resize] is not a valid %pl option
i=winio@('%sf%ff%nl%cn%tt[OK]')
END
integer function pl_cb()
use clrwin
integer resize, x, y
print*
print*, 'pl_cb'
print*, 'CALLBACK_REASON ', trim(clearwin_string@('CALLBACK_REASON'))
resize=clearwin_info@('GRAPHICS_RESIZING')
print*, 'resize = ', resize
! IF(resize.EQ.1)THEN
x = -999 ; y = -999
x=clearwin_info@('GRAPHICS_WIDTH') ; y=clearwin_info@('GRAPHICS_DEPTH')
print*, 'New size ', x,y
! ENDIF
pl_cb = 2
end function pl_cb
integer function gr_cb()
use clrwin
integer resize, x, y
print*
print*, 'gr_cb'
print*, 'CALLBACK_REASON ', trim(clearwin_string@('CALLBACK_REASON'))
resize=clearwin_info@('GRAPHICS_RESIZING')
print*, 'resize = ', resize
IF(resize.EQ.1)THEN
x = -999 ; y = -999
x=clearwin_info@('GRAPHICS_WIDTH') ; y=clearwin_info@('GRAPHICS_DEPTH')
print*, 'New size ', x,y
ENDIF
gr_cb = 2
end function gr_cb |
|
|