forums.silverfrost.com Forum Index forums.silverfrost.com
Welcome to the Silverfrost forums
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

%pv%pl – how to recover new graphics size?

 
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> ClearWin+
View previous topic :: View next topic  
Author Message
Kenneth_Smith



Joined: 18 May 2012
Posts: 697
Location: Hamilton, Lanarkshire, Scotland.

PostPosted: Sat Mar 27, 2021 12:52 pm    Post subject: %pv%pl – how to recover new graphics size? Reply with quote

%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
Back to top
View user's profile Send private message Visit poster's website
PaulLaidler
Site Admin


Joined: 21 Feb 2005
Posts: 7923
Location: Salford, UK

PostPosted: Sat Mar 27, 2021 4:49 pm    Post subject: Reply with quote

Thanks Ken. I have added this feature.
Back to top
View user's profile Send private message AIM Address
Kenneth_Smith



Joined: 18 May 2012
Posts: 697
Location: Hamilton, Lanarkshire, Scotland.

PostPosted: Sun Mar 28, 2021 1:17 pm    Post subject: Reply with quote

Thank you Paul. This will allow items drawn in the %pl programmer specified margins by the callback to be correctly positioned (wrt to the %pl frame) after a resize.
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> ClearWin+ All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group