Sybase NNTP forums - End Of Life (EOL)

The NNTP forums from Sybase - forums.sybase.com - are now closed.

All new questions should be directed to the appropriate forum at the SAP Community Network (SCN).

Individual products have links to the respective forums on SCN, or you can go to SCN and search for your product in the search box (upper right corner) to find your specific developer center.

Close all open windows ina application

14 posts in Objects Last posting was on 2002-10-06 02:28:47.0Z
"test" < Posted on 2002-09-06 16:32:46.0Z
Newsgroups: sybase.public.powerbuilder.objects
From: "test" <@>
Subject: Close all open windows ina application
Date: Fri, 6 Sep 2002 12:32:46 -0400
Lines: 7
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.50.4522.1200
X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4522.1200
NNTP-Posting-Host: 206.137.103.110
Message-ID: <364_HY1qTTcVCHA.258@forums.sybase.com>
Path: forums-1-dub!forums-1-dub!forums-master.sybase.com!forums.sybase.com
Xref: forums-1-dub sybase.public.powerbuilder.objects:965
Article PK: 713530

Hello
I want to close all the windows, that are open, if the user clicks the main
menu EXIT.
Any suggestions welcome.
thanks


Chris Pollach Posted on 2002-09-06 16:56:25.0Z
Newsgroups: sybase.public.powerbuilder.objects
Reply-To: "Chris Pollach" <cpollach@ajja.com>
From: "Chris Pollach" <cpollach@ajja.com>
Subject: Re: Close all open windows ina application
Date: Fri, 6 Sep 2002 12:56:25 -0400
Lines: 15
Organization: STD Inc
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2600.0000
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000
NNTP-Posting-Host: firewall.scc-csc.gc.ca 209.47.227.130
Message-ID: <364_I9Vn6gcVCHA.81@forums.sybase.com>
References: <364_HY1qTTcVCHA.258@forums.sybase.com>
Path: forums-1-dub!forums-1-dub!forums-master.sybase.com!forums.sybase.com
Xref: forums-1-dub sybase.public.powerbuilder.objects:964
Article PK: 713528

Is this an MDI Frame based application?

Regards .. Chris

"test" <@> wrote in message news:HY1qTTcVCHA.258@forums.sybase.com...
> Hello
> I want to close all the windows, that are open, if the user clicks the
main
> menu EXIT.
> Any suggestions welcome.
> thanks
>
>


"test" < Posted on 2002-09-06 17:37:10.0Z
Newsgroups: sybase.public.powerbuilder.objects
From: "test" <@>
Subject: Re: Close all open windows ina application
Date: Fri, 6 Sep 2002 13:37:10 -0400
Lines: 23
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.50.4522.1200
X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4522.1200
NNTP-Posting-Host: 206.137.103.110
Message-ID: <364_KIvyS3cVCHA.276@forums.sybase.com>
References: <364_HY1qTTcVCHA.258@forums.sybase.com> <364_I9Vn6gcVCHA.81@forums.sybase.com>
Path: forums-1-dub!forums-1-dub!forums-master.sybase.com!forums.sybase.com
Xref: forums-1-dub sybase.public.powerbuilder.objects:962
Article PK: 713526

All windows opened are of type MDIHELP except the last actual one which is
type MAIN.

"Chris Pollach" <cpollach@ajja.com> wrote in message
news:I9Vn6gcVCHA.81@forums.sybase.com...
> Is this an MDI Frame based application?
>
> Regards .. Chris
>
> "test" <@> wrote in message news:HY1qTTcVCHA.258@forums.sybase.com...
> > Hello
> > I want to close all the windows, that are open, if the user clicks the
> main
> > menu EXIT.
> > Any suggestions welcome.
> > thanks
> >
> >
>
>


Chris Pollach Posted on 2002-09-06 17:58:19.0Z
Newsgroups: sybase.public.powerbuilder.objects
Reply-To: "Chris Pollach" <cpollach@ajja.com>
From: "Chris Pollach" <cpollach@ajja.com>
Subject: Re: Close all open windows ina application
Date: Fri, 6 Sep 2002 13:58:19 -0400
Lines: 65
Organization: STD Inc
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2600.0000
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000
NNTP-Posting-Host: firewall.scc-csc.gc.ca 209.47.227.130
Message-ID: <364_s#rkgDdVCHA.313@forums.sybase.com>
References: <364_HY1qTTcVCHA.258@forums.sybase.com> <364_I9Vn6gcVCHA.81@forums.sybase.com> <364_KIvyS3cVCHA.276@forums.sybase.com>
Path: forums-1-dub!forums-1-dub!forums-master.sybase.com!forums.sybase.com
Xref: forums-1-dub sybase.public.powerbuilder.objects:960
Article PK: 713522

If all Windows opened are of type MDI something you just violated on of
the 5 rules of MDI (or how not to screw up and MDI application) - ouch!
If that is the case, the only way to know what windows are opened is to keep
track of their addresses. You can use the following approach

Window go_wn[] // Global Array of
Pointers

// Open Script
Int li_no // Work
Var
li_no += UpperBound (go_wn) // Get next open slot?
go_wn[li_no] = Open (MDIWindow) // Open the next and track it


To close all the open Windows use a loop through the array ...
Int li_no // Work
Var
li_no = UpperBound (go_wn) // How Many open so
far?
// Stop at 2nd last Window
for i =li_no to 2 step -1 // Loop thru
backwards (oldest 1st)
If IsValid (go_wn[li_no]) = TRUE THEN
Close ((go_wn[li_no])
END IF
next

Hope that helps. You will have to change the way you open the Main window
dialogs as well to do the same procedure. The process would be much easier
if you had only one MDI window with MDIChild (Sheets) attached as per the
rules of MDI construction. But I was a maintenance programmer as well.

regards ... Chris Pollach
Great White North Technical Evangelist

"test" <@> wrote in message news:KIvyS3cVCHA.276@forums.sybase.com...
> All windows opened are of type MDIHELP except the last actual one which
is
> type MAIN.
>
>
> "Chris Pollach" <cpollach@ajja.com> wrote in message
> news:I9Vn6gcVCHA.81@forums.sybase.com...
> > Is this an MDI Frame based application?
> >
> > Regards .. Chris
> >
> > "test" <@> wrote in message news:HY1qTTcVCHA.258@forums.sybase.com...
> > > Hello
> > > I want to close all the windows, that are open, if the user clicks
the
> > main
> > > menu EXIT.
> > > Any suggestions welcome.
> > > thanks
> > >
> > >
> >
> >
>
>


"test" < Posted on 2002-09-06 18:46:40.0Z
Newsgroups: sybase.public.powerbuilder.objects
From: "test" <@>
Subject: Re: Close all open windows ina application
Date: Fri, 6 Sep 2002 14:46:40 -0400
Lines: 79
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.50.4522.1200
X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4522.1200
NNTP-Posting-Host: 206.137.103.110
Message-ID: <364_PMnTIedVCHA.74@forums.sybase.com>
References: <364_HY1qTTcVCHA.258@forums.sybase.com> <364_I9Vn6gcVCHA.81@forums.sybase.com> <364_KIvyS3cVCHA.276@forums.sybase.com> <364_s#rkgDdVCHA.313@forums.sybase.com>
Path: forums-1-dub!forums-1-dub!forums-master.sybase.com!forums.sybase.com
Xref: forums-1-dub sybase.public.powerbuilder.objects:957
Article PK: 713521

go_wn[li_no] = Open (MDIWindow)
what will the above st do?

"Chris Pollach" <cpollach@ajja.com> wrote in message
news:s#rkgDdVCHA.313@forums.sybase.com...
> If all Windows opened are of type MDI something you just violated on
of
> the 5 rules of MDI (or how not to screw up and MDI application) - ouch!
> If that is the case, the only way to know what windows are opened is to
keep
> track of their addresses. You can use the following approach
>
> Window go_wn[] // Global Array
of
> Pointers
>
> // Open Script
> Int li_no //
Work
> Var
> li_no += UpperBound (go_wn) // Get next open slot?
> go_wn[li_no] = Open (MDIWindow) // Open the next and track
it
>
>
> To close all the open Windows use a loop through the array ...
> Int li_no //
Work
> Var
> li_no = UpperBound (go_wn) // How Many open so
> far?
> // Stop at 2nd last Window
> for i =li_no to 2 step -1 // Loop
thru
> backwards (oldest 1st)
> If IsValid (go_wn[li_no]) = TRUE THEN
> Close ((go_wn[li_no])
> END IF
> next
>
> Hope that helps. You will have to change the way you open the Main window
> dialogs as well to do the same procedure. The process would be much easier
> if you had only one MDI window with MDIChild (Sheets) attached as per the
> rules of MDI construction. But I was a maintenance programmer as well.
>
> regards ... Chris Pollach
> Great White North Technical Evangelist
>
>
> "test" <@> wrote in message news:KIvyS3cVCHA.276@forums.sybase.com...
> > All windows opened are of type MDIHELP except the last actual one which
> is
> > type MAIN.
> >
> >
> > "Chris Pollach" <cpollach@ajja.com> wrote in message
> > news:I9Vn6gcVCHA.81@forums.sybase.com...
> > > Is this an MDI Frame based application?
> > >
> > > Regards .. Chris
> > >
> > > "test" <@> wrote in message news:HY1qTTcVCHA.258@forums.sybase.com...
> > > > Hello
> > > > I want to close all the windows, that are open, if the user clicks
> the
> > > main
> > > > menu EXIT.
> > > > Any suggestions welcome.
> > > > thanks
> > > >
> > > >
> > >
> > >
> >
> >
>
>


Chris Pollach Posted on 2002-09-06 18:47:24.0Z
Newsgroups: sybase.public.powerbuilder.objects
Reply-To: "Chris Pollach" <cpollach@ajja.com>
From: "Chris Pollach" <cpollach@ajja.com>
Subject: Re: Close all open windows ina application
Date: Fri, 6 Sep 2002 14:47:24 -0400
Lines: 92
Organization: STD Inc
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2600.0000
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000
NNTP-Posting-Host: listserv.scc-csc.gc.ca 209.47.227.131
Message-ID: <364_wTFC8edVCHA.81@forums.sybase.com>
References: <364_HY1qTTcVCHA.258@forums.sybase.com> <364_I9Vn6gcVCHA.81@forums.sybase.com> <364_KIvyS3cVCHA.276@forums.sybase.com> <364_s#rkgDdVCHA.313@forums.sybase.com> <364_PMnTIedVCHA.74@forums.sybase.com>
Path: forums-1-dub!forums-1-dub!forums-master.sybase.com!forums.sybase.com
Xref: forums-1-dub sybase.public.powerbuilder.objects:956
Article PK: 713520

Tracks the addresses of all the open Windows!

"test" <@> wrote in message news:PMnTIedVCHA.74@forums.sybase.com...
> go_wn[li_no] = Open (MDIWindow)
> what will the above st do?
>
> "Chris Pollach" <cpollach@ajja.com> wrote in message
> news:s#rkgDdVCHA.313@forums.sybase.com...
> > If all Windows opened are of type MDI something you just violated on
> of
> > the 5 rules of MDI (or how not to screw up and MDI application) - ouch!
> > If that is the case, the only way to know what windows are opened is to
> keep
> > track of their addresses. You can use the following approach
> >
> > Window go_wn[] // Global Array
> of
> > Pointers
> >
> > // Open Script
> > Int li_no //
> Work
> > Var
> > li_no += UpperBound (go_wn) // Get next open
slot?
> > go_wn[li_no] = Open (MDIWindow) // Open the next and track
> it
> >
> >
> > To close all the open Windows use a loop through the array ...
> > Int li_no //
> Work
> > Var
> > li_no = UpperBound (go_wn) // How Many open
so
> > far?
> > // Stop at 2nd last Window
> > for i =li_no to 2 step -1 // Loop
> thru
> > backwards (oldest 1st)
> > If IsValid (go_wn[li_no]) = TRUE THEN
> > Close ((go_wn[li_no])
> > END IF
> > next
> >
> > Hope that helps. You will have to change the way you open the Main
window
> > dialogs as well to do the same procedure. The process would be much
easier
> > if you had only one MDI window with MDIChild (Sheets) attached as per
the
> > rules of MDI construction. But I was a maintenance programmer as well.
> >
> > regards ... Chris Pollach
> > Great White North Technical Evangelist
> >
> >
> > "test" <@> wrote in message news:KIvyS3cVCHA.276@forums.sybase.com...
> > > All windows opened are of type MDIHELP except the last actual one
which
> > is
> > > type MAIN.
> > >
> > >
> > > "Chris Pollach" <cpollach@ajja.com> wrote in message
> > > news:I9Vn6gcVCHA.81@forums.sybase.com...
> > > > Is this an MDI Frame based application?
> > > >
> > > > Regards .. Chris
> > > >
> > > > "test" <@> wrote in message
news:HY1qTTcVCHA.258@forums.sybase.com...
> > > > > Hello
> > > > > I want to close all the windows, that are open, if the user
clicks
> > the
> > > > main
> > > > > menu EXIT.
> > > > > Any suggestions welcome.
> > > > > thanks
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >
> >
> >
>
>


"test" < Posted on 2002-09-06 18:55:56.0Z
Newsgroups: sybase.public.powerbuilder.objects
From: "test" <@>
Subject: Re: Close all open windows ina application
Date: Fri, 6 Sep 2002 14:55:56 -0400
Lines: 109
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.50.4522.1200
X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4522.1200
NNTP-Posting-Host: 206.137.103.110
Message-ID: <364_x1AlTjdVCHA.81@forums.sybase.com>
References: <364_HY1qTTcVCHA.258@forums.sybase.com> <364_I9Vn6gcVCHA.81@forums.sybase.com> <364_KIvyS3cVCHA.276@forums.sybase.com> <364_s#rkgDdVCHA.313@forums.sybase.com> <364_PMnTIedVCHA.74@forums.sybase.com> <364_wTFC8edVCHA.81@forums.sybase.com>
Path: forums-1-dub!forums-1-dub!forums-master.sybase.com!forums.sybase.com
Xref: forums-1-dub sybase.public.powerbuilder.objects:955
Article PK: 713519

Thanks. I'll try to use the code.
One more question ... I can put the loop code in the main menu exit and then
it'll close all the other windows.
But if the user clicks the exit of the second level window then it should
close the third window , so do I put some code there also ?
Thanks for the prompt responses.

"Chris Pollach" <cpollach@ajja.com> wrote in message
news:wTFC8edVCHA.81@forums.sybase.com...
> Tracks the addresses of all the open Windows!
>
> "test" <@> wrote in message news:PMnTIedVCHA.74@forums.sybase.com...
> > go_wn[li_no] = Open (MDIWindow)
> > what will the above st do?
> >
> > "Chris Pollach" <cpollach@ajja.com> wrote in message
> > news:s#rkgDdVCHA.313@forums.sybase.com...
> > > If all Windows opened are of type MDI something you just violated
on
> > of
> > > the 5 rules of MDI (or how not to screw up and MDI application) -
ouch!
> > > If that is the case, the only way to know what windows are opened is
to
> > keep
> > > track of their addresses. You can use the following approach
> > >
> > > Window go_wn[] // Global
Array
> > of
> > > Pointers
> > >
> > > // Open Script
> > > Int li_no //
> > Work
> > > Var
> > > li_no += UpperBound (go_wn) // Get next open
> slot?
> > > go_wn[li_no] = Open (MDIWindow) // Open the next and
track
> > it
> > >
> > >
> > > To close all the open Windows use a loop through the array ...
> > > Int li_no //
> > Work
> > > Var
> > > li_no = UpperBound (go_wn) // How Many open
> so
> > > far?
> > > // Stop at 2nd last Window
> > > for i =li_no to 2 step -1 // Loop
> > thru
> > > backwards (oldest 1st)
> > > If IsValid (go_wn[li_no]) = TRUE THEN
> > > Close ((go_wn[li_no])
> > > END IF
> > > next
> > >
> > > Hope that helps. You will have to change the way you open the Main
> window
> > > dialogs as well to do the same procedure. The process would be much
> easier
> > > if you had only one MDI window with MDIChild (Sheets) attached as per
> the
> > > rules of MDI construction. But I was a maintenance programmer as well.
> > >
> > > regards ... Chris Pollach
> > > Great White North Technical Evangelist
> > >
> > >
> > > "test" <@> wrote in message news:KIvyS3cVCHA.276@forums.sybase.com...
> > > > All windows opened are of type MDIHELP except the last actual one
> which
> > > is
> > > > type MAIN.
> > > >
> > > >
> > > > "Chris Pollach" <cpollach@ajja.com> wrote in message
> > > > news:I9Vn6gcVCHA.81@forums.sybase.com...
> > > > > Is this an MDI Frame based application?
> > > > >
> > > > > Regards .. Chris
> > > > >
> > > > > "test" <@> wrote in message
> news:HY1qTTcVCHA.258@forums.sybase.com...
> > > > > > Hello
> > > > > > I want to close all the windows, that are open, if the user
> clicks
> > > the
> > > > > main
> > > > > > menu EXIT.
> > > > > > Any suggestions welcome.
> > > > > > thanks
> > > > > >
> > > > > >
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >
> >
> >
>
>


Chris Pollach Posted on 2002-09-06 18:57:42.0Z
Newsgroups: sybase.public.powerbuilder.objects
Reply-To: "Chris Pollach" <cpollach@ajja.com>
From: "Chris Pollach" <cpollach@ajja.com>
Subject: Re: Close all open windows ina application
Date: Fri, 6 Sep 2002 14:57:42 -0400
Lines: 124
Organization: STD Inc
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2600.0000
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000
NNTP-Posting-Host: 209.47.227.134
Message-ID: <364_SmOhskdVCHA.276@forums.sybase.com>
References: <364_HY1qTTcVCHA.258@forums.sybase.com> <364_I9Vn6gcVCHA.81@forums.sybase.com> <364_KIvyS3cVCHA.276@forums.sybase.com> <364_s#rkgDdVCHA.313@forums.sybase.com> <364_PMnTIedVCHA.74@forums.sybase.com> <364_wTFC8edVCHA.81@forums.sybase.com> <364_x1AlTjdVCHA.81@forums.sybase.com>
Path: forums-1-dub!forums-1-dub!forums-master.sybase.com!forums.sybase.com
Xref: forums-1-dub sybase.public.powerbuilder.objects:954
Article PK: 713518

Suggestion: Have all menus call a global function that processes the
global Window Arrary.

"test" <@> wrote in message news:x1AlTjdVCHA.81@forums.sybase.com...
> Thanks. I'll try to use the code.
> One more question ... I can put the loop code in the main menu exit and
then
> it'll close all the other windows.
> But if the user clicks the exit of the second level window then it should
> close the third window , so do I put some code there also ?
> Thanks for the prompt responses.
>
>
> "Chris Pollach" <cpollach@ajja.com> wrote in message
> news:wTFC8edVCHA.81@forums.sybase.com...
> > Tracks the addresses of all the open Windows!
> >
> > "test" <@> wrote in message news:PMnTIedVCHA.74@forums.sybase.com...
> > > go_wn[li_no] = Open (MDIWindow)
> > > what will the above st do?
> > >
> > > "Chris Pollach" <cpollach@ajja.com> wrote in message
> > > news:s#rkgDdVCHA.313@forums.sybase.com...
> > > > If all Windows opened are of type MDI something you just
violated
> on
> > > of
> > > > the 5 rules of MDI (or how not to screw up and MDI application) -
> ouch!
> > > > If that is the case, the only way to know what windows are opened is
> to
> > > keep
> > > > track of their addresses. You can use the following approach
> > > >
> > > > Window go_wn[] // Global
> Array
> > > of
> > > > Pointers
> > > >
> > > > // Open Script
> > > > Int li_no
//
> > > Work
> > > > Var
> > > > li_no += UpperBound (go_wn) // Get next open
> > slot?
> > > > go_wn[li_no] = Open (MDIWindow) // Open the next and
> track
> > > it
> > > >
> > > >
> > > > To close all the open Windows use a loop through the array ...
> > > > Int li_no
//
> > > Work
> > > > Var
> > > > li_no = UpperBound (go_wn) // How Many
open
> > so
> > > > far?
> > > > // Stop at 2nd last Window
> > > > for i =li_no to 2 step -1 //
Loop
> > > thru
> > > > backwards (oldest 1st)
> > > > If IsValid (go_wn[li_no]) = TRUE THEN
> > > > Close ((go_wn[li_no])
> > > > END IF
> > > > next
> > > >
> > > > Hope that helps. You will have to change the way you open the Main
> > window
> > > > dialogs as well to do the same procedure. The process would be much
> > easier
> > > > if you had only one MDI window with MDIChild (Sheets) attached as
per
> > the
> > > > rules of MDI construction. But I was a maintenance programmer as
well.
> > > >
> > > > regards ... Chris Pollach
> > > > Great White North Technical Evangelist
> > > >
> > > >
> > > > "test" <@> wrote in message
news:KIvyS3cVCHA.276@forums.sybase.com...
> > > > > All windows opened are of type MDIHELP except the last actual one
> > which
> > > > is
> > > > > type MAIN.
> > > > >
> > > > >
> > > > > "Chris Pollach" <cpollach@ajja.com> wrote in message
> > > > > news:I9Vn6gcVCHA.81@forums.sybase.com...
> > > > > > Is this an MDI Frame based application?
> > > > > >
> > > > > > Regards .. Chris
> > > > > >
> > > > > > "test" <@> wrote in message
> > news:HY1qTTcVCHA.258@forums.sybase.com...
> > > > > > > Hello
> > > > > > > I want to close all the windows, that are open, if the user
> > clicks
> > > > the
> > > > > > main
> > > > > > > menu EXIT.
> > > > > > > Any suggestions welcome.
> > > > > > > thanks
> > > > > > >
> > > > > > >
> > > > > >
> > > > > >
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >
> >
> >
>
>


"test" < Posted on 2002-09-09 14:12:18.0Z
Newsgroups: sybase.public.powerbuilder.objects
From: "test" <@>
Subject: Re: Close all open windows ina application
Date: Mon, 9 Sep 2002 10:12:18 -0400
Lines: 158
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.50.4522.1200
X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4522.1200
NNTP-Posting-Host: 206.137.103.110
Message-ID: <364_GPbkzyAWCHA.288@forums.sybase.com>
References: <364_HY1qTTcVCHA.258@forums.sybase.com> <364_I9Vn6gcVCHA.81@forums.sybase.com> <364_KIvyS3cVCHA.276@forums.sybase.com> <364_s#rkgDdVCHA.313@forums.sybase.com> <364_PMnTIedVCHA.74@forums.sybase.com> <364_wTFC8edVCHA.81@forums.sybase.com> <364_x1AlTjdVCHA.81@forums.sybase.com> <364_SmOhskdVCHA.276@forums.sybase.com>
Path: forums-1-dub!forums-1-dub!forums-master.sybase.com!forums.sybase.com
Xref: forums-1-dub sybase.public.powerbuilder.objects:950
Article PK: 713512

Sorry to bug you again Chris. I was trying to use the code. I put the
following lines in the menu from where I am opening the window
li_no += UpperBound (go_wn)
go_wn[li_no] = w_business_module
I put the following for one menu all elements. But the app crashes and says
'Array boundary exceeded' .
Also created a function. When I close the second level window(MDI) and call
the function I need to pass something to this function to tell to close only
windows till that level right ? How do I figure that out ?
Thanks in advance.
Int li_no
long i
li_no = UpperBound (go_wn) // How Many open so far?
// Stop at 2nd last Window
for i =li_no to 2 step -1 // Loop thru backwards (oldest 1st)
If IsValid (go_wn[li_no]) = TRUE THEN
Close (go_wn[li_no])
END IF
next

"Chris Pollach" <cpollach@ajja.com> wrote in message
news:SmOhskdVCHA.276@forums.sybase.com...
> Suggestion: Have all menus call a global function that processes the
> global Window Arrary.
>
> "test" <@> wrote in message news:x1AlTjdVCHA.81@forums.sybase.com...
> > Thanks. I'll try to use the code.
> > One more question ... I can put the loop code in the main menu exit and
> then
> > it'll close all the other windows.
> > But if the user clicks the exit of the second level window then it
should
> > close the third window , so do I put some code there also ?
> > Thanks for the prompt responses.
> >
> >
> > "Chris Pollach" <cpollach@ajja.com> wrote in message
> > news:wTFC8edVCHA.81@forums.sybase.com...
> > > Tracks the addresses of all the open Windows!
> > >
> > > "test" <@> wrote in message news:PMnTIedVCHA.74@forums.sybase.com...
> > > > go_wn[li_no] = Open (MDIWindow)
> > > > what will the above st do?
> > > >
> > > > "Chris Pollach" <cpollach@ajja.com> wrote in message
> > > > news:s#rkgDdVCHA.313@forums.sybase.com...
> > > > > If all Windows opened are of type MDI something you just
> violated
> > on
> > > > of
> > > > > the 5 rules of MDI (or how not to screw up and MDI application) -
> > ouch!
> > > > > If that is the case, the only way to know what windows are opened
is
> > to
> > > > keep
> > > > > track of their addresses. You can use the following approach
> > > > >
> > > > > Window go_wn[] // Global
> > Array
> > > > of
> > > > > Pointers
> > > > >
> > > > > // Open Script
> > > > > Int li_no
> //
> > > > Work
> > > > > Var
> > > > > li_no += UpperBound (go_wn) // Get next
open
> > > slot?
> > > > > go_wn[li_no] = Open (MDIWindow) // Open the next and
> > track
> > > > it
> > > > >
> > > > >
> > > > > To close all the open Windows use a loop through the array ...
> > > > > Int li_no
> //
> > > > Work
> > > > > Var
> > > > > li_no = UpperBound (go_wn) // How Many
> open
> > > so
> > > > > far?
> > > > > // Stop at 2nd last Window
> > > > > for i =li_no to 2 step -1 //
> Loop
> > > > thru
> > > > > backwards (oldest 1st)
> > > > > If IsValid (go_wn[li_no]) = TRUE THEN
> > > > > Close ((go_wn[li_no])
> > > > > END IF
> > > > > next
> > > > >
> > > > > Hope that helps. You will have to change the way you open the Main
> > > window
> > > > > dialogs as well to do the same procedure. The process would be
much
> > > easier
> > > > > if you had only one MDI window with MDIChild (Sheets) attached as
> per
> > > the
> > > > > rules of MDI construction. But I was a maintenance programmer as
> well.
> > > > >
> > > > > regards ... Chris Pollach
> > > > > Great White North Technical Evangelist
> > > > >
> > > > >
> > > > > "test" <@> wrote in message
> news:KIvyS3cVCHA.276@forums.sybase.com...
> > > > > > All windows opened are of type MDIHELP except the last actual
one
> > > which
> > > > > is
> > > > > > type MAIN.
> > > > > >
> > > > > >
> > > > > > "Chris Pollach" <cpollach@ajja.com> wrote in message
> > > > > > news:I9Vn6gcVCHA.81@forums.sybase.com...
> > > > > > > Is this an MDI Frame based application?
> > > > > > >
> > > > > > > Regards .. Chris
> > > > > > >
> > > > > > > "test" <@> wrote in message
> > > news:HY1qTTcVCHA.258@forums.sybase.com...
> > > > > > > > Hello
> > > > > > > > I want to close all the windows, that are open, if the user
> > > clicks
> > > > > the
> > > > > > > main
> > > > > > > > menu EXIT.
> > > > > > > > Any suggestions welcome.
> > > > > > > > thanks
> > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > > >
> > > > > >
> > > > > >
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >
> >
> >
>
>


Arnoud Oortwijk Posted on 2002-09-09 14:37:18.0Z
Newsgroups: sybase.public.powerbuilder.objects
From: "Arnoud Oortwijk" <aoortwijk@tangram.nl>
Subject: Re: Close all open windows ina application
Date: Mon, 9 Sep 2002 16:37:18 +0200
Lines: 202
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.50.4522.1200
X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4522.1200
NNTP-Posting-Host: tangram.nl 213.84.194.121
Message-ID: <364_nkZXiBBWCHA.300@forums.sybase.com>
References: <364_HY1qTTcVCHA.258@forums.sybase.com> <364_I9Vn6gcVCHA.81@forums.sybase.com> <364_KIvyS3cVCHA.276@forums.sybase.com> <364_s#rkgDdVCHA.313@forums.sybase.com> <364_PMnTIedVCHA.74@forums.sybase.com> <364_wTFC8edVCHA.81@forums.sybase.com> <364_x1AlTjdVCHA.81@forums.sybase.com> <364_SmOhskdVCHA.276@forums.sybase.com> <364_GPbkzyAWCHA.288@forums.sybase.com>
Path: forums-1-dub!forums-1-dub!forums-master.sybase.com!forums.sybase.com
Xref: forums-1-dub sybase.public.powerbuilder.objects:949
Article PK: 713509

try
li_no = upperbound( go_wn ) + 1
go_wn[li_no] = w_business_module

I just asume w_business_module is a variable with a reference to the window
you've just opened?


If I can make a suggestion, I would have the window register itselve in the
open event of the window. Something like:
go_wn[ Upperbound( go_wn[] ) + 1 ] = this
This you can code in your ancestor object and won't have to code it in the
menu for every window you open.

To close all windows after the one opened. Create a global function (or a
function on the application manager object if you're using one )
f_CloseAllWindowsAfterOpenedAfterThisOne( WINDOW aw_window ) RETURNS INTEGER
// first find the array element that matches the argument of the function
// close all valid windows in the argument after the element you found


HTH

Arnoud
Url: http://www.gloriant.be



"test" <@> schreef in bericht news:GPbkzyAWCHA.288@forums.sybase.com...

> Sorry to bug you again Chris. I was trying to use the code. I put the
> following lines in the menu from where I am opening the window
> li_no += UpperBound (go_wn)
> go_wn[li_no] = w_business_module
> I put the following for one menu all elements. But the app crashes and
says
> 'Array boundary exceeded' .
> Also created a function. When I close the second level window(MDI) and
call
> the function I need to pass something to this function to tell to close
only
> windows till that level right ? How do I figure that out ?
> Thanks in advance.
> Int li_no
> long i
> li_no = UpperBound (go_wn) // How Many open so far?
> // Stop at 2nd last Window
> for i =li_no to 2 step -1 // Loop thru backwards (oldest 1st)
> If IsValid (go_wn[li_no]) = TRUE THEN
> Close (go_wn[li_no])
> END IF
> next
>
>
>
>
>
>
> "Chris Pollach" <cpollach@ajja.com> wrote in message
> news:SmOhskdVCHA.276@forums.sybase.com...
> > Suggestion: Have all menus call a global function that processes the
> > global Window Arrary.
> >
> > "test" <@> wrote in message news:x1AlTjdVCHA.81@forums.sybase.com...
> > > Thanks. I'll try to use the code.
> > > One more question ... I can put the loop code in the main menu exit
and
> > then
> > > it'll close all the other windows.
> > > But if the user clicks the exit of the second level window then it
> should
> > > close the third window , so do I put some code there also ?
> > > Thanks for the prompt responses.
> > >
> > >
> > > "Chris Pollach" <cpollach@ajja.com> wrote in message
> > > news:wTFC8edVCHA.81@forums.sybase.com...
> > > > Tracks the addresses of all the open Windows!
> > > >
> > > > "test" <@> wrote in message news:PMnTIedVCHA.74@forums.sybase.com...
> > > > > go_wn[li_no] = Open (MDIWindow)
> > > > > what will the above st do?
> > > > >
> > > > > "Chris Pollach" <cpollach@ajja.com> wrote in message
> > > > > news:s#rkgDdVCHA.313@forums.sybase.com...
> > > > > > If all Windows opened are of type MDI something you just
> > violated
> > > on
> > > > > of
> > > > > > the 5 rules of MDI (or how not to screw up and MDI
application) -
> > > ouch!
> > > > > > If that is the case, the only way to know what windows are
opened
> is
> > > to
> > > > > keep
> > > > > > track of their addresses. You can use the following approach
> > > > > >
> > > > > > Window go_wn[] //
Global
> > > Array
> > > > > of
> > > > > > Pointers
> > > > > >
> > > > > > // Open Script
> > > > > > Int li_no
> > //
> > > > > Work
> > > > > > Var
> > > > > > li_no += UpperBound (go_wn) // Get next
> open
> > > > slot?
> > > > > > go_wn[li_no] = Open (MDIWindow) // Open the next
and
> > > track
> > > > > it
> > > > > >
> > > > > >
> > > > > > To close all the open Windows use a loop through the array ...
> > > > > > Int li_no
> > //
> > > > > Work
> > > > > > Var
> > > > > > li_no = UpperBound (go_wn) // How
Many
> > open
> > > > so
> > > > > > far?
> > > > > > // Stop at 2nd last Window
> > > > > > for i =li_no to 2 step -1
//
> > Loop
> > > > > thru
> > > > > > backwards (oldest 1st)
> > > > > > If IsValid (go_wn[li_no]) = TRUE THEN
> > > > > > Close ((go_wn[li_no])
> > > > > > END IF
> > > > > > next
> > > > > >
> > > > > > Hope that helps. You will have to change the way you open the
Main
> > > > window
> > > > > > dialogs as well to do the same procedure. The process would be
> much
> > > > easier
> > > > > > if you had only one MDI window with MDIChild (Sheets) attached
as
> > per
> > > > the
> > > > > > rules of MDI construction. But I was a maintenance programmer as
> > well.
> > > > > >
> > > > > > regards ... Chris Pollach
> > > > > > Great White North Technical Evangelist
> > > > > >
> > > > > >
> > > > > > "test" <@> wrote in message
> > news:KIvyS3cVCHA.276@forums.sybase.com...
> > > > > > > All windows opened are of type MDIHELP except the last actual
> one
> > > > which
> > > > > > is
> > > > > > > type MAIN.
> > > > > > >
> > > > > > >
> > > > > > > "Chris Pollach" <cpollach@ajja.com> wrote in message
> > > > > > > news:I9Vn6gcVCHA.81@forums.sybase.com...
> > > > > > > > Is this an MDI Frame based application?
> > > > > > > >
> > > > > > > > Regards .. Chris
> > > > > > > >
> > > > > > > > "test" <@> wrote in message
> > > > news:HY1qTTcVCHA.258@forums.sybase.com...
> > > > > > > > > Hello
> > > > > > > > > I want to close all the windows, that are open, if the
user
> > > > clicks
> > > > > > the
> > > > > > > > main
> > > > > > > > > menu EXIT.
> > > > > > > > > Any suggestions welcome.
> > > > > > > > > thanks
> > > > > > > > >
> > > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > > >
> > > > > >
> > > > > >
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >
> >
> >
>
>


dasda Posted on 2002-10-06 02:28:47.0Z
Newsgroups: sybase.public.powerbuilder.objects
From: dasda
Date: Sat, 5 Oct 2002 22:28:47 -0400
Subject: Re: Close all open windows ina application
Lines: 1
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Message-ID: <364_7AC4C218C884DCA1000D9F3A85256C4A.0054FBB685256C30@webforums>
References: <364_HY1qTTcVCHA.258@forums.sybase.com> <364_I9Vn6gcVCHA.81@forums.sybase.com> <364_KIvyS3cVCHA.276@forums.sybase.com> <364_s#rkgDdVCHA.313@forums.sybase.com> <364_PMnTIedVCHA.74@forums.sybase.com> <364_wTFC8edVCHA.81@forums.sybase.com> <364_x1AlTjdVCHA.81@forums.sybase.com> <364_SmOhskdVCHA.276@forums.sybase.com> <364_GPbkzyAWCHA.288@forums.sybase.com> <364_nkZXiBBWCHA.300@forums.sybase.com>
Path: forums-1-dub!forums-1-dub!forums-master.sybase.com!forums.sybase.com!webforums.sybase.com!news
Xref: forums-1-dub sybase.public.powerbuilder.objects:874
Article PK: 713448

pon halt


Arnoud Oortwijk Posted on 2002-09-10 09:28:24.0Z
Newsgroups: sybase.public.powerbuilder.objects
From: "Arnoud Oortwijk" <aoortwijk@tangram.nl>
Subject: Re: Close all open windows ina application
Date: Tue, 10 Sep 2002 11:28:24 +0200
Lines: 269
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.50.4522.1200
X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4522.1200
NNTP-Posting-Host: tangram.nl 213.84.194.121
Message-ID: <364_Kdmzk5KWCHA.316@forums.sybase.com>
References: <364_HY1qTTcVCHA.258@forums.sybase.com> <364_I9Vn6gcVCHA.81@forums.sybase.com> <364_KIvyS3cVCHA.276@forums.sybase.com> <364_s#rkgDdVCHA.313@forums.sybase.com> <364_PMnTIedVCHA.74@forums.sybase.com> <364_wTFC8edVCHA.81@forums.sybase.com> <364_x1AlTjdVCHA.81@forums.sybase.com> <364_SmOhskdVCHA.276@forums.sybase.com> <364_GPbkzyAWCHA.288@forums.sybase.com> <364_nkZXiBBWCHA.300@forums.sybase.com>
Path: forums-1-dub!forums-1-dub!forums-master.sybase.com!forums.sybase.com
Xref: forums-1-dub sybase.public.powerbuilder.objects:946
Article PK: 713510

Your comparision is valid as far as I can see. What do you mean 'it's not
working'? Do you get an error? When you invoke the function do you pass on
'this'? Do you invoke the function in the closequery event of the window?

Arnoud



"test" <@> schreef in bericht news:YCAqL$CWCHA.161@forums.sybase.com...

> f_CloseAllWindowsAfterOpenedAfterThisOne( WINDOW aw_window )
> int li_no,li_limitlong i,j
> li_no = UpperBound (go_wn) // How Many open so far?
> IF li_no < 1 THEN return
> FOR j = 1 to li_no
> IF go_wn[li_no] = aw_window THEN (Is this how you'll match the array
> element & argument ?, its not working)
> li_limit = li_no
> EXIT
> END IF
> NEXT
>
> // Stop at 2nd last Window
> for i =li_no to li_limit step -1 // Loop thru backwards (oldest 1st)
> If IsValid (go_wn[i]) = TRUE THEN
> Close (go_wn[i]) ( It should be go_wn[i] or go_wn[li_no] ?)
> END IF
> next
>
> I did put this go_wn[ Upperbound( go_wn[] ) + 1 ] = this in the open
event.
> works fine.
> Thanks
>
>
>
>
>
>
>
>
>
> "Arnoud Oortwijk" <aoortwijk@tangram.nl> wrote in message
> news:nkZXiBBWCHA.300@forums.sybase.com...
> > try
> > li_no = upperbound( go_wn ) + 1
> > go_wn[li_no] = w_business_module
> >
> > I just asume w_business_module is a variable with a reference to the
> window
> > you've just opened?
> >
> >
> > If I can make a suggestion, I would have the window register itselve in
> the
> > open event of the window. Something like:
> > go_wn[ Upperbound( go_wn[] ) + 1 ] = this
> > This you can code in your ancestor object and won't have to code it in
the
> > menu for every window you open.
> >
> > To close all windows after the one opened. Create a global function (or
a
> > function on the application manager object if you're using one )
> > f_CloseAllWindowsAfterOpenedAfterThisOne( WINDOW aw_window ) RETURNS
> INTEGER
> > // first find the array element that matches the argument of the
function
> > // close all valid windows in the argument after the element you found
> >
> >
> > HTH
> >
> > Arnoud
> > Url: http://www.gloriant.be
> >
> >
> >
> > "test" <@> schreef in bericht news:GPbkzyAWCHA.288@forums.sybase.com...
> > > Sorry to bug you again Chris. I was trying to use the code. I put the
> > > following lines in the menu from where I am opening the window
> > > li_no += UpperBound (go_wn)
> > > go_wn[li_no] = w_business_module
> > > I put the following for one menu all elements. But the app crashes and
> > says
> > > 'Array boundary exceeded' .
> > > Also created a function. When I close the second level window(MDI) and
> > call
> > > the function I need to pass something to this function to tell to
close
> > only
> > > windows till that level right ? How do I figure that out ?
> > > Thanks in advance.
> > > Int li_no
> > > long i
> > > li_no = UpperBound (go_wn) // How Many open so far?
> > > // Stop at 2nd last Window
> > > for i =li_no to 2 step -1 // Loop thru backwards (oldest 1st)
> > > If IsValid (go_wn[li_no]) = TRUE THEN
> > > Close (go_wn[li_no])
> > > END IF
> > > next
> > >
> > >
> > >
> > >
> > >
> > >
> > > "Chris Pollach" <cpollach@ajja.com> wrote in message
> > > news:SmOhskdVCHA.276@forums.sybase.com...
> > > > Suggestion: Have all menus call a global function that processes
> the
> > > > global Window Arrary.
> > > >
> > > > "test" <@> wrote in message news:x1AlTjdVCHA.81@forums.sybase.com...
> > > > > Thanks. I'll try to use the code.
> > > > > One more question ... I can put the loop code in the main menu
exit
> > and
> > > > then
> > > > > it'll close all the other windows.
> > > > > But if the user clicks the exit of the second level window then it
> > > should
> > > > > close the third window , so do I put some code there also ?
> > > > > Thanks for the prompt responses.
> > > > >
> > > > >
> > > > > "Chris Pollach" <cpollach@ajja.com> wrote in message
> > > > > news:wTFC8edVCHA.81@forums.sybase.com...
> > > > > > Tracks the addresses of all the open Windows!
> > > > > >
> > > > > > "test" <@> wrote in message
> news:PMnTIedVCHA.74@forums.sybase.com...
> > > > > > > go_wn[li_no] = Open (MDIWindow)
> > > > > > > what will the above st do?
> > > > > > >
> > > > > > > "Chris Pollach" <cpollach@ajja.com> wrote in message
> > > > > > > news:s#rkgDdVCHA.313@forums.sybase.com...
> > > > > > > > If all Windows opened are of type MDI something you just
> > > > violated
> > > > > on
> > > > > > > of
> > > > > > > > the 5 rules of MDI (or how not to screw up and MDI
> > application) -
> > > > > ouch!
> > > > > > > > If that is the case, the only way to know what windows are
> > opened
> > > is
> > > > > to
> > > > > > > keep
> > > > > > > > track of their addresses. You can use the following approach
> > > > > > > >
> > > > > > > > Window go_wn[] //
> > Global
> > > > > Array
> > > > > > > of
> > > > > > > > Pointers
> > > > > > > >
> > > > > > > > // Open Script
> > > > > > > > Int li_no
> > > > //
> > > > > > > Work
> > > > > > > > Var
> > > > > > > > li_no += UpperBound (go_wn) // Get
next
> > > open
> > > > > > slot?
> > > > > > > > go_wn[li_no] = Open (MDIWindow) // Open the
next
> > and
> > > > > track
> > > > > > > it
> > > > > > > >
> > > > > > > >
> > > > > > > > To close all the open Windows use a loop through the array
...
> > > > > > > > Int li_no
> > > > //
> > > > > > > Work
> > > > > > > > Var
> > > > > > > > li_no = UpperBound (go_wn) // How
> > Many
> > > > open
> > > > > > so
> > > > > > > > far?
> > > > > > > > // Stop at 2nd last Window
> > > > > > > > for i =li_no to 2 step -1
> > //
> > > > Loop
> > > > > > > thru
> > > > > > > > backwards (oldest 1st)
> > > > > > > > If IsValid (go_wn[li_no]) = TRUE THEN
> > > > > > > > Close ((go_wn[li_no])
> > > > > > > > END IF
> > > > > > > > next
> > > > > > > >
> > > > > > > > Hope that helps. You will have to change the way you open
the
> > Main
> > > > > > window
> > > > > > > > dialogs as well to do the same procedure. The process would
be
> > > much
> > > > > > easier
> > > > > > > > if you had only one MDI window with MDIChild (Sheets)
attached
> > as
> > > > per
> > > > > > the
> > > > > > > > rules of MDI construction. But I was a maintenance
programmer
> as
> > > > well.
> > > > > > > >
> > > > > > > > regards ... Chris Pollach
> > > > > > > > Great White North Technical Evangelist
> > > > > > > >
> > > > > > > >
> > > > > > > > "test" <@> wrote in message
> > > > news:KIvyS3cVCHA.276@forums.sybase.com...
> > > > > > > > > All windows opened are of type MDIHELP except the last
> actual
> > > one
> > > > > > which
> > > > > > > > is
> > > > > > > > > type MAIN.
> > > > > > > > >
> > > > > > > > >
> > > > > > > > > "Chris Pollach" <cpollach@ajja.com> wrote in message
> > > > > > > > > news:I9Vn6gcVCHA.81@forums.sybase.com...
> > > > > > > > > > Is this an MDI Frame based application?
> > > > > > > > > >
> > > > > > > > > > Regards .. Chris
> > > > > > > > > >
> > > > > > > > > > "test" <@> wrote in message
> > > > > > news:HY1qTTcVCHA.258@forums.sybase.com...
> > > > > > > > > > > Hello
> > > > > > > > > > > I want to close all the windows, that are open, if
the
> > user
> > > > > > clicks
> > > > > > > > the
> > > > > > > > > > main
> > > > > > > > > > > menu EXIT.
> > > > > > > > > > > Any suggestions welcome.
> > > > > > > > > > > thanks
> > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > > >
> > > > > > > > > >
> > > > > > > > >
> > > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > > >
> > > > > >
> > > > > >
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >
> >
> >
>
>


"test" < Posted on 2002-09-09 18:23:31.0Z
Newsgroups: sybase.public.powerbuilder.objects
From: "test" <@>
Subject: Re: Close all open windows ina application
Date: Mon, 9 Sep 2002 14:23:31 -0400
Lines: 244
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.50.4522.1200
X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4522.1200
NNTP-Posting-Host: 206.137.103.110
Message-ID: <364_YCAqL$CWCHA.161@forums.sybase.com>
References: <364_HY1qTTcVCHA.258@forums.sybase.com> <364_I9Vn6gcVCHA.81@forums.sybase.com> <364_KIvyS3cVCHA.276@forums.sybase.com> <364_s#rkgDdVCHA.313@forums.sybase.com> <364_PMnTIedVCHA.74@forums.sybase.com> <364_wTFC8edVCHA.81@forums.sybase.com> <364_x1AlTjdVCHA.81@forums.sybase.com> <364_SmOhskdVCHA.276@forums.sybase.com> <364_GPbkzyAWCHA.288@forums.sybase.com> <364_nkZXiBBWCHA.300@forums.sybase.com>
Path: forums-1-dub!forums-1-dub!forums-master.sybase.com!forums.sybase.com
Xref: forums-1-dub sybase.public.powerbuilder.objects:948
Article PK: 713511

f_CloseAllWindowsAfterOpenedAfterThisOne( WINDOW aw_window )
int li_no,li_limitlong i,j
li_no = UpperBound (go_wn) // How Many open so far?
IF li_no < 1 THEN return
FOR j = 1 to li_no
IF go_wn[li_no] = aw_window THEN (Is this how you'll match the array
element & argument ?, its not working)
li_limit = li_no
EXIT
END IF
NEXT

// Stop at 2nd last Window
for i =li_no to li_limit step -1 // Loop thru backwards (oldest 1st)
If IsValid (go_wn[i]) = TRUE THEN
Close (go_wn[i]) ( It should be go_wn[i] or go_wn[li_no] ?)
END IF
next

I did put this go_wn[ Upperbound( go_wn[] ) + 1 ] = this in the open event.
works fine.
Thanks

"Arnoud Oortwijk" <aoortwijk@tangram.nl> wrote in message
news:nkZXiBBWCHA.300@forums.sybase.com...
> try
> li_no = upperbound( go_wn ) + 1
> go_wn[li_no] = w_business_module
>
> I just asume w_business_module is a variable with a reference to the
window
> you've just opened?
>
>
> If I can make a suggestion, I would have the window register itselve in
the
> open event of the window. Something like:
> go_wn[ Upperbound( go_wn[] ) + 1 ] = this
> This you can code in your ancestor object and won't have to code it in the
> menu for every window you open.
>
> To close all windows after the one opened. Create a global function (or a
> function on the application manager object if you're using one )
> f_CloseAllWindowsAfterOpenedAfterThisOne( WINDOW aw_window ) RETURNS
INTEGER
> // first find the array element that matches the argument of the function
> // close all valid windows in the argument after the element you found
>
>
> HTH
>
> Arnoud
> Url: http://www.gloriant.be
>
>
>
> "test" <@> schreef in bericht news:GPbkzyAWCHA.288@forums.sybase.com...
> > Sorry to bug you again Chris. I was trying to use the code. I put the
> > following lines in the menu from where I am opening the window
> > li_no += UpperBound (go_wn)
> > go_wn[li_no] = w_business_module
> > I put the following for one menu all elements. But the app crashes and
> says
> > 'Array boundary exceeded' .
> > Also created a function. When I close the second level window(MDI) and
> call
> > the function I need to pass something to this function to tell to close
> only
> > windows till that level right ? How do I figure that out ?
> > Thanks in advance.
> > Int li_no
> > long i
> > li_no = UpperBound (go_wn) // How Many open so far?
> > // Stop at 2nd last Window
> > for i =li_no to 2 step -1 // Loop thru backwards (oldest 1st)
> > If IsValid (go_wn[li_no]) = TRUE THEN
> > Close (go_wn[li_no])
> > END IF
> > next
> >
> >
> >
> >
> >
> >
> > "Chris Pollach" <cpollach@ajja.com> wrote in message
> > news:SmOhskdVCHA.276@forums.sybase.com...
> > > Suggestion: Have all menus call a global function that processes
the
> > > global Window Arrary.
> > >
> > > "test" <@> wrote in message news:x1AlTjdVCHA.81@forums.sybase.com...
> > > > Thanks. I'll try to use the code.
> > > > One more question ... I can put the loop code in the main menu exit
> and
> > > then
> > > > it'll close all the other windows.
> > > > But if the user clicks the exit of the second level window then it
> > should
> > > > close the third window , so do I put some code there also ?
> > > > Thanks for the prompt responses.
> > > >
> > > >
> > > > "Chris Pollach" <cpollach@ajja.com> wrote in message
> > > > news:wTFC8edVCHA.81@forums.sybase.com...
> > > > > Tracks the addresses of all the open Windows!
> > > > >
> > > > > "test" <@> wrote in message
news:PMnTIedVCHA.74@forums.sybase.com...
> > > > > > go_wn[li_no] = Open (MDIWindow)
> > > > > > what will the above st do?
> > > > > >
> > > > > > "Chris Pollach" <cpollach@ajja.com> wrote in message
> > > > > > news:s#rkgDdVCHA.313@forums.sybase.com...
> > > > > > > If all Windows opened are of type MDI something you just
> > > violated
> > > > on
> > > > > > of
> > > > > > > the 5 rules of MDI (or how not to screw up and MDI
> application) -
> > > > ouch!
> > > > > > > If that is the case, the only way to know what windows are
> opened
> > is
> > > > to
> > > > > > keep
> > > > > > > track of their addresses. You can use the following approach
> > > > > > >
> > > > > > > Window go_wn[] //
> Global
> > > > Array
> > > > > > of
> > > > > > > Pointers
> > > > > > >
> > > > > > > // Open Script
> > > > > > > Int li_no
> > > //
> > > > > > Work
> > > > > > > Var
> > > > > > > li_no += UpperBound (go_wn) // Get next
> > open
> > > > > slot?
> > > > > > > go_wn[li_no] = Open (MDIWindow) // Open the next
> and
> > > > track
> > > > > > it
> > > > > > >
> > > > > > >
> > > > > > > To close all the open Windows use a loop through the array ...
> > > > > > > Int li_no
> > > //
> > > > > > Work
> > > > > > > Var
> > > > > > > li_no = UpperBound (go_wn) // How
> Many
> > > open
> > > > > so
> > > > > > > far?
> > > > > > > // Stop at 2nd last Window
> > > > > > > for i =li_no to 2 step -1
> //
> > > Loop
> > > > > > thru
> > > > > > > backwards (oldest 1st)
> > > > > > > If IsValid (go_wn[li_no]) = TRUE THEN
> > > > > > > Close ((go_wn[li_no])
> > > > > > > END IF
> > > > > > > next
> > > > > > >
> > > > > > > Hope that helps. You will have to change the way you open the
> Main
> > > > > window
> > > > > > > dialogs as well to do the same procedure. The process would be
> > much
> > > > > easier
> > > > > > > if you had only one MDI window with MDIChild (Sheets) attached
> as
> > > per
> > > > > the
> > > > > > > rules of MDI construction. But I was a maintenance programmer
as
> > > well.
> > > > > > >
> > > > > > > regards ... Chris Pollach
> > > > > > > Great White North Technical Evangelist
> > > > > > >
> > > > > > >
> > > > > > > "test" <@> wrote in message
> > > news:KIvyS3cVCHA.276@forums.sybase.com...
> > > > > > > > All windows opened are of type MDIHELP except the last
actual
> > one
> > > > > which
> > > > > > > is
> > > > > > > > type MAIN.
> > > > > > > >
> > > > > > > >
> > > > > > > > "Chris Pollach" <cpollach@ajja.com> wrote in message
> > > > > > > > news:I9Vn6gcVCHA.81@forums.sybase.com...
> > > > > > > > > Is this an MDI Frame based application?
> > > > > > > > >
> > > > > > > > > Regards .. Chris
> > > > > > > > >
> > > > > > > > > "test" <@> wrote in message
> > > > > news:HY1qTTcVCHA.258@forums.sybase.com...
> > > > > > > > > > Hello
> > > > > > > > > > I want to close all the windows, that are open, if the
> user
> > > > > clicks
> > > > > > > the
> > > > > > > > > main
> > > > > > > > > > menu EXIT.
> > > > > > > > > > Any suggestions welcome.
> > > > > > > > > > thanks
> > > > > > > > > >
> > > > > > > > > >
> > > > > > > > >
> > > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > > >
> > > > > >
> > > > > >
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >
> >
> >
>
>


"test" < Posted on 2002-09-10 14:08:49.0Z
Newsgroups: sybase.public.powerbuilder.objects
From: "test" <@>
Subject: Re: Close all open windows ina application
Date: Tue, 10 Sep 2002 10:08:49 -0400
Lines: 300
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.50.4522.1200
X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4522.1200
NNTP-Posting-Host: 206.137.103.110
Message-ID: <364_OW#ShVNWCHA.292@forums.sybase.com>
References: <364_HY1qTTcVCHA.258@forums.sybase.com> <364_I9Vn6gcVCHA.81@forums.sybase.com> <364_KIvyS3cVCHA.276@forums.sybase.com> <364_s#rkgDdVCHA.313@forums.sybase.com> <364_PMnTIedVCHA.74@forums.sybase.com> <364_wTFC8edVCHA.81@forums.sybase.com> <364_x1AlTjdVCHA.81@forums.sybase.com> <364_SmOhskdVCHA.276@forums.sybase.com> <364_GPbkzyAWCHA.288@forums.sybase.com> <364_nkZXiBBWCHA.300@forums.sybase.com>
Path: forums-1-dub!forums-1-dub!forums-master.sybase.com!forums.sybase.com
Xref: forums-1-dub sybase.public.powerbuilder.objects:942
Article PK: 713515

I found the mistakes.
FOR j = 1 to li_no
IF go_wn[j] = aw_window THEN (I had li_no instead of
j in both these lines)
li_limit = j
EXIT
END IF
NEXT


thanks !

"Arnoud Oortwijk" <aoortwijk@tangram.nl> wrote in message
news:Kdmzk5KWCHA.316@forums.sybase.com...
> Your comparision is valid as far as I can see. What do you mean 'it's not
> working'? Do you get an error? When you invoke the function do you pass on
> 'this'? Do you invoke the function in the closequery event of the window?
>
> Arnoud
>
>
>
> "test" <@> schreef in bericht news:YCAqL$CWCHA.161@forums.sybase.com...
> > f_CloseAllWindowsAfterOpenedAfterThisOne( WINDOW aw_window )
> > int li_no,li_limitlong i,j
> > li_no = UpperBound (go_wn) // How Many open so far?
> > IF li_no < 1 THEN return
> > FOR j = 1 to li_no
> > IF go_wn[li_no] = aw_window THEN (Is this how you'll match the
array
> > element & argument ?, its not working)
> > li_limit = li_no
> > EXIT
> > END IF
> > NEXT
> >
> > // Stop at 2nd last Window
> > for i =li_no to li_limit step -1 // Loop thru backwards (oldest 1st)
> > If IsValid (go_wn[i]) = TRUE THEN
> > Close (go_wn[i]) ( It should be go_wn[i] or go_wn[li_no] ?)
> > END IF
> > next
> >
> > I did put this go_wn[ Upperbound( go_wn[] ) + 1 ] = this in the open
> event.
> > works fine.
> > Thanks
> >
> >
> >
> >
> >
> >
> >
> >
> >
> > "Arnoud Oortwijk" <aoortwijk@tangram.nl> wrote in message
> > news:nkZXiBBWCHA.300@forums.sybase.com...
> > > try
> > > li_no = upperbound( go_wn ) + 1
> > > go_wn[li_no] = w_business_module
> > >
> > > I just asume w_business_module is a variable with a reference to the
> > window
> > > you've just opened?
> > >
> > >
> > > If I can make a suggestion, I would have the window register itselve
in
> > the
> > > open event of the window. Something like:
> > > go_wn[ Upperbound( go_wn[] ) + 1 ] = this
> > > This you can code in your ancestor object and won't have to code it in
> the
> > > menu for every window you open.
> > >
> > > To close all windows after the one opened. Create a global function
(or
> a
> > > function on the application manager object if you're using one )
> > > f_CloseAllWindowsAfterOpenedAfterThisOne( WINDOW aw_window ) RETURNS
> > INTEGER
> > > // first find the array element that matches the argument of the
> function
> > > // close all valid windows in the argument after the element you found
> > >
> > >
> > > HTH
> > >
> > > Arnoud
> > > Url: http://www.gloriant.be
> > >
> > >
> > >
> > > "test" <@> schreef in bericht
news:GPbkzyAWCHA.288@forums.sybase.com...
> > > > Sorry to bug you again Chris. I was trying to use the code. I put
the
> > > > following lines in the menu from where I am opening the window
> > > > li_no += UpperBound (go_wn)
> > > > go_wn[li_no] = w_business_module
> > > > I put the following for one menu all elements. But the app crashes
and
> > > says
> > > > 'Array boundary exceeded' .
> > > > Also created a function. When I close the second level window(MDI)
and
> > > call
> > > > the function I need to pass something to this function to tell to
> close
> > > only
> > > > windows till that level right ? How do I figure that out ?
> > > > Thanks in advance.
> > > > Int li_no
> > > > long i
> > > > li_no = UpperBound (go_wn) // How Many open so far?
> > > > // Stop at 2nd last Window
> > > > for i =li_no to 2 step -1 // Loop thru backwards (oldest 1st)
> > > > If IsValid (go_wn[li_no]) = TRUE THEN
> > > > Close (go_wn[li_no])
> > > > END IF
> > > > next
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > > "Chris Pollach" <cpollach@ajja.com> wrote in message
> > > > news:SmOhskdVCHA.276@forums.sybase.com...
> > > > > Suggestion: Have all menus call a global function that
processes
> > the
> > > > > global Window Arrary.
> > > > >
> > > > > "test" <@> wrote in message
news:x1AlTjdVCHA.81@forums.sybase.com...
> > > > > > Thanks. I'll try to use the code.
> > > > > > One more question ... I can put the loop code in the main menu
> exit
> > > and
> > > > > then
> > > > > > it'll close all the other windows.
> > > > > > But if the user clicks the exit of the second level window then
it
> > > > should
> > > > > > close the third window , so do I put some code there also ?
> > > > > > Thanks for the prompt responses.
> > > > > >
> > > > > >
> > > > > > "Chris Pollach" <cpollach@ajja.com> wrote in message
> > > > > > news:wTFC8edVCHA.81@forums.sybase.com...
> > > > > > > Tracks the addresses of all the open Windows!
> > > > > > >
> > > > > > > "test" <@> wrote in message
> > news:PMnTIedVCHA.74@forums.sybase.com...
> > > > > > > > go_wn[li_no] = Open (MDIWindow)
> > > > > > > > what will the above st do?
> > > > > > > >
> > > > > > > > "Chris Pollach" <cpollach@ajja.com> wrote in message
> > > > > > > > news:s#rkgDdVCHA.313@forums.sybase.com...
> > > > > > > > > If all Windows opened are of type MDI something you
just
> > > > > violated
> > > > > > on
> > > > > > > > of
> > > > > > > > > the 5 rules of MDI (or how not to screw up and MDI
> > > application) -
> > > > > > ouch!
> > > > > > > > > If that is the case, the only way to know what windows are
> > > opened
> > > > is
> > > > > > to
> > > > > > > > keep
> > > > > > > > > track of their addresses. You can use the following
approach
> > > > > > > > >
> > > > > > > > > Window go_wn[]
//
> > > Global
> > > > > > Array
> > > > > > > > of
> > > > > > > > > Pointers
> > > > > > > > >
> > > > > > > > > // Open Script
> > > > > > > > > Int li_no
> > > > > //
> > > > > > > > Work
> > > > > > > > > Var
> > > > > > > > > li_no += UpperBound (go_wn) // Get
> next
> > > > open
> > > > > > > slot?
> > > > > > > > > go_wn[li_no] = Open (MDIWindow) // Open the
> next
> > > and
> > > > > > track
> > > > > > > > it
> > > > > > > > >
> > > > > > > > >
> > > > > > > > > To close all the open Windows use a loop through the array
> ...
> > > > > > > > > Int li_no
> > > > > //
> > > > > > > > Work
> > > > > > > > > Var
> > > > > > > > > li_no = UpperBound (go_wn) //
How
> > > Many
> > > > > open
> > > > > > > so
> > > > > > > > > far?
> > > > > > > > > // Stop at 2nd last Window
> > > > > > > > > for i =li_no to 2 step -1
> > > //
> > > > > Loop
> > > > > > > > thru
> > > > > > > > > backwards (oldest 1st)
> > > > > > > > > If IsValid (go_wn[li_no]) = TRUE THEN
> > > > > > > > > Close ((go_wn[li_no])
> > > > > > > > > END IF
> > > > > > > > > next
> > > > > > > > >
> > > > > > > > > Hope that helps. You will have to change the way you open
> the
> > > Main
> > > > > > > window
> > > > > > > > > dialogs as well to do the same procedure. The process
would
> be
> > > > much
> > > > > > > easier
> > > > > > > > > if you had only one MDI window with MDIChild (Sheets)
> attached
> > > as
> > > > > per
> > > > > > > the
> > > > > > > > > rules of MDI construction. But I was a maintenance
> programmer
> > as
> > > > > well.
> > > > > > > > >
> > > > > > > > > regards ... Chris Pollach
> > > > > > > > > Great White North Technical Evangelist
> > > > > > > > >
> > > > > > > > >
> > > > > > > > > "test" <@> wrote in message
> > > > > news:KIvyS3cVCHA.276@forums.sybase.com...
> > > > > > > > > > All windows opened are of type MDIHELP except the last
> > actual
> > > > one
> > > > > > > which
> > > > > > > > > is
> > > > > > > > > > type MAIN.
> > > > > > > > > >
> > > > > > > > > >
> > > > > > > > > > "Chris Pollach" <cpollach@ajja.com> wrote in message
> > > > > > > > > > news:I9Vn6gcVCHA.81@forums.sybase.com...
> > > > > > > > > > > Is this an MDI Frame based application?
> > > > > > > > > > >
> > > > > > > > > > > Regards .. Chris
> > > > > > > > > > >
> > > > > > > > > > > "test" <@> wrote in message
> > > > > > > news:HY1qTTcVCHA.258@forums.sybase.com...
> > > > > > > > > > > > Hello
> > > > > > > > > > > > I want to close all the windows, that are open, if
> the
> > > user
> > > > > > > clicks
> > > > > > > > > the
> > > > > > > > > > > main
> > > > > > > > > > > > menu EXIT.
> > > > > > > > > > > > Any suggestions welcome.
> > > > > > > > > > > > thanks
> > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > > >
> > > > > > > > > >
> > > > > > > > >
> > > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > > >
> > > > > >
> > > > > >
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >
> >
> >
>
>