SWGCB2

26 views
Skip to first unread message

Haydar AKDAĞ

unread,
Mar 1, 2025, 1:37:55 PMMar 1
to dislin...@googlegroups.com
Hello,
how can I use the SWGCB2 subroutine? I wrote an example below, but it’s not working correctly. Could you check if there’s anything missing in the program?  

Regards 

module var implicit none integer::dr integer::idmain,idbut integer::nw,nh,nx,ny end module var program widget_draw use var nw=400 nh=300 nx=0 ny=0 call gui end program widget_draw subroutine gui use dislin use var INTERFACE SUBROUTINE draw(id) IMPLICIT NONE INTEGER, INTENT(IN) :: id END SUBROUTINE draw SUBROUTINE rsize(idx,new_w,new_h) IMPLICIT NONE INTEGER, INTENT(IN) :: idx,new_w,new_h END SUBROUTINE rsize END INTERFACE integer ::b call swgtit ('widget') call wgini('form',idmain) call wgbut(idmain,'DRAW',0,idbut) call swgcbk(idbut,draw) call swgpos(0,40) !CALL SWGWIN (nx,ny,nw,nh) call wgdraw(idmain,dr) CALL SWGCB2(idmain,rsize) !call draw(id) call wgfin end subroutine gui !ifx /c /Ic:\dislin resize.f90 !ifx resize.obj c:\dislin\disifl_d.lib gdi32.lib user32.lib kernel32.lib subroutine draw(id) use var integer, intent(in) :: id integer, parameter :: n=100 integer :: i real*8 :: x(n), y(n) real*8 :: a, b, h, t call metafl('xwin') ! Ekrana çizim yap call setxid(dr, 'widget') call scrmod('reverse') call disini() a = 0.0D0 b = 5.0D0 h = (b - a) / dble(n) t = a call graf(a, b, a, 1.0D0, -0.5D0, 0.5D0, -0.5D0, 0.1D0) do i = 1, n x(i) = t y(i) = t**2 * exp(-t) * sin(10*t) t = t + h end do call curve(x, y, n) call disfin() end subroutine draw !-------------------------- ! RSIZE !---------------------------- subroutine rsize(idx, new_w, new_h) use dislin use var implicit none integer, intent(in) :: idx integer, intent(in) :: new_w, new_h ! Yeni genişlik ve yükseklik güncelleniyor nw = new_w nh = new_h ! Eski pencereyi kapat !call wgfin ! Yeni boyutları ekrana yazdır write(*,*) 'Yeni Pencere Boyutu: ', nw, 'x', nh ! GUI'yi yeni boyutta yeniden başlat call swgsiz(nw,nh) CALL gui end subroutine rsize








Helmut Michels

unread,
Mar 4, 2025, 10:25:14 AMMar 4
to dislin-users
Hi,

the callback routine for a main widget is executed when a user changes the size of the main widget
with the mouse. For me, this seems to work in your example code.

With best regards,

Helmut

Haydar AKDAĞ

unread,
Mar 5, 2025, 6:51:12 AMMar 5
to dislin...@googlegroups.com
  Hello again. 
 The program is working, but when resized, two screens appear. I sent it as an image. It resizes, but the previous screen doesn't disappear. Do you know how I can fix this? 
  Best regards, Haydar  
image.png
--------------------------------------------------------------------------


Helmut Michels <mic...@dislin.de>, 4 Mar 2025 Sal, 18:25 tarihinde şunu yazdı:
--
You received this message because you are subscribed to the Google Groups "dislin-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to dislin-users...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/dislin-users/f17656d1-6e1d-4b54-af68-d541ed5dcdcfn%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages