|
forums.silverfrost.com Welcome to the Silverfrost forums
|
View previous topic :: View next topic |
Author |
Message |
acp693
Joined: 04 Sep 2006 Posts: 56
|
Posted: Tue Sep 19, 2006 12:52 pm Post subject: problem with file open dialogue in graphics area |
|
|
Hello,
I have a problem in a program i'm developing. Basically I have a graphics area %gr with a callback function that returns the x and y pixel number of the graphic area into a textbox. the callback is running anytime the mouse is on the graphics area. I also have a file opening dialogue operated from a button which in the example program below prints the file selected, or returns a specified file if the cancel button is pressed. The problem seems to be that the graphic area callback function string results are getting mixed up into the file selection string result.
I've been puzzling over this for a few days now and don't seem to make any progress. Any help will be gratefully received.
Albert
this is the testprogram to illustrate the problem...
program test_xy_file
winapp
use mswin
use test
implicit none
integer :: res, winio@
external getxy, selectinputfolder
info="" !info declared in module test
res = winio@('%ww%ob%^gr[grey,full_mouse_input]&',400,400,getxy)
res = winio@('%nl%ff&')
res = winio@('%ob%45st%cb&',info)
res = winio@('%nl%^8bt[Select File]%cb',selectinputfolder)
end Program test_xy_file
This is the module.....
module test
implicit none
!global variable
character(len=16) :: info
contains
FUNCTION getxy()
implicit none
INCLUDE <windows.ins>
INTEGER:: x,y, getxy
character(len=:: cx
character(len=:: cy
x=clearwin_info@('GRAPHICS_MOUSE_X')
y=clearwin_info@('GRAPHICS_MOUSE_Y')
write(cx, '(I4)') x
write(cy, '(I4)') y
info="x="//trim(adjustl(cx))//" y="//trim(adjustl(cy))
info=trim(adjustl(info))
CALL window_update@(info)
getxy=1
end function
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
function selectinputfolder()
use mswin
implicit none
character(len=100):: path
logical:: cancelistrue
integer ::selectinputfolder
cancelistrue= browse_for_folder@('Select Folder',path)
if (path== "") then
path = "D:WaveFile_Folder"
print*, path
endif
selectinputfolder=1
end function selectinputfolder
end module test |
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 7927 Location: Salford, UK
|
Posted: Tue Sep 19, 2006 2:20 pm Post subject: problem with file open dialogue in graphics area |
|
|
Alan
The problem may be in the line
external getxy, selectinputfolder
These functions are not external, they are module functions.
Try removing this line. |
|
Back to top |
|
|
acp693
Joined: 04 Sep 2006 Posts: 56
|
Posted: Wed Sep 20, 2006 12:01 am Post subject: problem with file open dialogue in graphics area |
|
|
Hi Paul,
Thanks, the external shouldn't be in there, you are right, I'm just a beginner fortran programmer, and still making lots of mistakes.
However, the problem is still there after removing the line beginning with external.
Best regards
Albert |
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 7927 Location: Salford, UK
|
Posted: Wed Sep 20, 2006 2:46 am Post subject: problem with file open dialogue in graphics area |
|
|
Albert
Try this....
module test
implicit none
!global variable
character(len=80) :: info
contains
FUNCTION getxy()
implicit none
INCLUDE <windows.ins>
INTEGER:: x,y, getxy
character(len=:: cx
character(len=:: cy
x=clearwin_info@('GRAPHICS_MOUSE_X')
y=clearwin_info@('GRAPHICS_MOUSE_Y')
write(cx, '(I4)') x
write(cy, '(I4)') y
info="x="//trim(adjustl(cx))//" y="//trim(adjustl(cy))
info=trim(adjustl(info))
CALL window_update@(info)
getxy=1
end function
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
function selectinputfolder()
use mswin
implicit none
character(len=512):: path
logical:: cancelistrue
integer ::selectinputfolder
path = " "
cancelistrue= browse_for_folder@('Select Folder',path)
if(path==" ") then
path = "D:WaveFile_Folder"
endif
print*, path
selectinputfolder=1
end function selectinputfolder
end module test
winapp
program test_xy_file
use test
implicit none
integer :: res, winio@
info="" !info declared in module test
res = winio@('%ww%ob%^gr[grey,full_mouse_input]&',400,400,getxy)
res = winio@('%nl%ff&')
res = winio@('%ob%45st%cb&',info)
res = winio@('%nl%^8bt[Select File]%cb',selectinputfolder)
end Program test_xy_file
|
|
Back to top |
|
|
acp693
Joined: 04 Sep 2006 Posts: 56
|
Posted: Wed Sep 20, 2006 4:20 am Post subject: problem with file open dialogue in graphics area |
|
|
Hi Paul, Thanks for all your efforts. That works as long as the ok or cancel buttons from the file selection dialogue are not directly over the graphic area. when they are , then I get an error message:
Error 410, A function called from within an I/O statement has itself performed I/O. |
|
Back to top |
|
|
JohnHorspool
Joined: 26 Sep 2005 Posts: 270 Location: Gloucestershire UK
|
Posted: Wed Sep 20, 2006 4:46 am Post subject: problem with file open dialogue in graphics area |
|
|
Hi Albert,
You are unfortunately at least the third person to have hit this particular error mesage when using graphics! I first reported this problem on 25th October 2005, it was then reported by another person in June or July this year. I get the error message when using OpenGL graphics.
Paul, any advice or help on avoiding this problem would be greatly appreciated.
Thanks,
John
_________________ John Horspool
Roshaz Software Ltd.
Gloucestershire |
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 7927 Location: Salford, UK
|
Posted: Wed Sep 20, 2006 5:58 am Post subject: problem with file open dialogue in graphics area |
|
|
Albert
Try removing the PRINT statement...
module test
implicit none
!global variable
character(len=80) :: info
contains
FUNCTION getxy()
implicit none
INCLUDE <windows.ins>
INTEGER:: x,y, getxy
character(len=:: cx
character(len=:: cy
x=clearwin_info@('GRAPHICS_MOUSE_X')
y=clearwin_info@('GRAPHICS_MOUSE_Y')
write(cx, '(I4)') x
write(cy, '(I4)') y
info="x="//trim(adjustl(cx))//" y="//trim(adjustl(cy))
info=trim(adjustl(info))
CALL window_update@(info)
getxy=1
end function
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
function selectinputfolder()
use mswin
implicit none
character(len=512):: path
logical:: cancelistrue
integer ::selectinputfolder,i
path = " "
cancelistrue= browse_for_folder@('Select Folder',path)
if(path==" ") then
path = "D:WaveFile_Folder"
endif
i=MessageBox(0,path,"Title",0);
!print*, path
selectinputfolder=1
end function selectinputfolder
end module test
winapp
program test_xy_file
use test
implicit none
integer :: res, winio@
info="" !info declared in module test
res = winio@('%ww%ob%^gr[grey,full_mouse_input]&',400,400,getxy)
res = winio@('%nl%ff&')
res = winio@('%ob%45st%cb&',info)
res = winio@('%nl%^8bt[Select File]%cb',selectinputfolder)
end Program test_xy_file
|
|
Back to top |
|
|
Anonymous Guest
|
Posted: Wed Sep 20, 2006 10:39 am Post subject: problem with file open dialogue in graphics area |
|
|
Thanks Paul, that seems to have done the trick!
Best regards
Albert |
|
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
|