 |
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: Tue Jul 22, 2008 4:26 am Post subject: Beginner Q: Changing focus from window to window |
|
|
I'm new to FTN95 with Win32, and have been using the help files to feel my way through. I'm converting some very old (would you believe FORTRAN 66?) Fortran programs for Windows use. I've gotten the system to open three windows simultaneously, using the %lw format command. I intend these to be three independent windows - no window is a "child" of another, with attendent restrictions on remaining inside the parent window etc.
Actually I intend the first window to be the "main" window, if you will. It is the control panel, adn contains functions and callbacks that can open other windows (not inside the "main" window, but freely anywhere in the display). I don't want any window to be the "child" of another. Not yet, anyway.
But I find that I can't do anything with the first two windows. The third window, being the last one opened, has focus (top border is blue, the other windows' top borders are gray). And I can't put focus on wither of the other two. Clicking in them doesn't do anything, clicking on their top border doesn't do anything, etc. I can't even close the first two windows.
Only if I actually close the third window, does the second window suddenly gain focus. And I still can't do anything with the first window, until I close the second.
It's probably a newbie beginner question, for which the answer is well known to everyone but moi. Somehow I missed it in the help files. But what do I have to do to be able to focus on any window, merely by clicking in it? Or clicking on its top border? And the other window remain open and useable, just not in focus?
Thanks, all! |
|
Back to top |
|
 |
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 8217 Location: Salford, UK
|
Posted: Tue Jul 22, 2008 7:23 am Post subject: |
|
|
You will need to use %lw in each of the three windows.
If you are already doing this then post some sample code and I will check it out. |
|
Back to top |
|
 |
IanLambley
Joined: 17 Dec 2006 Posts: 506 Location: Sunderland
|
Posted: Wed Jul 23, 2008 8:50 am Post subject: |
|
|
Little-Acorn & Paul,
I've had problems in the past, and effectively gave up having more than one window active in a sensible manner. When I have achieved it, I have had to use the %ww[topmost] option, and the window is topmost everything not just the Clearwin window from which it was created.
I've tried your suggestion of %lw on all and I can only control one window at a time:
Code: |
winapp
include <windows.ins>
i=winio@('%ca[window1]%lw',iwin1)
i=winio@('%ca[window2]%lw',iwin2)
i=winio@('%ca[window3]%lw',iwin3)
end
|
I'v tried various other things such as:
Code: |
winapp
implicit real*8(a-h,o-z)
include <windows.ins>
common/handles/iwin1,iwin2,iwin3
common/data/real1,real2,real3
external iwin2_open,iwin3_open
real1 = 0d0
real2 = 0d0
real3 = 0d0
i=winio@('%ca[window1]%ww%sc&','+',iwin2_open,iwin3_open)
i=winio@('%rf',real1)
end
integer*4 function iwin2_open()
implicit real*8(a-h,o-z)
include <windows.ins>
common/handles/iwin1,iwin2,iwin3
common/data/real1,real2,real3
i=winio@('%ca[window2]%lw[owned]&',iwin2)
i=winio@('%rf',real2)
iwin2_open = 1
end
integer*4 function iwin3_open()
implicit real*8(a-h,o-z)
include <windows.ins>
common/handles/iwin1,iwin2,iwin3
common/data/real1,real2,real3
i=winio@('%ca[window3]%lw[owned]&',iwin3)
i=winio@('%rf',real2)
iwin3_open = 1
end
|
with or without [owned]
or:
Code: |
winapp
implicit real*8(a-h,o-z)
include <windows.ins>
external iwin2_open,iwin3_open
common/handles/iwin1,iwin2,iwin3
common/data/real1,real2,real3
real1 = 0d0
real2 = 0d0
real3 = 0d0
i=iwin2_open()
i=iwin3_open()
i=winio@('%ca[window1]%ww&')
i=winio@('%rf&',real1)
i=winio@('%ch&',iwin2)
i=winio@('%ch&',iwin3)
i=winio@('%lw',iwin1)
end
integer*4 function iwin2_open()
implicit real*8(a-h,o-z)
include <windows.ins>
common/handles/iwin1,iwin2,iwin3
common/data/real1,real2,real3
i=winio@('%ca[window2]%`lw[owned]&',iwin2)
i=winio@('%rf',real2)
iwin2_open = 1
end
integer*4 function iwin3_open()
implicit real*8(a-h,o-z)
include <windows.ins>
common/handles/iwin1,iwin2,iwin3
common/data/real1,real2,real3
i=winio@('%ca[window3]%`lw[owned]&',iwin3)
i=winio@('%rf',real3)
iwin3_open = 1
end
|
Help!
Regards
Ian
PS, I hope this problem is not a Giant Oak! |
|
Back to top |
|
 |
Little-Acorn
Joined: 06 Jul 2008 Posts: 111 Location: San Diego
|
Posted: Thu Jul 24, 2008 9:23 pm Post subject: Re: |
|
|
PaulLaidler wrote: | You will need to use %lw in each of the three windows.
If you are already doing this then post some sample code and I will check it out. |
Paul, thank you! This worked, sort of.
I made sure there was a %lw in each. Now when I open three windows, I can click in the 2nd or 3rd, and focus will change from one to the other appropriately. But when I click in the first wondow, I still can't get focus for it. It remains dead, can't access the buttons or dropdown menus in it.
I'll keep after this. But progress has been made!
ON EDIT:
As I said, when I open three windows, i can click the 2nd or third and change focus as expected. But when I click on the first one opened, it stays dead and unresponsive.
WHen I close either the 2nd or 3rd window, suddenly I CAN click between the 1st and the remaining window, and can access the menus and buttons on the 1st as well as the remaining window.
I used to be able to access only the latest-opened window. Now I can access the last two windows that were opened. If I can just get that to three, I'll be a happy man.
Last edited by Little-Acorn on Fri Jul 25, 2008 12:17 am; edited 1 time in total |
|
Back to top |
|
 |
LitusSaxonicum
Joined: 23 Aug 2005 Posts: 2403 Location: Yateley, Hants, UK
|
Posted: Thu Jul 24, 2008 10:45 pm Post subject: |
|
|
Ian,
I modified your first code (which wouldn't work) as follows:
Code: |
winapp
include <windows.ins>
i=winio@('%ca[window1]%lw%ww',iwin1)
i=winio@('%ca[window2]%lw%ww',iwin2)
i=winio@('%ca[window3]%lw%ww',iwin3)
end
|
It's just a %ww in each. Then it worked perfectly. I haven't tried your other codes. My guess is the %ca is "necessary but not sufficient". %ww[topmost] worked not because it was [topmost], but because it was %ww (just a guess).
%ww has other magical properties too...
I think it was an acorn !
Eddie |
|
Back to top |
|
 |
Little-Acorn
Joined: 06 Jul 2008 Posts: 111 Location: San Diego
|
Posted: Sun Jul 27, 2008 12:09 am Post subject: |
|
|
It was indeed an acorn.
I put a %ww in each of the windows (one of them didn't have it), and now I can click from window to window all I want. Thank you all! I'm a happy dude.
Except now I'd like all the windows to close if I close the first-opened one. Right now I can close each independently, but no other way.
Ideally, the way I'd like it to work is:
If I close the second-opened one, only that window closes.
If I click on the third-opened one, only that one closes.
If I close the first-opened one, all the windows produced by this entire program, close.
Possible? |
|
Back to top |
|
 |
IanLambley
Joined: 17 Dec 2006 Posts: 506 Location: Sunderland
|
Posted: Sun Jul 27, 2008 9:08 am Post subject: |
|
|
At the end of the first window defintion, put a %cc closure control callback. In that callback, set the %lw variable to 0 for the windows you want to close and call window_update@. To close the main window, just set the return from the closure callback to zero and return.
e.g.
Code: |
winapp
include <windows.ins>
integer*4 close_all_windows
external close_all_windows
common/window_controls/iwin1,iwin2,iwin3
i=winio@('%ca[window1]%lw%ww&',iwin1)
i=winio@('%cc',close_all_windows)
i=winio@('%ca[window2]%lw%ww',iwin2)
i=winio@('%ca[window3]%lw%ww',iwin3)
end
integer*4 function close_all_windows()
common/window_controls/iwin1,iwin2,iwin3
! close the two dependent windows
iwin2 = 0
iwin3 = 0
call window_update@(iwin2)
call window_update@(iwin3)
!close the main window
close_all_windows = 0
end
|
Regards
Ian |
|
Back to top |
|
 |
LitusSaxonicum
Joined: 23 Aug 2005 Posts: 2403 Location: Yateley, Hants, UK
|
Posted: Mon Aug 04, 2008 10:50 pm Post subject: |
|
|
Ian's method is the simplest.
If you want to do more than simply close the other windows down, you could send them a message. The code for doing this is in a thread I started beginning "Home made multithreading ..." ("General" forum)
Provided that each Window has its own mechanism to field, respond and reply to messages, you can get windows to interact in pretty much any way you want. In the case of the thread I mentioned it was to do "client - server" computing.
Rather disappointingly nobody replied ....
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
|