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 

Clearwin crash

 
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> Support
View previous topic :: View next topic  
Author Message
Anonymous
Guest





PostPosted: Tue May 03, 2005 1:26 pm    Post subject: Clearwin crash Reply with quote

I have just used Clearwin+ for the first time, to put a GUI on a FTN95/Win32 program. After lots of experimenting, I constructed some very nice and complex features. However, the code crashes in one place, and I wonder whether this is a known problem or I am doing something wrong. The compact program below reproduces the problem.

I create a Clearwin window, and click on the menu to write text into the window using standard Fortran write. Now, I click the left mouse button (for no particular reason) anywhere inside the window. The first time, there is no problem. But having clicked the menu again to clear and refresh the text, a mouse click anywhere inside the window crashes the program, with a message that starts:

Access Violation
The instruction at address 3bdf7f71 attempted to read from location 00000014
3bdf7eff scrollv(<ptr>structÄwindow_info,int,enumÄupdate_option,enumÄlogical)#6C [+0072]

The compile/link parameters (FTN95 versions 4.7.0 and 4.7.1) do not seem to affect this. The following program shows the problem.

module m; integer i,k; end

winapp; program p; use mswin; use m; external r
i=winio@('%`80.30cw&',6,k); i=winio@('%mn[Write text]',r)
call set_default_window@(k); call open_to_window@(6,k); end

integer function r(); use mswin; use m; character*80 s
s = 'Mouse click: (a) in window, (b) on Write text, (c) in window again - crashes'
call clear_window@(k); write(6,'(a)') s; r = 1; end

Back to top
PaulLaidler
Site Admin


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

PostPosted: Wed May 04, 2005 3:02 am    Post subject: Clearwin crash Reply with quote

This is a ClearWin+ bug that I have now fixed.
The fix will be in the next release of salflibc.dll.

Some minor corrections to your code...

1) r should be declared as an INTEGER
2) the calls to set_default_window and open_to_window are inappropriate and redundant in this case because they are not called until after the window is closed.
Back to top
View user's profile Send private message AIM Address
Anonymous
Guest





PostPosted: Thu May 05, 2005 9:00 am    Post subject: Clearwin crash Reply with quote

Paul, many thanks for your help and corrections. In my small illustrative code, the window is creatd with %80.30cw. I would like to change the number of lines in the window during the program execution, either by interactive window resizing (mouse drag) or via the code (not with scroll bars). The Clearwin documentation for %cw says: "The window is created N characters wide and M deep but this can be changed by the user if the pivot format (%pv) is included". I could not understand this or get it to do anything by specifying %pv%80.30cw. Again, is my thinking wrong?

In my new (and first) GUI, I do need run-time resizing in various situations, but it looks as if box and Clearwin window widths and depths (e.g. %N.Mpb) have to be fixed numbers, not changeable parameters. Boxes like %ls and %ms help by accommodating dynamic lists - ignoring blank entries at the end. However, %pb does not seem to do this: I have to size it to the maximum expected number of lines, and the unused ones always display. Any comments would again be appreciated.
Back to top
PaulLaidler
Site Admin


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

PostPosted: Thu May 05, 2005 9:38 am    Post subject: Clearwin crash Reply with quote

Below is some old sample code that may help.
The idea is that you set the maximum number of lines and columns and use hscroll and vscroll to introduce scroll bars.
The pivot allows the user to resize the window which might take the form of a multi document interface as below or a simpler single document interface.

include <windows.ins>
integer i,c0,c1,c2,h1,h2,cwh1
logical L
common h1,h2
external child_func

i=winio@('%ww[no_border]%ca[MDI frame]&')
i=winio@('%mn[&Child]&',child_func)
i=winio@('%pv%fr&',400,400)
i=winio@('%lw',c0)

i=winio@('%aw&',c0)
i=winio@('%ww[no_border]%ca[First Child]&')
i=winio@('%sm[&Child]&',child_func)
i=winio@('%pv%30.3`cw[hscroll,vscroll]&',7,cwh1)
i=winio@('%lw&',c1)
i=winio@('%hw',h1)

call set_max_lines@(cwh1,50L)
write(7,*) 'Hello there!'

i=winio@('%aw&',c0)
i=winio@('%ww[no_border]%ca[Second Child]&')
i=winio@('%pv%gr[black,metafile_resize]&',200,200)
i=winio@('%lw&',c2)
i=winio@('%hw',h2)

call ellipse@(100,100,50,50,14)
L=BringWindowToTop(h1)

end

C--------------------------------------------
integer function child_func()
include <clearwin.ins>

integer h,hh,i
integer h1,h2
common h1,h2

h=clearwin_info@('FOCUS_WINDOW')
hh=0
if(h.eq.h1) hh=1
if(h.eq.h2) hh=2
if(hh.gt.0) then
i=winio@('Window %wd is active %2nl%cn%`7bt[OK]',hh)
endif

child_func=1
end



Back to top
View user's profile Send private message AIM Address
Anonymous
Guest





PostPosted: Thu May 05, 2005 12:02 pm    Post subject: Clearwin crash Reply with quote

Yes, your sample code clarifies a great deal. Amazing how simple Clearwin is when you know how. Your code would be a really useful addition to the Clearwin demo cases. Thanks again
Back to top
Display posts from previous:   
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> Support 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