 |
forums.silverfrost.com Welcome to the Silverfrost forums
|
View previous topic :: View next topic |
Author |
Message |
Little-Acorn
Joined: 06 Jul 2008 Posts: 111 Location: San Diego
|
Posted: Thu Sep 02, 2010 5:47 pm Post subject: Keeping user from clicking other buttons while opening file? |
|
|
I've written a program using Windows in FTN95 (WINAPP, and using "include <windows.ins>" ). In it, the user can click a button whose callback function then calls the normal Windows "open file" routine, that puts up a box letting the user see the files in a directory, pick one of them, and then open it by clicking the box's "Open" button. It works correctly, and all is well.
Except... in the original calling program, that program had earlier put up several other functions with buttons that do other things. And I found by accident, that if the user first clicks the button to put up the open-file box, and then one of the buttons on the original window that do other things, the program gets messed up for various reasons.
Is there a way that, once the user clicks the button to bring up the open-file box, he can't do anything else besides the functions available in that box? Then, once he's navigated around, selected the file he wants, and clicked "open" (or clicked the X in the upper right corner to cancel the box), and the box vanishes, afterward the functions in the original window now work normally again?
Hope that's clear. Sometimes my descriptions aren't.  |
|
Back to top |
|
 |
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 8210 Location: Salford, UK
|
Posted: Thu Sep 02, 2010 9:07 pm Post subject: |
|
|
One way would be to set a global variable before opening the dialog.
When this variable is set, exit the problem callback(s) without doing any work. |
|
Back to top |
|
 |
Little-Acorn
Joined: 06 Jul 2008 Posts: 111 Location: San Diego
|
Posted: Thu Sep 02, 2010 10:00 pm Post subject: Re: |
|
|
PaulLaidler wrote: | One way would be to set a global variable before opening the dialog.
When this variable is set, exit the problem callback(s) without doing any work. |
I'm sorry, Paul, I don't understand what this means. Guess I'm still a relative newbie to Salford and FTN95, I learn mostly by tripping over things.
1.) What is a "global variable", and how do you set it? I assume it's not just any variable in blank Common.
2.) Would such a variable cause the original window to freeze until the file-open box is finished?
3.) Can you give me an example?
Sorry for the hassle,
Little-Acorn |
|
Back to top |
|
 |
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 8210 Location: Salford, UK
|
Posted: Fri Sep 03, 2010 8:06 am Post subject: |
|
|
1) Yes I mean a variable in a common block for example.
2) By "set" I mean give it a value such as 1. Zero when the dialog has closed. The original window should freeze anyway. Let me know if it doesn't.
If the global variable is called Flag then in the main program
Flag = 1
open and close the dialog
Flag = 0
In the callbacks....
integer function cb()
common ....
cb = 2
if(Flag == 1) return
.... |
|
Back to top |
|
 |
LitusSaxonicum
Joined: 23 Aug 2005 Posts: 2402 Location: Yateley, Hants, UK
|
Posted: Sun Sep 05, 2010 1:25 am Post subject: |
|
|
Paul's answer is, as usual, complete and simple. However, my suggestion will get you a much more "standard" application.
If you have any menu item or toolbar buttons that you can't select (because it will mess up the sequence of operations you want to impose on the user) then what you should do is to "grey-out" (or "disable") those menu items and toolbar buttons. So, when your program starts, you can select "Open" or "New" in the file menu, or the corresponding toolbar buttons, but you shouldn't be able to select "Save". Following a successful "Open", you may need to disable "Open" and "New", but to enable "Save" and "Save As" (for example). This basically means keeping all the grey codes (which are integers) in a COMMON block and at the end of every call-back function, go through the list setting or unsetting the codes before you RETURN - COMMON is the old-fashioned Fortran-77 way (I use it), you may prefer to use variables with global scope.
Some controls update instantly when you change the grey code,others need to be specifically updated.
The grey-out (disable) mechanism prevents the user from selecting any option you don't want him to select.
Eddie |
|
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
|