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 

If button in one window opens second window, can I use both?

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



Joined: 06 Jul 2008
Posts: 111
Location: San Diego

PostPosted: Mon Oct 24, 2011 10:33 pm    Post subject: If button in one window opens second window, can I use both? Reply with quote

The question is somewhat related to the other question I just posted in this forum.

I have a program that opens a window. In that window are a number of controls. One of them is a button which, when clicked, opens a second window elsewhere on the screen, that also has a number of controls of its own.

I've noticed that, after the second window is open, I can no longer access any of the controls in the first window, I can only use the controls in the second window. Not until I close the second window, does the first window "come alive" again and I can use its controls.

Is there a way I can use the controls in BOTH windows, while both are open?

This short program illustrates what I mean:



PROGRAM MyMainProg
WINAPP
INCLUDE <windows.ins>
C**********************************************************************

CALL OpenFirstWin

STOP
END
C
C
SUBROUTINE OpenFirstWin()
INTEGER Open2ndWinCallbk
EXTERNAL Open2ndWinCallbk
C* Position the First Window on screen.
i=winio@('%sp&',20,20)
C* Create the First Window.
i=winio@('%ca[This is the first window]&')
C
C* Put short description in First Window.
i=winio@('%`ap&',5.0D0,3.0D0)
i=winio@('%25`rs&',"Short Descr. inside First Window")
C* Put "Open Second Window" button
i=winio@('%`ap&',10.0D0,8.0D0)
C* No ampersand so that first window opens after this statement.
i=winio@('%^bt[Open Second Window]',Open2ndWinCallbk)

RETURN
END
C
C
INTEGER FUNCTION Open2ndWinCallbk()
INTEGER DoNothingCallBk
DOUBLE PRECISION DX,DY
EXTERNAL DoNothingCallBk
C
C* Position the Second Window somewhere else on screen.
DX=RANDOM@()*500.0+100.0
DY=RANDOM@()*400.0+100.0
IX=DX
IY=DY
i=winio@('%sp&',IX,IY)
C* Create the Second Window.
i=winio@('%ca[This is the Second Window]&')
C
C* Put short description.
i=winio@('%`ap&',5.0D0,5.0D0)
i=winio@('%25`rs&',"Short Descr. inside 2nd Win")
C* Put small "Do Nothing" button
i=winio@('%`ap&',10.0D0,12.0D0)
C* No ampersand so that second window opens after this statement.
i=winio@('%^bt[This Button Does Nothing]',DoNothingCallBk)
Open2ndWinCallbk=1
END
C
C
INTEGER FUNCTION DoNothingCallbk()
C
DoNothingCallbk=1
END
Back to top
View user's profile Send private message
JohnHorspool



Joined: 26 Sep 2005
Posts: 270
Location: Gloucestershire UK

PostPosted: Tue Oct 25, 2011 11:39 am    Post subject: Reply with quote

Yes, you can. Finish the winio of the first window using:-

winio@(‘%lw[option]’, ctrl)
integer ctrl (output)

See the help file to explain how to use it.
_________________
John Horspool
Roshaz Software Ltd.
Gloucestershire
Back to top
View user's profile Send private message Visit poster's website
Little-Acorn



Joined: 06 Jul 2008
Posts: 111
Location: San Diego

PostPosted: Tue Oct 25, 2011 8:56 pm    Post subject: Reply with quote

Hmmm, the use of %lw doesn't seem to change much.

The %lw function is obviously used to "leave a window open", hence the letters after the percent. But my windows were already staying open. The problem was, I could only do things with the last-opened window, but cannot do anything (click a button etc.) in the window that was opened first.

Maybe I phrased my question poorly?

I've included the %lw function in the following (simplified) program. Also placed the control variables in a COMMON block because I have a hunch I'll need them, though I don't use them here.

When you start the program, it opens a first window near the upper left corner of the screen, with three buttons in it. The buttons will open a small red window, small blue window, and small green window respectively.

When you click the first button, it will open a red window in another part of the screen (the red window has no button).

At that point I'd like to go back to the first window, and click the second button to open a blue window. Butthe system won't let me go back to the first window - it beeps, and flashes the second (red) window at me, apparently saying that the second window is the ONLY one I can do anything with. Only after I close the second (red) window, does the system let me go back to the first window and either click another button, or close it.

How can I modify the simple program below, so that I can start the program, click the first button in the first window to create a red window, and then click the second button to creat a blue window, and then click the third button to create a green window... all without closing the red or blue windows?

And, while the red, blue, and green windows are still open, how can I go back to the first window and close it, and have the red, blue, and green windows all close automatically at the same time?

--------------------------------------------


PROGRAM MyMainProg
WINAPP
INCLUDE <windows.ins>
COMMON/WinCtls/Icont1,IContRed,IContBlue,IContGreen
CALL OpenFirstWin
STOP
END


SUBROUTINE OpenFirstWin()
INTEGER OpenRedWinCallbk,OpenBlueWinCallbk,OpenGreenWinCallbk
EXTERNAL OpenRedWinCallbk,OpenBlueWinCallbk,OpenGreenWinCallbk
COMMON/WinCtls/Icont1,IContRed,IContBlue,IContGreen
C* Position the First Window on screen.
i=winio@('%sp&',20,20)
i=winio@('Message in 1st window%ca[This is the first window]&')
C* Put three buttons in first window, to open various second windows.
i=winio@('%2nl%^bt[Open Red Window]%2nl&',OpenRedWinCallbk)
i=winio@('%^bt[Open Blue Window]%2nl&',OpenBlueWinCallbk)
i=winio@('%^bt[Open Green Window]&',OpenGreenWinCallbk)
i=winio@('%lw[owned]',Icont1)
RETURN
END


INTEGER FUNCTION OpenRedWinCallbk()
COMMON/WinCtls/Icont1,IContRed,IContBlue,IContGreen
i=winio@('%sp&',200,300)
i=winio@('Message in Red window %ca[This is the Red Window]&')
i=winio@('%bg[red]%lw[owned]',IcontRed)
OpenRedWinCallbk=1
END


INTEGER FUNCTION OpenBlueWinCallbk()
COMMON/WinCtls/Icont1,IContRed,IContBlue,IContGreen
i=winio@('%sp&',250,400)
i=winio@('Message in Blue window %ca[This is the Blue Window]&')
i=winio@('%bg[blue]%lw[owned]',IcontBlue)
OpenBlueWinCallbk=1
END


INTEGER FUNCTION OpenGreenWinCallbk()
COMMON/WinCtls/Icont1,IContRed,IContBlue,IContGreen
i=winio@('%sp&',300,500)
i=winio@('Message in Green window %ca[This is the Green Window]&')
i=winio@('%bg[green]%lw[owned]',IcontGreen)
OpenGreenWinCallbk=1
END

Back to top
View user's profile Send private message
Wilfried Linder



Joined: 14 Nov 2007
Posts: 314
Location: Düsseldorf, Germany

PostPosted: Wed Oct 26, 2011 6:46 am    Post subject: Reply with quote

You should add %ww to each "colour" window:

Code:
PROGRAM MyMainProg
WINAPP
INCLUDE <windows.ins>
INTEGER*4  OpenRedWinCallbk,OpenBlueWinCallbk,OpenGreenWinCallbk
EXTERNAL OpenRedWinCallbk,OpenBlueWinCallbk,OpenGreenWinCallbk
COMMON/WinCtls/Icont1
icont1 = -1
i=winio@('%ca[This is the first window]%sp&',20L,20L)
i=winio@('%^bt[Open Red Window]%2nl&',OpenRedWinCallbk)
i=winio@('%^bt[Open Blue Window]%2nl&',OpenBlueWinCallbk)
i=winio@('%^bt[Open Green Window]%2nl&',OpenGreenWinCallbk)
i=winio@('%^bt[Exit]','+','set',icont1,0L,'EXIT')
END

INTEGER FUNCTION OpenRedWinCallbk()
COMMON/WinCtls/Icont1
i=winio@('%ca[This is the Red Window]%ww[topmost]%sp&',200L,300L)
i=winio@('%bg[red]%lw',Icont1)
OpenRedWinCallbk=2
END

INTEGER FUNCTION OpenBlueWinCallbk()
COMMON/WinCtls/Icont1
i=winio@('%ca[This is the Blue Window]%ww[topmost]%sp&',250L,400L)
i=winio@('%bg[blue]%lw',Icont1)
OpenBlueWinCallbk=2
END

INTEGER FUNCTION OpenGreenWinCallbk()
COMMON/WinCtls/Icont1
i=winio@('%ca[This is the Green Window]%ww[topmost]%sp&',300L,500L)
i=winio@('%bg[green]%lw',Icont1)
OpenGreenWinCallbk=2
END


Regards - Wilfried
Back to top
View user's profile Send private message
Little-Acorn



Joined: 06 Jul 2008
Posts: 111
Location: San Diego

PostPosted: Wed Oct 26, 2011 8:04 pm    Post subject: Reply with quote

GREAT!!! It worked!!!

Thank you so much, Wilfried!
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 -> 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