|
forums.silverfrost.com Welcome to the Silverfrost forums
|
View previous topic :: View next topic |
Author |
Message |
jjgermis
Joined: 21 Jun 2006 Posts: 404 Location: Nürnberg, Germany
|
Posted: Tue Apr 09, 2013 12:18 pm Post subject: Size of child window |
|
|
From my main window a second window is opened to display the graphical output. Using the GET_WINDOW_LOCATION to determine the size results in WIDTH and HEIGHT being negative. Below is some test code.
Until now the application was a single window. Adding a main window to the application is new to me.
Question:
1.) Why is the result negative for the size?
2.) %hw gives strange numbers for the handle - is the correct?
Jacques
Code: | winapp
program enum
use mswin
implicit none
integer :: i,ctrl,ou
EXTERNAL :: cb_func
ctrl = -1
ou = 6
i=winio@('%ca[Child window size]&')
i=winio@('%sy[thin_border]&')
i=winio@('%bg[BTNFACE]&')
i=winio@('%ob[depressed]%40.20cw[vscroll]%cb&',0)
i=winio@('%lw%ff%nl&',ctrl)
i=winio@('%^bt[Show plot]',cb_func)
end program enum
integer function cb_func()
implicit none
INCLUDE 'clearwin.ins'
integer :: ou
integer*4 WIDTH, HEIGHT,X ,Y, handle
INTEGER*4 I,J
integer*4 isdepth,iswidth,ixcentre,iycentre
integer*4 ix(10000),iy(10000),colour
real*8 fac,xc,yc, xr, yr
!
! get graphics window dimensions
i = winio@('%ww&')
i = winio@('%sy[3d_depressed]&')
i = winio@('%ca[Slot mmf]&')
i = winio@('%gr&',800,600)
i = winio@('%hw',handle)
call GET_WINDOW_LOCATION@(handle,X,Y,WIDTH, HEIGHT)
write(*,*) handle,WIDTH, HEIGHT
cb_func = 1
return
end |
|
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 7925 Location: Salford, UK
|
Posted: Tue Apr 09, 2013 1:18 pm Post subject: |
|
|
The handle looks OK to me.
The reason for the strange results is that the window has already closed by the time you call get_window_location@. So the handle is no longer valid.
You could use %lw or make the call in a %sc callback. |
|
Back to top |
|
|
jjgermis
Joined: 21 Jun 2006 Posts: 404 Location: Nürnberg, Germany
|
Posted: Tue Apr 09, 2013 1:59 pm Post subject: |
|
|
If I understood you correctly I can try to use %lw.
I tried the %lw and still get invalid dimensions. I also tried get_graphics_resolution. I think I miss the concept of the window closing before it get to the size command. The last command is the OK button.
How should I use the %lw command?
Code: | winapp
program enum
use mswin
implicit none
integer :: i,ctrl
EXTERNAL :: cb_func
i=winio@('%ca[Child window size]&')
i=winio@('%sy[thin_border]&')
i=winio@('%bg[BTNFACE]&')
i=winio@('%ob[depressed]%40.20cw[vscroll]%cb&',0)
i=winio@('%lw%ff%nl&',ctrl)
i=winio@('%^bt[Show plot]',cb_func)
end program enum
integer function cb_func()
implicit none
INCLUDE 'clearwin.ins'
integer :: crtl,i
integer*4 WIDTH, HEIGHT,X ,Y, handle
!
! get graphics window dimensions
i = winio@('%ww&')
i = winio@('%sy[3d_depressed]&')
i = winio@('%ca[Slot mmf]&')
i = winio@('%hw&',handle)
i = winio@('%`gr%lw&',800,600,handle,crtl)
call GET_WINDOW_LOCATION@(handle,X,Y,WIDTH, HEIGHT)
call DRAW_filled_RECTANGLE@(0,0,20,20,RGB@(255,0,0))
i=winio@('%ff%cn%tt[OK]')
cb_func = 1
return
end |
|
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 7925 Location: Salford, UK
|
Posted: Tue Apr 09, 2013 3:31 pm Post subject: |
|
|
The %cw window displays the results...
Code: | winapp
program enum
use mswin
implicit none
integer :: i,ctrl,ou
EXTERNAL :: cb_func
ctrl = -1
ou = 6
i=winio@('%ca[Child window size]&')
i=winio@('%sy[thin_border]&')
i=winio@('%bg[BTNFACE]&')
i=winio@('%ob[depressed]%40.20cw[vscroll]%cb&',0)
i=winio@('%lw%ff%nl&',ctrl)
i=winio@('%^bt[Show plot]',cb_func)
end program enum
integer function cb_func()
implicit none
INCLUDE 'clearwin.ins'
integer :: ou
integer*4 WIDTH, HEIGHT,X ,Y, handle
INTEGER*4 I,J,ctrl
integer*4 isdepth,iswidth,ixcentre,iycentre
integer*4 ix(10000),iy(10000),colour
real*8 fac,xc,yc, xr, yr
!
! get graphics window dimensions
i = winio@('%ww&')
i = winio@('%sy[3d_depressed]&')
i = winio@('%ca[Slot mmf]&')
i = winio@('%gr&',800,600)
i = winio@('%hw%lw',handle,ctrl)
call GET_WINDOW_LOCATION@(handle,X,Y,WIDTH, HEIGHT)
write(*,*) handle,WIDTH, HEIGHT
cb_func = 1
return
end |
|
|
Back to top |
|
|
jjgermis
Joined: 21 Jun 2006 Posts: 404 Location: Nürnberg, Germany
|
Posted: Tue Apr 09, 2013 4:14 pm Post subject: |
|
|
Thanks Paul!
As usual the detail...
Anyway, the application now works. I can scale the output to the graphics area.
|
|
Back to top |
|
|
jjgermis
Joined: 21 Jun 2006 Posts: 404 Location: Nürnberg, Germany
|
Posted: Thu Apr 11, 2013 7:20 am Post subject: |
|
|
I am always amazed by the possibilities of ClearWin. I used the export_image function to save plots at different time instants. The steps to make an animated gif can be done online.
Uploaded with ImageShack.us |
|
Back to top |
|
|
|
|
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
|