gettingstarted
[Top] [All Lists]

Re: Active window

To: Getting Started <gettingstarted at lists dot realsoftware dot com>
Subject: Re: Active window
From: Barrie Jones <barrie at spamcop dot net>
Date: Sat, 27 Nov 2004 13:49:36 -0500
Delivered-to: gettingstarted at lists dot realsoftware dot com
References: <BDCE3187 dot ABC6%larsjensen at rcn dot com>
Lars
Many thanks for the perfect solution. I have never used the window menu handlers before. Now I see how useful they are. Thanks for your guidance.
Barrie
On Nov 27, 2004, at 1:28 PM, Lars Jensen wrote:

In response to a menu "Print..." selection the program needs to know what to
print...

The conventional way to do this is: within each window that can be printed, add a menu handler for the Print menu item. (Make sure "AutoEnable" is set
for this menu item.)

Iterating throught the windows is also possible, but there are gotchas, such as dialogs or floating windows that you might not know about. It would look
something like this:

  dim i as integer
  for i = 0 to WindowCount-1

    if Window(i) isA Window1 then
      PrintMyWindow1 Window1(Window(i)) // cast to a Window1
      exit // stop looping

    elseif Window(1) isA Window2 then
      PrintMyWindow2 Window2(Window(i)) // cast to a Window2
      exit // stop looping

    ...

    end if

  next

Avoiding all this messiness is a good reason to go with the menu handler in
each window.

lj

_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://www.realsoftware.com/listarchives/lists.html>


_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://www.realsoftware.com/listarchives/lists.html>

<Prev in Thread] Current Thread [Next in Thread>