Unlike the Macintosh, the menu bar on Windows can appear in two
different
ways. For one of these two formats, it would initially appear that the
use
of the menu bar is somewhat limited. This tip will show you how to get
around this limitation.
When you compile a REALbasic project for Windows, you can choose
between two
Windows formats: Multiple Document Interface and Single Document
Interface.
An application compiled for Multiple Document Interface (MDI) has a
parent
window that contains the menu bar. This parent window is open and always
available until the user quits the application. An application compiled
for
Single Document Interface (SDI) however, has no parent window and only
displays the menu bar as part of the first window that opens. However,
many
applications such as Netscape Navigator and Microsoft Internet Explorer
on
Windows are SDI applications and yet each browser window that opens has
a
menu bar. How is this accomplished and how would you make your REALbasic
application work the same way?
Generally speaking, when an application like Microsoft Internet
Explorer for
Windows opens a second browser window, it is in fact, launching another
copy
of Microsoft Internet Explorer. For example, launch Internet Explorer
for
Windows. Next, choose New from the File menu and then choose Window
from the
New submenu. Another Internet Explorer window appears with its' own menu
bar. Now press Control-Alt-Delete and notice that there are two
Microsoft
Internet Explorer applications listed in the Close Program window.
It's easy to do the same thing in any REALbasic application. The sample
code
below gets a folderitem that represents the application and then
launches
it. On Windows, this creates a second running copy of the application
(where
"appname.exe" is the name of your compiled application):
dim f as folderItem
f = getfolderItem("appname.exe")
f.launch
If you want the new copy of the application to open a different window
or
open in a different state, you will need to write some data to a file
that
the second copy of the application can read when it's launched so it
will
know what state to open in.
Note:
Your compiled application will use SDI if the Multiple Document
Interface
checkbox in the Build Application dialog box is left unchecked.
--
Geoff Perlman
President & CEO
REAL Software, Inc.
http://www.realsoftware.com
mailto:geoff at realsoftware dot com
Phone: 512-263-1233 x711
Fax: 512-263-1441
- - - - - - - - - -
Got a useful tip to share? Send it to us at:
REALbasic-tips at lists dot realsoftware dot com dot
For list commands, send "Help" in the body of a message to
<requests at lists dot realsoftware dot com>
|