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 

Problem with repeated use of FILE_OPENR

 
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> ClearWin+
View previous topic :: View next topic  
Author Message
Wingnut



Joined: 07 Mar 2011
Posts: 6

PostPosted: Sat Mar 12, 2011 1:47 pm    Post subject: Problem with repeated use of FILE_OPENR Reply with quote

Hi, I've searched long and hard for a discussion of or solution to this problem, so I don't think it's been addressed before.

I've written a few tools using ClearWin+ that involve selecting a number of files before using the data in them. On my old Windows XP computer, all went well. When I moved to Windows 7 64-bit, a problem appeared. As I click on a series of buttons with FILE_OPENR callbacks, on the sixth button the program freezes for about 30 seconds to a minute before the file selection box pops up. Then on the sixth button after that the same thing happens, etc. If I click on anything in the program window during the freeze I hear a beep, as if a buffer somewhere is full and not accepting input.

As you can imagine, when using a tool with up to 77 files that have to be selected, this can be quite annoying!

Other people I've shared my tools with have reported the same problem when running on Windows 7. I don't know if they're all 64-bit.

Here's a small demo program that exhibits this behavior:

WINAPP
CHARACTER*250 fdds(12)

do i=1,12
fdds(i) = ' '
end do

i=winio@('%ww&')
i=winio@('%ft[All files][*.*]&')
i=winio@('%ob[named_l][Select files for test]&')

do j=1,12
i=winio@('%`8?ws@ %?48rs@ &','test','test',fdds(j),'test')
i=winio@('%^bt[Select file] %ff&','FILE_OPENR[test]',fdds(j),'CONTINUE')
end do

i=winio@('%cb')
END

Am I doing something wrong or is there a problem with the callback?
Back to top
View user's profile Send private message
LitusSaxonicum



Joined: 23 Aug 2005
Posts: 1668
Location: Yateley, Hants, UK

PostPosted: Sat Mar 12, 2011 6:33 pm    Post subject: Reply with quote

Wingnut,

I've seen something on this issue before, but can't remember where.

Do you get the same problem with GET_FILTERED_FILE@ ?

Secondly, are you using a recent version of FTN95? I'll echo John Horspool's advice from another thread and say you can always try it with FTN95pe - (which is usually the latest version).

Eddie
Back to top
View user's profile Send private message
Wingnut



Joined: 07 Mar 2011
Posts: 6

PostPosted: Sun Mar 13, 2011 2:28 pm    Post subject: Reply with quote

Thanks, but GET_FILTERED_FILE@ has the same behavior. It wouldn't be a good solution anyway since a callback function using it can't have arguments so I'd have to write a separate callback for every file I need to select.

I'm using 6.0 - and had the same problem with 5.5 and I think with 5.0. Don't remember exactly at what point I switched to Win 7.
Back to top
View user's profile Send private message
Wingnut



Joined: 07 Mar 2011
Posts: 6

PostPosted: Sun Mar 13, 2011 3:35 pm    Post subject: Reply with quote

... and I just tried compiling and running in Release Win32 instead of Debug (which I prefer because of the more detailed error messages) and the problem is gone.

Okay, I officially feel like an idiot for not trying this before. Embarassed
Back to top
View user's profile Send private message
LitusSaxonicum



Joined: 23 Aug 2005
Posts: 1668
Location: Yateley, Hants, UK

PostPosted: Sun Mar 13, 2011 5:22 pm    Post subject: Reply with quote

Hi Wingnut,

It wasn't suggested that it would be better - I tried it myself, and got bogged down in the problem you mention. So the delay is internal to DEBUG.

I always look at other peoples' code fragments, to see if I can learn something. The standard callbacks FILE_OPENR and FILE_OPENW always seemed to me not to set the file selection box caption. Lo and behold, yours did. I'm sure I've read the FTN95.CHM dozens of times and missed it - it's the string inside the square brackets. Leave the string out, and you just get the program file name.

Does the GET_MULTIPLE_FILENAMES@ routine help you, or do you need to select the files one at a time?

Eddie
Back to top
View user's profile Send private message
JohnCampbell



Joined: 16 Feb 2006
Posts: 1803
Location: Sydney

PostPosted: Mon Mar 14, 2011 12:11 am    Post subject: Reply with quote

Past posts have indicated there could be a problem with the get_files... in Windows 7 and related to it's use of the stack (memory resources). To follow up on this, if you ran task manager and watched VM size, page faults etc, as the program runs, it may show this to be the case. Worth a try, although the OS use of resources may not show up here.
If this is the case, a possible solution may be to declare a larger stack size when linking (or heap if possible ?). As this problem has been hanging around for a while I wouldn't expect an easy solution.
Is the problem related to the complexity of the file system or new file structures now available in Windows 7 ? (I'm not yet a Windows 7 user)

Also,
As with Eddie, I find it very interesting to read someone elses code and learn from their use of clearwin+. I don't use clearwin enough !! Where did this example code come from? There are so many options in this I am not familiar with, especially:
i=winio@('%`8?ws@ %?48rs@ &','test','test',fdds(j),'test')
does @ imply get next argument as a string ?
I'm unsure of the meaning of 8?ws and ?48rs. Does it hide the 2 occurences of @ > 'test' strings ?

John
Back to top
View user's profile Send private message
Wingnut



Joined: 07 Mar 2011
Posts: 6

PostPosted: Mon Mar 14, 2011 8:15 pm    Post subject: Reply with quote

@LitusSaxonicum: GET_MULTIPLE_FILENAMES@ doesn't really help since the tool user has to select one particular file for each slot in a looooong list of files.

@JohnCampbell: Glad this can be of use to someone! Smile The sample I used is a snippet from one of my tools, simplified a bit to be standalone.

i=winio@('%`8?ws@ %?48rs@ &','test','test',fdds(j),'test')

For both the ws and rs format codes, '?' is a modifier indicating help should be displayed. The help string can either be defined after the format code inside [ ], or by using the @ can be attached as a string argument following the normal format code argument. (It might be clearer if all my strings weren't 'test'!) In this case the help string shows at the bottom of the program window, but it can be done as a bubble or tooltip using %bh and %th.

In the complete program the %`ws is used with character variables to label each input field, and the tooltips give a more detailed description of which file is needed in that particular field.

This is in the FTN95 help in Win32 Platform/Clearwin +/Help section.

I seem to remember watching Task Manager at one point to see if the program was looping or something, but didn't see anything. Worth trying again, though. Another odd thing I've noticed on Windows 7, and I think only in the latest release of FTN95, is that after I compile in Plato and hit the Run button, it takes several seconds for the program to start. Not a significant problem, but interesting.

Anywho, I'm fine with the Release option solving my problem, at least for now. It would be helpful to be able to share a Debug-compiled version since this is only a hobby for me and my 'users' are all effectively beta testers, but it's not necessary.
Back to top
View user's profile Send private message
LitusSaxonicum



Joined: 23 Aug 2005
Posts: 1668
Location: Yateley, Hants, UK

PostPosted: Mon Mar 14, 2011 10:39 pm    Post subject: Reply with quote

This one for John: you get a choice with ? (help strings provided) as to whether to put them in [] or to append an @ and then the help strings are character variables you add to the argument list - in which case they can be changed at runtime. By dint of trial and error and seeing what I like and what I don't, I decided that Clearwin's status line wasn't for me, and of the various type of tool tip / bubble help, decided that I disliked it on menus, and only really liked it as popup help for unlabelled toolbar icons. I find that I preferred %th to %bh, and always start and finish my text strings with a space because otherwise they look cramped to my eye (although I'm not convinced that the space after helps or even always shows - the one before does). I wasn't all that keen on the options like ms_style. My delay is 300 ms. This part of Clearwin is definitely dated in its appearance, but used sparingly it isn't too bad - definitely better than nothing.

I still can't get over missing the [] in FILE_OPENR and FILE_OPENW - I must have read this section of FTN95.CHM a hundred times.

Eddie
Back to top
View user's profile Send private message
JohnCampbell



Joined: 16 Feb 2006
Posts: 1803
Location: Sydney

PostPosted: Tue Mar 15, 2011 3:01 am    Post subject: Reply with quote

Thank you both for your feedback. It makes more sense now.
Eddie, I've noted your concern about layout. I'll leave that to learn at another time. I'm still glad to achieve the functionality in my menu generation.
Being able to use the menu to achieve a what if, on the screen and in real time is very effective in a presentation.

Thanks for your help

John
Back to top
View user's profile Send private message
Wingnut



Joined: 07 Mar 2011
Posts: 6

PostPosted: Thu Mar 17, 2011 2:39 pm    Post subject: Reply with quote

Unfortunately, with more experimentation I see that using the Release compile doesn't solve the problem, just makes it less obvious. Now FILE_OPENR stalls after about 12 times instead of 6, and the pause is shorter. There still seems to be a problem in the callback itself.
Back to top
View user's profile Send private message
GeroldSpykman



Joined: 16 Dec 2010
Posts: 1

PostPosted: Thu Apr 28, 2011 3:13 pm    Post subject: Reply with quote

Hello,

I'm using clearwin dialogs very often in my database code. When switching over to Windows 7 the problem with file_openr and file_openw occurs. The file selection dialog does not open and the program stalls sometimes for hours when clicking too much. I also tried get_filtered_file@. The same eratic behavior. The problem was less intensive when I compiled the code on Windows 7 but it was still there.
With the get_filtered_file@ an other problem occurs:
if the option "mustexist" was set to 1 (open a file for reading) the dialog doesn't appear. Switching over to mustexist = 0 (open a file for writing/saving) the dialog works. But it is a strange to press the save-button to open a file for reading.
In some cases, when the file_openw dialogs appears I was not able to save a file. Saving was only possible by overwriting an existing file.

May be there are some good programers who know what to do. I checked already all possebilities with length of strings, commen or local declarations, version of salflib.dll and so on. The problem only occurs on Windows Vista and Windows 7. Nothing is affected unter XP. I would be happy to get any solution thats brings me back from the win/7 situation to a win/win situation again.

Kind regards
Gerold

(located in Germany, so excuse my English)
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> ClearWin+ 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