Silverfrost Forums

Welcome to our forums

%pl[native,external] + plot_mode@

28 Sep 2025 11:32 #32366

Paul,

A very quick question.

A %pl[native,external] cannot have a callback and consequently plot_mode@ cannot be used with the [external] option.

Is this correct, or am I missing something?

28 Sep 2025 2:44 #32368

Ken

At the moment you can't have a callback function with %pl[external] but my comment in the ClearWin+ code has 'at least for now'. So at the time I must have thought that a callback might be possible and useful.

A parent %gr (for %pl) could possibly have a callback which could then be used for mouse events (in %pl) particularly when [full_mouse_input] is enabled. But I have not experimented with this.

29 Sep 2025 6:56 #32375

Paul,

Thanks for confirming that (at present) %pl[native,external,link=user] is not possible.

30 Sep 2025 5:52 #32376

Ken

Could you explain when it might be useful?

At the moment my thinking is that the callback would have to be attached to the parent %gr and one could do that as things are.

30 Sep 2025 5:18 #32378

Paul,

The following code is a very simple example to demonstrate using %gr and %pl[external], and to copy the contents of the hidden %pl[external] over to the visible %gr region.

The question of %pl[external,link=user] which requires a %pl callback stems from this example, simply as the next 'improvement'. At which point I saw the error message about this particular %pl not being allowed a callback - one which I don't remember seeing before.

module pl_external1_mod
use clrwin
use mswin
implicit none
integer :: uidgr1=1000, uidgr2=2000, gw=500, gh=500
contains
  integer function start()
  integer :: i, iw, ilw
  real*8 x(20), y(20)

    x = [(i,i=1,20)]
    y = x*x

    iw = winio@('%fn[Tahoma]%ts&',1.5d0)
    iw = winio@('%`gr[green]&',500,500,uidgr1)
    iw = winio@('%lw',ilw)    

    call sleep@(5.0)
    
    i = create_graphics_region@(uidgr2,500,500)
    if (i .ne. 1) STOP 'create_graphics_region@ failed.'
      
    i = select_graphics_object@(uidgr2)
    if (i .ne. 1) STOP 'select_graphics_region@ failed.'
    
    call winop@('%pl[native,x_array,frame,colour=blue,width=3,external]')
    iw = winio@('%pl',20,x,y)
    
    iw = copy_graphics_region@(uidgr1, 0, 0, 500, 500, &
                               uidgr2, 0, 0, 500, 500, srccopy )
                               
    i = delete_graphics_region@(uidgr2)
    if (i .ne. 1) STOP 'delete_graphics_region@ failed.'
      
    start = 1
  end function start
 
end module pl_external1_mod

program pl_external1
use pl_external1_mod
 i = start()
end program pl_external1
1 Oct 2025 6:01 #32382

Ken

I have made a note to review this issue.

20 Nov 2025 11:37 #32493

Ken

For the next release I have modified %pl[external] so that it can take a callback function when it is associated with a %gr. If the %gr already has a callback function then it is replaced.

The result is the same as attaching the callback to %gr.

22 Nov 2025 12:47 #32496

Thanks Paul, I took forward to experimenting with this addition.

Please login to reply.