| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The Dynace Windows Development System (WDS) is a Dynace class library which enables a C programmer with no knowledge of C++, Dynace, the Windows API or message-driven architecture to write real Windows applications with an absolute minimum learning curve and number of lines of code. In fact, it is possible to become familiar enough with windows, menus, dialogs and controls using WDS to write a Windows application after just one day!
The programmer is able to write the application using familiar C in a familiar procedural fashion. Instead of taking the usual fifty plus lines of code necessary to implement a typical “Hello World” program, with WDS it takes four lines of code! Fully functional menus and dialogs can be implemented with WDS in a handful of lines instead of the hundreds it takes using the Windows API or other available tools.
WDS applications are portable across Win32 which is the Windows GUI API. It is also portable to Linux and Mac via the Wine system.
Dynace (pronounced dī-ne-sē), what WDS is based upon, stands for a “DYNAmic C language Extension”. It is an object oriented extension to the C or C++ languages. Dynace is written in the C language and designed to be as portable as possible. It solves many problems associated with C++ and adds features previously only available in languages such as CLOS or Smalltalk without their overhead. Dynace is fully documented in another manual.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The C language is the most popular and well known among the language choices available for the PC and Unix environments. Therefore, there are many more programmers who know and feel comfortable with the C language than any other. All the popular tools available for software development under Windows use the C++ language. C++ is a complex superset of the C language with questionable benefits. There is a significant learning curve associated with going from proficient C ability to C++.
Although the currently available tools for Windows development, which work in association with C++, provide a very high degree of flexibility and power, they are tremendously complex to learn and use effectively. Given the tremendous complexity of both the Windows development tools currently available on the market and the fact that these tools are all based on C++, the time necessary for a normal C programmer to become knowledgeable and proficient in Windows development, including both C++ and the Windows tools, is an absolute minimum of six months. This time may vary to a period exceeding a year.
The currently available tools require an enormous amount of code (lines of program text) in order to achieve the most fundamental functionality. Although the current tools actually generate most of this code, the bottom line is that any real life application will end up having an enormous amount of code. There is a clear relationship between lines of code and a) how maintainable a program is for finding bugs or making enhancements, and b) how difficult it is for new programmers to get up to speed with respect to the new tools and application. Given the cost of software development and the tremendous backlog, this issue is of paramount importance.
The focus of WDS is to enable a normal C programmer to learn and be able to write and understand a fundamental Windows program in one day. Given just a little more time with WDS (in terms of days), the programmer will be able to write and understand real Windows applications in a minimum amount of time and with a very minimum amount of code. There’s no need to learn a new language, such as C++. The programmer may use his existing knowledge in C and just needs to learn a very high level and simple to understand set of tools. Instead of taking hundreds of lines of code to add a new dialog, as required by the existing tools, WDS can accomplish the same task in half a dozen lines. Instead of taking up to one hundred lines of code just to bring up the main application window, WDS just requires four lines!
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
There are three main benefits to using WDS over the other available options. The first is that the learning curve associated with Dynace for Windows allows a programmer or programming team to get up-to-speed with respect to Windows programming in an absolute minimum amount of time. The difference in time is days instead of six months or more. This directly translates into saved dollars and increases the success of projects.
The second main benefit is that since application features may be implemented in tens of lines of program code, instead of the hundreds or thousands of lines required by existing tools, applications may be developed in a drastically reduced time frame.
The third main benefit is that since WDS is so easy to learn and requires so few lines of code for application development, applications developed with WDS are much easier to debug, maintain and enhance. Programmer turnover is much less a problem due to the fact that new programmers can get up-to-speed in a minimum amount of time.
With WDS there is never a need for a code generator or wizard since so few lines are needed to create the application. All your code is application specific.
In short, WDS is an invaluable tool for Windows application development during the learning, development, and maintenance phases of application development. WDS is also portable to Linux and Mac via the Wine package.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The following complete example illustrates how easy it is to get started with WDS. Implementing this exact functionality using the Windows API would take more then fifty lines of code!
#include "generics.h" int start() { object win; win = vNew(MainWindow, "My Test Application"); vPrintf(win, "Hello, World!\n"); return gProcessMessages(win); } |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
This section enumerates some of the key features of The Dynace Windows Development System (WDS).
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The following lists several reasons to use the Dynace Windows Development System:
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The diskette(s) distributed with Dynace are standard DOS formatted diskette(s). The files on the diskette(s) have been compressed in order to reduce the quantity of diskettes.
See the file README
, located on the first disk, for
installation instructions.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Once the system has been installed there will exist a series of
directories under the dynace
directory. The system will contain
the following directories:
This is the root of the Dynace system.
This is the location of all the Dynace libraries. You may wish to add this directory to the list of paths your linker searches.
This is the location of the include files necessary to compile Dynace applications. You may need to add this directory to the path your compiler uses to search include files.
Executable files necessary for development with the Dynace system. This directory should be added to your normal search path for executable programs.
Example programs used to learn & demonstrate the Dynace object oriented extension to C.
Example programs used to learn & demonstrate WDS.
Misc. documentation files.
The Dynace and WDS manuals.
Complete source to the Dynace kernel.
Source to all of the Dynace base classes.
Complete source to the multi-threader, pipes and semaphores.
Files necessary to build the system generics files from scratch.
Complete source to the dpp
utility.
Complete source to the Dynace WDS library.
Complete source to the utility programs.
The only files that are absolutely necessary for a developer are those
located in the \DYNACE\LIB, \DYNACE\INCLUDE
and \DYNACE\BIN
directories and \DYNACE\UTILS\STARTUP.MK
.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
This manual contains a description of the WDS concepts, a detailed description of the WDS system and complete reference to all WDS classes. It is designed for a programmer who is proficient in the C language, but has little or no knowledge of Windows programming or Dynace.
In addition to this manual, the accompanying example programs will be needed in order to learn how to use the system. The example programs included with WDS provide a step-by-step tutorial to getting started.
A proficient C programmer with a pre-existing compiler environment should be able to install this package and feel comfortable enough with the system to write a simple Windows application in one day.
The best approach to learning WDS would be to start by reading chapters 1 (Introduction) and 2 (Concepts). Then refer to chapter 3 (Mechanics) while working through the WDS example programs.
If you wish to dive right in and get a feel for the system you may perform the setup procedure described in chapter 3 and then go directly to the example programs.
While working through the examples you may refer to the index (located in the back of the manual) to locate information on all WDS functions.
Although it is not necessary, you may also learn and incorporate the many powerful object oriented features of the Dynace object oriented extension to C, which is what this library is based on. Dynace is fully documented in a separate manual.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The WDS system includes a series of examples which serve both as a Quick
Start and a Tutorial. Theses examples are located under the
\DYNACE\WINEXAM
directory. The examples located under the
\DYNACE\EXAMPLES
directory are strictly for the Dynace object
oriented extension to C and are not needed to use WDS.
Each example is contained in its entirety in an independent directory. This is done in order to illustrate the exact files and steps necessary to create a single application.
The example programs are contained in sub-directories under the WINEXAM directory and are named EXAMnn (where the nn is a two digit number). These numbers are significant in that they describe the correct order that the examples should be followed. Each example depends on knowledge built up in previous examples and is not repeated.
Each example contains a readme file which describes information relating to the purpose of the example and build instructions. These files should be read first. Each example also includes makefiles which are associated with the compiler vendor being used. Full source is included.
Each example program contains source (.c) files. There is also a mirror
of each source file with a .txt
file extension. These text files
contain duplicates of the source file with extensive documentation in
the form of comments. These files should be viewed in order to
understand the code in the application.
Complete setup and build instructions are contained in Chapter 3.
The example programs are tutorial in nature and should be considered the main source of information used to get started. The manual augments the examples with introductory material, concepts and a complete reference.
The following is a list of the enclosed examples:
Illustrates the steps necessary to compile and link a bare bones Windows application.
Illustrates the use of menus and message boxes.
Illustrates the minimum steps necessary for the creation of a modal dialog.
Illustrates the addition of text controls to a dialog.
Illustrates the addition of numeric and date controls to a dialog.
Illustrates the addition of push button controls to a dialog.
Illustrates the addition of radio buttons and check boxes to a dialog.
Illustrates the addition of a combo box and list box to a dialog.
Illustrates the addition of a scroll bar to a dialog.
Illustrates a modal dialog with all control types initialized and used.
Illustrates the process of printing to the default printer.
Illustrates the process of printing to a user selected and configured printer.
Illustrates various methods of outputting text to the printer and changing pages.
Illustrates printer output utilizing different fonts.
Illustrates printer graphics output, output scaling, brushes and pens.
Illustrates the use of modeless dialogs.
Illustrates the use of a modeless dialog which isn’t associated with a parent window.
Illustrates the use of the context sensitive help system.
Illustrates the creation of Dynace classes in conjunction with a WDS application.
See the file \DYNACE\WINEXAM\LIST
for the most up-to-date list
of example programs.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
This manual serves as both a user manual and a complete reference manual to the WDS system. The Dynace object oriented extension to C is documented in a separate manual.
Chapter 1 (Introduction) covers background material needed to orient a new user.
Chapter 2 (Concepts) covers fundamental concepts associated with the Windows environment. It does this without introducing very much syntax or other mechanics.
Chapter 3 (Mechanics) documents the exact procedures necessary to setup and use the WDS system. The example programs should be viewed subsequent to setting the system up.
Chapter 4 (Class Reference) provides a detailed reference to all classes and methods associated with the class library included with the WDS system.
The index (located in the back) provides a complete alphabetical listing of all classes, methods, and macros described in chapter 4.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
We will respond to all questions or comments submitted by registered
users (see REGISTER.DOC
). We will also notify all registered
users of bug fixes and enhancements via e–mail.
In addition, it is our hope to hold a public forum concerning Dynace on the internet news group comp.lang.misc. If traffic becomes significant we’d also like to create a comp.lang.dynace news group.
<EMAIL_ADDRESS>| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Copyright © 1996 Blake McBride All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
 IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The Dynace Object Oriented Extension to C, Windows Development System and their associated documentation were written by Blake McBride (blake@mcbridemail.com).
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The Windows environment has its own lexicon and way of doing things. This chapter is designed to explain that lexicon and give the programmer a certain comfort level with respect to elements of Windows programming.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Windows are the rectangular region on your screen where a user interacts with the application. There are many things which may be done with a window. Typically, a user may move, resize or change a window into an icon. Actually, dialogs and controls (discussed further down) are actually little windows located inside bigger windows. Therefore, it is also possible for a user to interact in a very of ways with a specific window.
There are many attributes which may be associated with a window. Each window may have a system menu associated with it, a title bar, a minimize/maximize buttons, various colors, sizes, positions, and border types.
There are three main window types: main, child and popup.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
There is normally exactly one main window associated with any given application. This is the first window which comes up when an application starts up, the one which acts as the fulcrum for all the facilities of the application, and the one which contains the main menu associated with the application. This is also the window which has the application icon associated with it. This is so when the application is iconized the appropriate icon will displayed.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
In addition to the main window, there are child windows. A child window is a rectangular region or window which is directly associated with some other (parent) window. Child windows are always restricted to being located inside its parent window. It can’t be moved outside its parent. Also, when a parent window gets iconized (minimized into an icon), its child windows follow suit. When a parent window gets moved across the screen, the child windows will follow such that their relative position in their parent remains constant. When a child window is created it is positioned relative to its parent.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
In addition to child windows, the system also supports popup windows. A popup window is a rectangular region which acts, to a greater or lesser extent, independently of any other window. A popup window may exist outside of any other window and be moved or resized independent of any other window. Popup windows may or may not have a parent. If a parent window is associated with a popup and the parent gets iconized, the popup will follow suit. If no parent is associated with a popup it can be iconized independent of any other window. Since popup windows are independent of other windows, they are created with positions which are relative to the entire screen.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Menus are the words or labels which typically appear at the top of the main window associated with an application. The user is able to select various application functions by selecting the appropriate menu option. Each menu option may also present the user with additional menu options down to a number of levels.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Once a user selects a particular application function through the application menu, an applications principal method of providing the user with information, or obtaining information from, is through dialogs. A dialog is a rectangular region (or more precisely, a window) which contains various display information and input fields (controls).
There are two fundamental dialog types: model and modeless.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
A modal dialog is one which must be completed or canceled prior to accessing any other part of a given application. If the user is presented with a modal dialog and attempts to activate another window within the same application, the system will just beep. This dialog type, however, does not restrict the user from accessing other applications.
Modal dialogs are used most often because the complexity of an application would grow tremendously if the user were allowed to be in multiple parts of the same application at the same time.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Modeless dialogs allow the user to switch from one part of a particular application to another without completing or canceling the modeless dialog. The user may switch to another part of an application, obtain additional information, and then return to any portion of the modeless dialog to complete it. The user may even iconize the dialog for another time.
Modeless dialogs are more complex and less frequently used than modal dialogs.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Controls are the primary method of obtaining information from the user. They are the input fields, push buttons, selection boxes, scroll bars, etc. Although Windows supports a group of standard controls, there is an endless number of possible types of controls. WDS supports all standard Windows controls in addition to providing several additional ones and enhancements to the standard ones.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Text controls are used to obtain textual information in the form of character strings. WDS provides a variety of enhancements to the standard Windows text controls.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Numeric controls are a WDS supplied control used to obtain numeric data from the user.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Date controls are a WDS supplied control used to obtain date information from the user.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Push buttons are Windows supplied, WDS enhanced, controls which allow the user to evoke an immediate action function. For example, the common “OK” and “CANCEL” buttons are push buttons. The user clicks on the button and some action gets evoked.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Check boxes are Windows supplied, WDS enhanced, controls which allow the user to select among non-exclusive yes/no, on/off type options.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Radio buttons are Windows supplied, WDS enhanced, controls which allow the user to select one option among a group of mutually exclusive options.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
List boxes allow the user to select items from a list of options. The list may be fully displayed, scrollable or drop down in nature.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Combo boxes are a combination of the text control and the list box. With combo boxes, a user my select among a list of options or type in a new item.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Scroll bars allow the user to visually select a position within some application specific range via the mouse.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Windows provides a powerful help system which enables the user to obtain interactive application specific help information via a “Help” menu option or within a specific context via the “F1” key. WDS supports and makes it easy to use all capabilities of the Windows help system.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Cursors are the visual elements which indicate where a users input focus is or where he wishes it to be. Cursors can also be used to indicate something about the input mode or system status (for example the hour glass is used to indicate that the system is busy). Common cursors are the underscore, the arrow, the ibeam, and the hour glass.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
System cursors are common cursors which are predefined by the system. These include most of the cursors most applications would need (such as the underscore, the arrow, the ibeam, and the hour glass) and are easy to select and use.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
External cursors are cursors which are application specific and created by the programmer. These cursors may look like virtually anything.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Icons are those little picture boxes which are left when an application is minimized. It is normally something the user can identify the application with in order to reactive it.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
System icons are those generic icons which are predefined by Windows. These system defined icons are easy to select and use, but are of a bit less value since they have little to do with any specific application.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
External icons are application specific and programmer created icons. They must be designed by the programmer prior to use, but are very flexible, easy to design, and help the user identify the application.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Fonts are the types (such as Helvetica or times) and size (i.e. 10pt) of the characters which appear within an application. There are literally thousands to choose from. Fortunately, however, the system defaults are often sufficient.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The system fonts are those fonts which the user has configured his system to use on a global basis. Use of these fonts makes an application have a familiar look and feel when compared to the rest of the apps on the users machine.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
External fonts are programmer selectable fonts and may be any of the many fonts available to the Windows system.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Brushes specify the color and pattern which appears in a window background, in text and graphics.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
System brushes are those colors which were selected by the user as global to their Windows environment. The programmer may select, for example, the color the user chose for background windows. The new brush will then have colors the same colors that the user is used to seeing in other applications on their system. System brushes are used most often.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Stock brushes allow the programmer to select from a number of common, Windows defined, brushes.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Solid brushes are arbitrary color solid brushes which may be selected by the programmer.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Hatch brushes enable the programmer to select from any color and any of a number of Windows defined hatch patterns.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Pens are used, principally in graphics, for drawing lines or providing the outline of a figure. The attributes associated with a pen includes color of the line, width of the line, and its style. Common styles include solid, dashed, doted, etc.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Stock pens allows a programmer to select among a few, common, Windows defined pens.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Using a custom pen allows the programmer to specify the exact attributes associated with a particular pen.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Windows provides a few common dialogs in order to obtain frequently needed information in a uniform format. Use of these dialogs when appropriate eases the programming normally associated with dialog creation and provides the user with a familiar interface.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The color dialog provides a convenient method of requesting detailed color selection information from the user.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The font dialog provides a convenient method of requesting detailed font selection information from the user.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The file dialog provides a convenient method of allowing the user to view and select files.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The print dialog provides a convenient method of selecting and configuring the printer.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
WDS provides many convenient and easy to use methods of selecting and configuring printers as well creating reports with a variety of fonts and graphics.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Windows programs may use application specific icons, dialogs, menus and cursors. These items are referred to as resources. Each resource has a name and may be accessed by the application program. Resources are created with a graphically oriented tool called a resource editor.
Once the needed resources are created, the resource editor saves them to a file called the resource file. The contents of the resource file are then compiled into a binary form using a resource compiler. Finally, the compiled resource file is combined with the executable file at link time.
Resource editors and compilers are included and documented along with your C compiler package. The resource editor associated with Microsoft’s Visual C++ is called App Studio. WATCOM calls theirs the WATCOM Resource Editor and Borland calls theirs Resource Workshop.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Normally, when a program is linked, all of the library code which is accessed gets copied to the executable being created. Therefore, when the program is run, all the necessary routines are readily available in the executable file. This is called static linking.
When using DLLs, at link time the linker copies very small stub functions instead of the real routines into the executable file. These stub functions, when called by the application code, automatically access the real routines at run time which exist in external DLL files. This is called dynamic linking because it happens dynamically at run time.
The actual code which uses statically or dynamically linked routines is exactly the same. In other words, the process of writing code doesn’t change. The only difference is the link commands used and the fact that dynamic linking requires that the DLLs be available at run time.
There are three advantages to using DLLs. The first is that if you have several apps which use the same library routines, you can save disk space by only requiring one copy of the routines on disk (in the DLL instead of a copy in each executable file).
The second is that since Windows knows that both apps are sharing the exact same code (because they use the same DLL), if the user activates both apps, Windows only needs to load one copy of the routines in memory and share the same code for both apps. This saves memory space.
The third advantage of using DLLs is that if you have several apps which use the same routine, and a bug is discovered in that routine, only the DLL needs to be updated. None of the apps will have to be re-linked. The next time any of the apps are run, it will load the new, and repaired, routine.
There are also a couple of drawbacks associated with the use of DLLs. First, instead of just using an executable file (as is the case with statically linked executables) you must make sure to install the appropriate DLLs. This complicates the installation process.
The second, and more troublesome, problem associated with DLLs has to do with versions. Lets say you have some app which uses some common DLL. Everything is compiled and linked and runs well. Several months go by and you start working on a new project. While developing the new app you decide to use some routine in your common DLL which used by the first app. While using the routine located in the DLL you discover a bug or anomaly in the routine, you therefore decide to correct it. Now the second app works fine. A month later you try to use the first app again and it now has all sorts of bugs! How could this happen? It always worked before and you haven’t changed it.
What happened is that the first app depended on a particular anomaly associated with the original version of the routine located in the DLL. When the anomaly was corrected, it mysteriously broke the first app. This scenario is more common and troublesome than it may appear!
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Microsoft has two independent but similar models in which an application may run. Each model has an associated application program interface (API) or library which it links with and uses in order to interface with the OS. The two APIs are called Win16 and Win32.
Win16 is a 16 bit interface designed to run on Windows 3.1. All common Windows 3.1 apps are created using this API. This API has the advantage of being portable to the most environments. Although it will only support 16 bit applications, these apps will run on Windows 3.1, Windows ’95 and Windows NT.
Win32 on the other hand is a full featured 32 bit API. The syntax of
this API is very similar but not exactly the same as Win16. The main
differences have to do with the fact that in a 32 bit environment
int
’s are 32 bits instead of 16. Win32 and Win16 are similar
enough, however, that with a little planning, it is not difficult to
create apps which are compile time portable between Win16 and Win32.
Windows NT is the primary host for Win32 applications, however,
these 32 bit applications may run on 16 bit Windows 3.1 as follows.
In order to bridge the gulf between Win16 and Win32 and allow 32 bit applications to run under Windows 3.1, Microsoft created Win32s. Win32s is a large subset of Win32 which supports the same syntax as Win32, supports 32 bit apps, and will run on Windows 3.1 and NT. In order to run on 16 bit Windows 3.1 it is necessary to install some 32 bit extensions to Windows 3.1. These extensions come with the C compiler packages and are freely redistributable. Win32s apps will run in true 32 bit mode under Windows 3.1 or Windows NT using the same executable.
It is important to note that there is no difference between creating a Win32 or Win32s application. Both use the same compiler, compiler flags, linker, linker flags and libraries. The exact same executable is built. There is no way to specifically tell the system which type of application you wish. The only difference between the two is which specific APIs your application calls.
If your application only calls those APIs which are common to Win32 and Win32s then your application will run as a Win32 application under NT and a Win32s under Windows 3.1. However, if your application makes any API calls which are specific to Win32 then those calls will not work under Windows 3.1.
WDS supports Win16 and Win32. In addition, WDS only uses those APIs which are available under Win32s, therefore, WDS applications will run fine under Win32s.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Most character based applications are pretty simple in the sense that they (in one form or another) basically get a key, perform some processing, get the next key, perform some more processing, etc. In a graphical environment (such as Windows) this model doesn’t work. At any point (like in the middle of entering data in a field) the user may decide to move or resize a window and the application has to be able to handle a myriad of possible input requests (messages) at any point. In order to accommodate this fact, Windows programming uses a different programming model called Message Driven Architecture (MDA).
MDA is tremendously more complex and requires much more code to handle than the old get-key model. The main benefit of the Dynace Windows Development System is that WDS encapsulates and hides most of the aspects of MDA. With WDS you can code in a simple, familiar way and produce full featured Windows applications.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
This chapter, in concert with the WDS examples, describes the tools and
actual steps necessary to create WDS application programs. The best
method of learning is to go through the example programs located under
the \DYNACE\WINEXAM
directory in the order in which they appear.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
There are two principal modes of building WDS applications. You can either use the Integrated Development Environment (IDE) which comes with your compiler or you can use the included DMAKE command line make utility along with the other command line facilities of your compiler.
Use of the IDE is recommended since it provides a convenient environment for editing, building, debugging and executing your application. However, the DMAKE method is required both for building the WDS libraries from scratch (if you have the source edition) or to build WDS applications which contain new Dynace classes. This is required because the build procedure necessary for Dynace classes is too complex for the IDEs.
Note, however, that creating new Dynace classes is not required in order to build full featured WDS applications.
In addition, only the DMAKE mode is supported when initially building the Dynace and WDS systems from scratch.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Prior to building any of the examples using the IDE, a few configuration options within the IDE need to be set.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Configure the correct directories for include files and libraries. This can be done via the tools / options / directories menu item.
Configure the IDE such that it will look under the
\DYNACE\INCLUDE
directory (in addition to whatever is already
set) for include files.
Additionally, configure the IDE such that it
will look under the \DYNACE\LIB
directory (in addition to
whatever is already set) for library files.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Configure the correct directories for include files and libraries.
Since the Borland IDE associates these directories directly with
each project, this information will have to be adjusted separately
for each of the two .IDE
files which come with Dynace.
These files are under the \DYNACE\WINEXAM\SETUP
directory
and are called WIN16.IDE
and WIN32.IDE
.
This can be done via the options / project / directories menu item
after loading one of the IDE
files. You must then save the
change by using the project / close project menu option. Repeat this
procedure for both IDE
files.
Configure the IDE such that it will look under the
\DYNACE\INCLUDE
directory (in addition to whatever is already
set) for include files.
Additionally, configure the IDE such that it will look under the
\DYNACE\LIB
directory (in addition to whatever is already set)
for library files.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Symantec compiler versions 7.2 and prior do not work due to bugs in their compiler. A patched 7.2 compiler did work but was a little flaky. Version 7.21 seemed to work fine but was not extensively tested.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
This section lists environment variables which must be set if the DMAKE build mode is used. If the IDE build mode is used see the IDE Build Setup section for setup details.
The \DYANCE\BIN
directory should be part of the search path used
by your system for executable programs (the PATH
environment
variable).
The following environment variables should be set as follows (modify as appropriate):
set MAKESTARTUP=c:\dynace\utils\startup.mk set TMPDIR=c:\tmp set DOS4G=quiet set DOS16M=:4M |
The DOS4G
and DOS16M
environment variables are only necessary
when running the 32 bit DOS version of dpp.exe
which has been
compiled with the WATCOM compiler. Win32 or other versions of dpp
do not require these variables.
Although not required by the example programs, Microsoft users may find
it convenient to add \DYNACE\INCLUDE
and \DYNACE\LIB
to
your compiler’s include and library search paths respectively.
Borland users will need to adjust the BORLAND_HOME
path setting
in the B16.DM
and B32.DM
makefiles located in the
\DYNACE\WINEXAM\SETUP
and Dynace source code directories. In
addition, the Borland resource compiler requires that the INCLUDE
environment variable be set to where the Borland include files are
located, for example:
set INCLUDE=d:\bc45\include |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The procedure used to build Dynace & WDS from scratch is fully described
in
\DYNACE\DOCS\BUILD.txt
. See that file for build
instructions.
New users will want to read all the files in the docs
directory.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
All examples are buildable under all supported environments and build procedures, including IDE or DMAKE builds, as well as 16 bit Windows or 32 bit Win32 (NT, Win32s, Windows 95). The only difference is the build procedures or associated makefiles.
In order to avoid having all supported build procedures cluttering up
the example directories, the example directories are shipped
without any build procedures installed. All the build procedures
are located in the \DYNACE\WINEXAM\SETUP
directory along
with batch files used to install the specific build procedures you
need.
The following table lists the commands available in order to configure
the example programs. Note that each command must be executed from the
\DYNACE\WINEXAM\SETUP
directory unless otherwise indicated.
There is no harm in configuring the examples for more than one
configuration at the same time.
IDE build with Microsoft Visual C 16 bit
DMAKE build with Microsoft Visual C 16 bit
IDE build with Microsoft Visual C 32 bit
DMAKE build with Microsoft Visual C 32 bit
IDE build with Borland C 16 bit
DMAKE build with Borland C 16 bit
IDE build with Borland C 32 bit
DMAKE build with Borland C 32 bit
IDE build with Symantec C 32 bit
DMAKE build with Symantec C 32 bit
Used to delete all files produced by builds in all examples
Used to delete all files produced by builds and all build configuration files (basically to go back to an as-shipped state)
Used to delete all files produced by a build for a single example (execute from the particular example’s directory)
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
This section documents the files which are contained in each example program.
This file describes the object of the example. It should be read first.
This file is the complete source code to the example program.
This is a fully commented version of MAIN.C. It describes all aspects of the current example which are unique.
This is the resource script describing the resources used by the application. It is created and edited via the indigenous resource editor.
This is another file created by the resource editor. It is used by the application code to associate resources defined in MAIN.RC to macro names.
An icon picturing the Algorithms Corporation logo.
Link definition file. Only needed for Windows 3.1 applications.
In addition to the above, the following build/system specific make or project files are used.
Project file for Microsoft Visual C 16 bit
DMAKE makefile for Microsoft Visual C 16 bit
Project file for Microsoft Visual C 32 bit
DMAKE makefile for Microsoft Visual C 32 bit
Project file for Borland C 16 bit
DMAKE makefile for Borland C 16 bit
Project file for Borland C 32 bit
DMAKE makefile for Borland C 32 bit
Project files for Symantec C 32 bit (requires version 7.21 or later)
DMAKE makefile for Symantec C 32 bit (requires version 7.21 or later)
Once an application is built, the only file needed to run it is
MAIN.EXE
.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
In order to build an example with an IDE, simply open the appropriate project file and select build.
In order to build with the DMAKE command line utility execute the following command.
dmake -f MAKEFILE.DM |
where MAKEFILE.DM
is one of the DMAKE makefiles listed above.
Alternatively, you can use the following command to create a debug version of the example:
dmake -f MAKEFILE.DM DEBUG=1 |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Due to the fact that the WDS is the first thing which Windows sees when it executes an application and the fact that WDS is not shipped with debugging information, the following procedure will make it easier to debug your application code.
First compile your application with debugging information. Then when you wish to debug the application, set a break point at “start”. You can then debug your application by telling the debugger to run to the first break point. You will then see the initial function of your application and may debug as usual from that point.
If, however, you purchased the WDS source code, you may compile it with full debugging information and debug through the WDS code as well as your application specific code.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The best method of building your own application would be to start with one of the example programs and proceed from there. This way all the compiler, linker and other options will be preset.
If you plan to create your own Dynace classes along with your WDS application, it would be best for you to start with the WDS example which illustrates the creation of a Dynace class along with the WDS application. This example has the appropriate make file logic to handle custom classes along with a WDS application.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
DMAKE is a very powerful, portable and enhanced make utility developed
by Dennis Vadura. It is freely distributable and not owned by
Algorithms Corporation or Blake McBride. Complete documentation for this utility
is contained in \DYNACE\DOCS\DMAKE.MAN
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
DPP
is the pre-processor used by Dynace to convert class definition
files into C source files. It is also used to generate generic files
and perform generic/method argument checking. This utility is only needed
when creating new classes and is only used by more advanced WDS users
who wish to create their own Dynace classes.
This utility is fully documented in the Dynace language manual.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
This chapter gives a detailed description of each WDS class. It is organized by facility so that in order to look something up, you would first go to the section which deals with the facility you are interested in. And then the functions are in alphabetical order.
There is a naming convention used with Dynace generics. All generics start with either a lower case “g”, “v” or “m”, and are always followed by an upper case letter. The ones which start with “g” are normal generics and may be treated like normal C functions. The ones which begin with “v” use the variable argument facilities of C and you should, therefore, take a bit extra care when using them since there is no compile time argument checking being done with these functions.
Since all generics start with either “g”, “v” or “m” and in order to avoid the difficulty associated with grouping all the generics under three letters, the first letter is dropped for indexing or heading purposes. Therefore if you are looking up a generic, it will always appear in the index or header with its first letter missing. The syntax description and example code, however, will show the entire name.
There is one thing about Dynace which you must be aware of, however. Dynace generic functions (which is what most of these functions are) allow the same function to be called in many circumstances. These generic functions dynamically dispatch to the appropriate procedures based on the type of the first argument to the generic function (or “generic” for short). So even though you are calling the same function name, entirely different functionality may occur based on the type of the first argument. This fact is seldom, if ever, a problem since you know whether you are dealing with an icon or a dialog, for example, at any given point. Just be sure to look up the generic in the appropriate section.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
In an effort to hide unnecessary details associated with class vs. instance methods from WDS users who don’t care about the differences, these differences are not discussed or grouped as they are in the Dynace manual. You can always distinguish between the two by what the method takes as its first argument. If it’s a class, then you have a class method, otherwise it’s an instance method.
If you are a WDS user with interest in the Dynace object oriented extension to C, it is fully documented in its associated manual.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
This Dynace Windows Development System contains the following class hierarchy:
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The Application
class is the class used to control application
wide defaults such as fonts, cursors, brushes and so on. It is also
the class which gets executed by Windows first and executes your
application specific start
function.
There are no instance methods associated with the Application
class.
All access to this class is through class methods via the global class
object Application
.
cl = gCmdLine(Application); char *cl; /* command line */ |
This method is used to gain access to command line which was used when the application was launched.
Example: int cl; cl = gCmdLine(Application); |
See also: Instance, Show, PrevInstance
gError(obj, msg); object obj; /* any object */ char *msg; /* error message */ |
This method is used in a severe error condition to issue an error message to the user and terminate the application. This method should be avoided if possible.
Note that this method is actually associated with the Dynace Object
class which is why the first argument may be any Dynace object.
Example: gError(Application, "Error message"); |
See also: QuitApplication
bo = gGetBackBrush(Application); object bo; /* brush object */ |
This method is used to obtain a copy of the default background brush
object associated with the application. The returned object will be an
instance of one of the subclasses of the Brush
class.
The object returned must, either explicitly or implicitly, be disposed when it is no longer needed. This is normally done automatically by WDS when it is associated with a window.
See the Brush
class and its subclasses for further details.
Example: object bo; bo = gGetBackBrush(Application); |
See also: GetTextBrush, SetBackBrush
co = gGetCursor(Application); object co; /* cursor object */ |
This method is used to obtain a copy of the default cursor object
associated with the application. The returned object will be an
instance of one of the subclasses of the Cursor
class.
The object returned must, either explicitly or implicitly, be disposed when it is no longer needed. This is normally done automatically by WDS when it is associated with a window.
See the Cursor
class and its subclasses for further details.
Example: object co; co = gGetCursor(Application); |
See also: SetCursor
fo = gGetFont(Application); object fo; /* font object */ |
This method is used to obtain a copy of the default font object
associated with the application. The returned object will be an
instance of one of the subclasses of the Font
class.
The object returned must, either explicitly or implicitly, be disposed when it is no longer needed. This is normally done automatically by WDS when it is associated with a window.
See the Font
class and its subclasses for further details.
Example: object fo; fo = gGetFont(Application); |
See also: SetFont
io = gGetIcon(Application); object io; /* icon object */ |
This method is used to obtain a copy of the default icon object
associated with the application. The returned object will be an
instance of one of the subclasses of the Icon
class.
The object returned must, either explicitly or implicitly, be disposed when it is no longer needed. This is normally done automatically by WDS when it is associated with a window.
See the Icon
class and its subclasses for further details.
Example: object io; io = gGetIcon(Application); |
See also: SetIcon
nm = gGetName(Application); char *nm; /* application name */ |
This method is used to obtain the global name associated with the application.
Example: char *nm; nm = gGetName(Application); |
See also: SetName
bo = gGetTextBrush(Application); object bo; /* brush object */ |
This method is used to obtain a copy of the default text brush object
associated with the application. The returned object will be an
instance of one of the subclasses of the Brush
class.
The object returned must, either explicitly or implicitly, be disposed when it is no longer needed. This is normally done automatically by WDS when it is associated with a window.
See the Brush
class and its subclasses for further details.
Example: object bo; bo = gGetTextBrush(Application); |
See also: GetBackBrush, SetTextBrush
m = gGetScalingMode(Application); int m; /* scaling mode */ |
This method is used to get the current scaling mode in affect.
See SetScalingMode
for further details.
Example: int mode; mode = gGetScalingMode(Application); |
See also: SetScalingMode, ScaleToPixels, ScaleToCurrentMode
r = gGetSize(Application, vert, horz); int *vert; /* vertical size */ int *horz; /* horizontal size */ object r; /* Application */ |
This method is used to get the total size of the user’s screen.
vert
and horz
are in increments dictated by the
mode selected by SetScalingMode
.
Example: int y, x; gGetSize(Application, &y, &x); |
See also: SetScalingMode, GetSize::Window
ins = gInstance(Application); HINSTANCE ins; /* instance handle */ |
This method is used to gain access to the Windows instance handle associated with the application. This handle is mainly used internally by Windows and WDS, and should not normally be needed by a WDS programmer.
Example: HINSTANCE h; h = gInstance(Application); |
See also: PrevInstance, CmdLine, Show
ins = gPrevInstance(Application); HINSTANCE ins; /* instance handle */ |
This method is used to gain access to the Windows instance handle associated with the previous instance of this application, should more than one be running. This handle is mainly used internally by Windows and WDS, and should not normally be needed by a WDS programmer.
This value will always be NULL
under Windows NT.
Example: HINSTANCE h; h = gPrevInstance(Application); |
See also: Instance, CmdLine, Show
r = gQuitApplication(Application, ret); int ret; /* app return value */ object r; /* Application */ |
This method is used to terminate an application. The value passed will be used as the return value of the application.
Example: gQuitApplication(Application, 0); |
See also: Error
r = gScaleToCurrentMode(Application, y, x, fnt); int *y; /* row position */ int *x; /* column position */ object fnt; /* current font object */ object r; /* Application */ |
This method is used to convert coordinates from pixels to the current scaling mode. It is mainly used internally by WDS in order to convert Window’s standard pixel positions into the current scaling mode.
On entry x
and y
point to values which are coordinates in
terms of pixels. After this method returns, their value will be changed
to be in terms of the current scaling mode (see SetScalingMode
).
fnt
is a font object which is used only if the current scaling
mode is relative to a font. If so, the font it will be related to
will be the one passed.
Example: int y, x; object fnt; y = some position; x = some position; fnt = some font object; gScaleToCurrentMode(Application, &y, &x, fnt); |
See also: SetScalingMode, GetScalingMode, ScaleToPixels
r = gScaleToPixels(Application, y, x, fnt); int *y; /* row position */ int *x; /* column position */ object fnt; /* current font object */ object r; /* Application */ |
This method is used to convert coordinates from the current scaling mode to pixels. It is mainly used internally by WDS in order to convert your coordinates into standard pixel positions.
On entry x
and y
point to values which are coordinates
in terms of the current scaling mode (see SetScalingMode
).
After this method returns, their value will be changed to be in terms
of pixels.
fnt
is a font object which is used only if the current scaling
mode is relative to a font. If so, the font it will be related to
will be the one passed.
Example: int y, x; object fnt; y = some position; x = some position; fnt = some font object; gScaleToPixels(Application, &y, &x, fnt); |
See also: SetScalingMode, GetScalingMode, ScaleToCurrentMode
r = gSetBackBrush(Application, bo); object bo; /* brush object */ object r; /* brush object passed */ |
This method is used to set the application wide default background
brush. This is the brush used to color everything except the text that
appears on windows and dialogs. bo
must be an instance of one of
the subclasses of Brush
. All windows and dialogs will use the
application wide default brush which is in effect when they are created
unless a specific brush object is specified for a particular window.
When a new default brush object is set, any previous default object
will be disposed. If no default is set, WDS uses the system brush
identified as COLOR_WINDOW
.
See the Brush
class and its subclasses for further details.
Example: gSetBackBrush(Application, vNew(SystemBrush, COLOR_WINDOW)); |
See also: GetBackBrush, SetTextBrush
r = gSetCursor(Application, co); object co; /* cursor object */ object r; /* cursor object passed */ |
This method is used to set the application wide default cursor.
co
must be an instance of one of the subclasses of Cursor
.
All windows will use the application wide default cursor which is in
effect when they are created unless a specific cursor object is
specified for a particular window.
When a new default cursor object is set, any previous default object
will be disposed. If no default is set, WDS uses the system cursor
identified as IDC_ARROW
.
See the Cursor
class and its subclasses for further details.
Example: gSetCursor(Application, gLoadSys(SystemCursor, IDC_ARROW)); |
See also: GetCursor, LoadSys::SystemCursor, Load::ExternalCursor
r = gSetFont(Application, fo); object fo; /* font object */ object r; /* font object passed */ |
This method is used to set the application wide default font.
fo
must be an instance of one of the subclasses of Font
.
All windows will use the application wide default font which is in
effect when they are created unless a specific font object is
specified for a particular window.
When a new default font object is set, any previous default object
will be disposed. If no default is set, WDS uses the system font
identified as SYSTEM_FONT
.
See the Font
class and its subclasses for further details.
Example: gSetFont(Application, vNew(SystemFont, SYSTEM_FONT)); |
See also: GetFont, Load::SystemFont, New::ExternalFont
r = gSetIcon(Application, io); object io; /* icon object */ object r; /* icon object passed */ |
This method is used to set the application wide default icon. An icon
associated to a window is the one which is displayed when the window is
iconized. io
must be an instance of one of the subclasses of
Icon
. All windows will use the application wide default icon
which is in effect when they are created unless a specific icon object
is specified for a particular window.
When a new default icon object is set, any previous default object
will be disposed. If no default is set, WDS uses the system icon
identified as IDI_APPLICATION
.
See the Icon
class and its subclasses for further details.
Example: gSetIcon(Application, gLoadSys(SystemIcon, IDI_APPLICATION)); |
See also: GetIcon, LoadSys::SystemIcon, Load::ExternalIcon
gSetName(Application, nm); char *nm; /* application name */ |
This method is used to give the application a globally accessible name.
This name is accessible via GetName
. There is no other use
made of this information.
Example: gSetName(Application, "My App"); |
See also: GetName
r = gSetScalingMode(Application, m); int m; /* scaling mode */ int r; /* previous mode */ |
This method is used to set the scaling mode used by all other WDS methods which take coordinate positions. Valid modes are as follows:
SM_1_PER_CHAR
This mode causes each position to be in increments determined by the size of the current font. For example row 7 would mean 7 times the height of the current font. Similar to line positions.
SM_10_PER_SYSCHAR
This mode causes each position to be in increments determined by one tenth the size of the system font declared globally to the user’s Windows environment. For example row 70 would mean 7 times the height of the Windows global system font. This allows positioning relative to a scaling factor determined by the user.
SM_PIXELS
This mode performs no conversion. The application is able to use pixel coordinated directly.
The default value is SM_1_PER_CHAR
.
The value returned is the mode which was previously set.
Example: gSetScalingMode(Application, SM_PIXELS); |
See also: GetScalingMode, ScaleToPixels, ScaleToCurrentMode
r = gSetTextBrush(Application, bo); object bo; /* brush object */ object r; /* brush object passed */ |
This method is used to set the application wide default text brush.
This is the brush used by all text output (or foreground) to windows or
dialogs. bo
must be an instance of one of the subclasses of
Brush
. All windows and dialogs will use the application wide
default brush which is in effect when they are created unless a specific
brush object is specified for a particular window.
When a new default brush object is set, any previous default object
will be disposed. If no default is set, WDS uses the system brush
identified as COLOR_WINDOWTEXT
.
See the Brush
class and its subclasses for further details.
Example: gSetTextBrush(Application, vNew(SystemBrush, COLOR_WINDOWTEXT)); |
See also: GetTextBrush, SetBackBrush
sv = gShow(Application); int sv; /* show value */ |
This method is used to gain access to the show value supplied by Windows
when an application starts. It is normally used to determine how an
initial application’s main window should be shown. The available
options are Windows macros which begin with SW_
and are fully
documented by the Windows documentation under the WinMain
function.
Example: int sv; sv = gShow(Application); |
See also: Instance, CmdLine, PrevInstance
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
This section documents the Window
class which contains all the
functionality which is common to Main, Child, and Popup windows. See
chapter 2 of this manual for a description of the different window
types.
r = gAddHandlerAfter(wind, msg, func); object wind; /* a window object */ unsigned msg; /* message */ long (*func)(); /* function pointer */ object r; /* the window obj */ |
This method is used to associate function func
with Windows window
message msg
for window wind
. Whenever window wind
receives message msg
, func
will be called.
wind
is the window object who’s messages you wish to process.
msg
is the particular message you wish to trap. These messages
are fully documented in the Windows documentation in the Messages
section. They normally begin with WM_
.
func
is the function which gets called whenever the specified
message gets received and takes the following form:
long func(object wind, HWND hwnd, UINT mMsg, WPARAM wParam, LPARAM lParam) { . . . return 0L; /* or whatever is appropriate */ } |
Where wind
is the window being sent the message. The remaining
arguments and return value is fully documented in the Windows documentation
under the WindowProc
function and the Windows Messages documentation.
WDS keeps a list of functions associated with each message associated
with each window. When a particular message is received the appropriate
list of handler functions gets executed sequentially.
AddHandlerAfter
appends the new function to the end of this list,
and AddHandlerBefore
adds the new function to the beginning of
the list.
WDS may also, and optionally, execute the Windows default procedure
associated with a given message either before or after the user added
list of functions. This behavior may be controlled via
DefaultProcessingMode
.
Windows will only see the return value of the last message handler executed including, if applicable, the default.
Example: int hSize, vSize; static long process_wm_size(object wind, HWND hwnd, UINT mMsg, WPARAM wParam, LPARAM lParam) { hSize = LOWORD(lParam); vSize = HIWORD(lParam); return 0L; } . . gAddHandlerAfter(wind, (unsigned) WM_SIZE, process_wm_size); . . |
See also: DefaultProcessingMode, AddHandlerBefore
r = gAddHandlerBefore(wind, msg, func); object wind; /* a window object */ unsigned msg; /* message */ long (*func)(); /* function pointer */ object r; /* the window obj */ |
This function is fully documented under AddHandlerAfter
.
See also: AddHandlerAfter
r = mAssociate(wind, itm, fun); object wind; /* a window object */ int itm; /* menu item */ long (*fun)(); /* function */ object r; /* the menu */ |
This method is used to associate an application specific function
(fun
) with a menu item (itm
) associated with the current
menu attached to window wind
. Once this is done, if the user selects
the menu option identified by itm
, then the function fun
will be executed.
itm
is a programmer defined macro which identifies one particular
choice among those available within the menu which is currently attached
to window wind
. This macro is defined while the programmer defines
the entire menu using the resource editor.
fun
is the function which will be executed when the user selects
menu option itm
and has the following form:
long fun(object wind, unsigned id) { . . . return 0L; } |
The function executed (fun
) is passed the window object and
the specific menu id which the user selected and
returns a long. The return value is documented in the Windows documentation
under the message named WM_COMMAND
. It should normally be 0L
.
Example: static long file_message(object wind) { gMessage(wind, "File_Message"); return 0L; } . . mLoadMenu(win, IDR_MENU1); mAssociate(win, ID_FILE_MESSAGE, file_message); |
See also: LoadMenu, MenuItemMode
r = gAutoDispose(wind, mode); object wind; /* a window object */ int mode; /* auto dispose mode */ int r; /* previous value */ |
This method is used to enable or disable the auto dispose mechanism
associated with a window. This feature, when enabled, causes WDS to
automatically dispose of the WDS object associated with a window
whenever the user closes the window (wind
). Normally, when
this feature is disabled, if the user closes a window, WDS removes
the window from the display, but the WDS object remains intact until
the program manually disposes of the window object (via Dispose
).
This feature is most commonly used with asynchronous, popup windows.
Note that it is invalid to attempt to use a WDS object subsequent to it being disposed, and each unneeded WDS object must be deleted.
mode
is set to 1
to enable the feature and 0
to disable it. The value returned is the prior mode.
Example: gAutoDispose(wind, 1); |
See also: Dispose
r = gAutoShow(wind, mode); object wind; /* a window object */ int mode; /* auto show mode */ int r; /* previous value */ |
This method is used to enable or disable the auto show mechanism
associated with a window. This feature, when enabled, causes WDS to
automatically display (execute Show
) on a window which is written
to. This enables the programmer to create a window which will automatically
popup the first time the program displays text to it.
mode
is set to 1
to enable the feature and 0
to disable it. The value returned is the prior mode.
Example: gAutoShow(wind, 1); |
See also: Show
r = gBackBrush(wind, brsh); object wind; /* a window object */ object brsh; /* brush object */ object r; /* wind */ |
This method is used to determine what brush object is used for the
background of window wind
and performs the same function as the
Use
method when used with a Brush
object. Any previously
associated brush object will be disposed. This brush object will also
be automatically disposed when the window is disposed.
The window passed is returned.
Example: object myWind; gBackBrush(myWind, vNew(SolidBrush, 0, 0, 255)); |
See also: TextBrush, Use, SetTextBrush::Application
and the Brush
classes
r = gDefaultProcessingMode(wind, msg, mode); object wind; /* a window object */ unsigned msg; /* message */ int mode; /* default processing mode */ object r; /* the window obj */ |
This method is used to determine when or if the Windows default message
procedure is processed for a given message (msg
) associated with
a particular window (wind
).
WDS allows a programmer to specify an arbitrary number of functions
to be executed whenever a window receives a specific message (via
AddHandlerAfter
and AddHandlerBefore
). Windows has
default procedures associated with many window messages. At times
it is necessary to replace or augment this default functionality.
DefaultProcessingMode
gives the programmer control over when and
if this default Windows functionality. mode
is used to specify
the desired mode. The following table indicates the valid modes:
0
Do not execute the Windows default processing
1
Execute default processing after programmer defined handlers
2
Execute default processing before programmer defined handlers
Note that the default mode is always 1
, and must be explicitly
changed, if desired, for each message associated with each window.
msg
is the particular message you wish to affect. These messages
are fully documented in the Windows documentation in the Messages
section. They normally begin with WM_
.
Example: gDefaultProcessingMode(wind, (unsigned) WM_SIZE, 0); |
See also: AddHandlerAfter
r = gDispose(wind); object wind; /* a window object */ object r; /* NULL */ |
This method is used to remove and dispose of a window object when it is no longer needed. This method should be called on all windows when they are no longer needed.
The value returned is always NULL
and may be used to null out
the variable which contained the object being disposed in order to
avoid future accidental use.
Example: object myWind; myWind = gDispose(myWind); |
See also: AutoDispose, New::ChildWindow, New::PopupWindow
r = gErase(wind, brow, erow, bcol, ecol); object wind; /* a window object */ int brow; /* beginning row */ int erow; /* ending row */ int bcol; /* beginning column */ int ecol; /* ending column */ object r; /* the window object */ |
This method is used to delete all text vectors which intersect the
rectangle defined by the parameters. These parameters are adjusted
according to the current scaling mode (set with
SetScalingMode::Application
. All coordinates are measured from
the upper left hand corner of the window and start with 0,0
.
The object returned is the window object passed.
Example: gErase(win, 3, 10, 0, 200); |
See also: EraseLines, EraseAll
r = gEraseAll(wind); object wind; /* a window object */ object r; /* the window object */ |
This method is used to erase all text lines associated with a window.
The object returned is the window object passed.
Example: gEraseAll(win); |
See also: EraseLines, Erase
r = gEraseLines(wind, blin, elin); object wind; /* a window object */ int blin; /* beginning line */ int elin; /* ending line */ object r; /* the window object */ |
This method is used to delete all text lines from a starting line number
(blin
) to an ending line number (elin
). All lines are
measured from the upper left hand corner of the window and start with
0,0
. Lines positions are calculated based on the current font.
The object returned is the window object passed.
Example: gEraseLines(win, 3, 10); |
See also: Erase, EraseAll
ch = gGetch(wind); object wind; /* a window object */ int ch; /* character read */ |
This method is used to obtain the next input character struck by the
user. The SetBlock
method may be used to determine whether or not
Getch
waits if a character is not available. The value returned
is the character struck by the user or 0 if no character was available
and the input was non-blocking.
Example: object myWind; int ch; ch = gGetch(myWind); |
See also: Kbhit, SetBlock, Gets
r = gGetName(w); object w; /* a window object */ char *r; /* the name associated with the window */ |
This method is used to get the name associated with window w
.
The name associated with a window is what is displayed at the top of the
window, if it has a title bar.
Example: object myWind; char *n; myWind = vNew(MainWindow, "App Name"); n = gGetName(myWind); /* n = "App Name" */ |
See also: New::MainWindow, SetName
prnt = gGetParent(wind); object wind; /* child window object */ object prnt; /* parent window object */ |
This method is used to obtain the parent window object associated
with window wind
.
Example: object myWind, parentWind; parentWind = gGetParent(myWind); |
See also: SetParent, New::ChildWindow
r = gGetPosition(wind, vert, horz); object wind; /* a window object */ int *vert; /* vertical position */ int *horz; /* horizontal position */ object r; /* wind arg passed */ |
This method is used to get the current position of a window.
vert
and horz
are in increments dictated by the
mode selected by SetScalingMode::Application
. The window
object passed is returned.
Example: int y, x; gGetPosition(myWind, &y, &x); |
See also: SetScalingMode::Application, GetSize, SetPosition
r = gGets(wind, buf, len); object wind; /* a window object */ char *buf; /* input buffer */ unsigned len; /* length of buffer */ char *r; /* buf */ |
This method is used to read (accept) a single line of text from a user
until a return is hit or len
-1 key strokes have been entered
and place them in buf
.
This method returns a pointer to the buffer passed unless there is an
error, in which case NULL
is returned.
The input accepted will a return terminated line entered by the user
up to len
-1 characters. However, the number of characters
may be less if non-blocking
io is selected (via SetBlock
) and there aren’t enough characters
available. SetRaw
may also be used to control whether backspace
processing will be performed.
Example: object myWind; char buf[80]; gGets(myWind, buf, sizeof(buf)); |
See also: SetBlock, SetRaw, Gets, Getch
r = gGetSize(wind, vert, horz); object wind; /* a window object */ int *vert; /* vertical size */ int *horz; /* horizontal size */ object r; /* wind arg passed */ |
This method is used to get the current size of a window.
vert
and horz
are in increments dictated by the
mode selected by SetScalingMode::Application
. The window
object passed is returned.
Example: int y, x; gGetSize(myWind, &y, &x); |
See also: SetScalingMode::Application, GetPosition, SetSize,
GetSize::Application
r = gGetTag(wind); object wind; /* a window object */ object r; /* tag */ |
This method is used to obtain a Dynace object which has been associated
with a window via SetTag
. The value return is the object which has
been associated with the window object wind
. If there is no object
associated with the window, NULL
will be returned.
Example: object myWind, someObj; someObj = gGetTag(myWind); |
See also: SetTag, SetTag::Dialog
h = gHandle(wind); object wind; /* window object */ HANDLE h; /* Windows handle */ |
This method is used to obtain the Windows internal handle associated with
a window object. Note that this will be 0
prior to executing
Show
on the window because that is the point where Windows creates
the handle.
Note that this method may be used with most WDS objects in order to obtain the internal handle that Windows normally associates with each type of object. See the appropriate documentation.
Example: object myWind; HANDLE h; h = gHandle(myWind); |
r = gKbhit(wind); object wind; /* a window object */ int r; /* characters ready */ |
This method is used to determine if and how many characters are waiting in the character input queue. This method is used in an attempt to provide a familiar character based user input mechanism.
The value returned is the number of characters ready for input or zero if none are available.
Example: object myWind; int n; n = gKbhit(myWind); |
See also: Getch, SetBlock, Gets
r = mLoadCursor(wind, csr); object wind; /* a window object */ unsigned csr; /* cursor identifier */ object r; /* cursor object */ |
This method is used to load a programmer defined cursor and associate it
with window wind
. The cursor would then be displayed any time
the pointer was placed in the window.
csr
is a programmer defined unsigned integer which identifies
the cursor. This identifier is normally a macro and defined through the
resource editor. The cursor object will be automatically destroyed
whenever the window is destroyed or if a new cursor is loaded.
The value returned is an object representing the cursor loaded, or
NULL
if the cursor was not found.
Example: object myWind; mLoadCursor(myWind, MY_CURSOR); |
See also: LoadSystemCursor, Load::ExternalCursor, Use
r = gLoadFont(wind, fname, sz); object wind; /* a window object */ char *fname; /* font name */ int sz; /* point size */ object r; /* font object */ |
This method is used to load an arbitrary font by name at any point size
and associate it as the default font for future text output to window
wind
. fname
is the full name of the font as it appears
when you list the available fonts via the control-panel / fonts Windows
utility, minus the font type in parentheses. sz
indicates the
desired point size.
All font objects associated with a window will be automatically destroyed whenever the window is destroyed.
The value returned is an object representing the font loaded, or
NULL
if the font was not found.
Note that fname
may also be a Dynace object cast as a (char *
).
Example: object myWind; gLoadFont(myWind, "Times New Roman", 12); |
See also: LoadSystemFont, Indirect::ExternalFont, Use
r = mLoadIcon(wind, icn); object wind; /* a window object */ unsigned icn; /* icon identifier */ object r; /* icon object */ |
This method is used to load a programmer defined icon and associate it
with window wind
. The icon would then be displayed if window
wind
was iconized.
icn
is a programmer defined unsigned integer which identifies
the icon. This identifier is normally a macro and defined through the
resource editor. The icon object will be automatically destroyed
whenever the window is destroyed or if a new icon is loaded.
The value returned is an object representing the icon loaded, or
NULL
if the icon was not found.
Example: object myWind; mLoadIcon(myWind, ALGOCORP_ICON); |
See also: LoadSystemIcon, Load::ExternalIcon, Use
r = mLoadMenu(wind, mnu); object wind; /* a window object */ unsigned mnu; /* menu identifier */ object r; /* menu object */ |
This method is used to load a programmer defined menu and associate it
with window wind
. The menu would be displayed at the top
of the window.
mnu
is a programmer defined unsigned integer which identifies the
menu. This identifier is normally a macro and defined through the
resource editor. Any menu previously associated with the window is
pushed on a stack so that previous menus may be easily returned to in a
last-in-first-out basis using the PopMenu
method. All menus
associated with a window will be destroyed when the window is destroyed.
The value returned is an object representing the menu loaded, or
NULL
if the menu was not found.
Example: object myWind; mLoadMenu(myWind, MY_MENU); |
See also: Associate, PopMenu, LoadMenuStr, Load::ExternalMenu, Use
r = gLoadMenuStr(wind, mnu); object wind; /* a window object */ char *mnu; /* menu identifier */ object r; /* menu object */ |
This method is used to load a programmer defined menu and associate it
with window wind
. The menu would be displayed at the top
of the window.
mnu
is a programmer defined name which identifies the menu. This
name is defined through the resource editor. Any menu previously associated
with the window is pushed on a stack so that previous menus may be easily
returned to in a last-in-first-out basis using the PopMenu
method.
All menus associated with a window will be destroyed when the window
is destroyed.
Note that the LoadMenu
method is used more frequently since the
resource editors assign macros to each menu name.
The value returned is an object representing the menu loaded, or
NULL
if the menu was not found.
Example: object myWind; gLoadMenuStr(myWind, "mymenu"); |
See also: Associate, LoadMenu, LoadStr::ExternalMenu, Use
r = gLoadSystemCursor(wind, csr); object wind; /* a window object */ LPCSTR csr; /* cursor identifier */ object r; /* cursor object */ |
This method is used to load a Windows predefined cursor and associate it
with window wind
. The cursor would then be displayed if the pointer
was positioned over the window.
csr
is a Windows defined macro which identifies the cursor. The
available options are defined in the Windows documentation under the
function named LoadCursor
and normally begin with IDC_
. The
cursor object will be automatically destroyed whenever the window is
destroyed or if a new cursor is loaded.
The value returned is an object representing the cursor loaded, or
NULL
if the cursor was not found.
Example: object myWind; gLoadSystemCursor(myWind, IDC_CROSS); |
See also: LoadCursor, LoadSys::SystemCursor, Use
r = gLoadSystemFont(wind, fnt); object wind; /* a window object */ unsigned fnt; /* font identifier */ object r; /* font object */ |
This method is used to load a Windows predefined font and associate it
with window wind
. The last font associated with a window is the
one which will be used when any text is output to the window.
fnt
is a Windows defined macro which identifies the font. The
available options are defined in the Windows documentation under the
function named GetStockObject
and normally end with _FONT
.
The font object will be automatically destroyed whenever the window is
destroyed.
The value returned is an object representing the font, or
NULL
if the font was not found.
Example: object myWind; gLoadSystemFont(myWind, SYSTEM_FONT); |
See also: LoadFont, Load::SystemFont, Use
r = gLoadSystemIcon(wind, icn); object wind; /* a window object */ LPCSTR icn; /* icon identifier */ object r; /* icon object */ |
This method is used to load a Windows predefined icon and associate it
with window wind
. The icon would then be displayed if window
wind
was iconized.
icn
is a Windows defined macro which identifies the icon. The
available options are defined in the Windows documentation under the
function named LoadIcon
and normally begin with IDI_
. The
icon object will be automatically destroyed whenever the window is
destroyed or if a new icon is loaded.
The value returned is an object representing the icon loaded, or
NULL
if the icon was not found.
Example: object myWind; gLoadSystemIcon(myWind, IDI_APPLICATION); |
See also: LoadIcon, LoadSys::SystemIcon, Use
r = mMenuItemMode(wind, itm, mod); object wind; /* a window object */ unsigned itm; /* menu item */ unsigned mod; /* menu item mode */ object r; /* the menu */ |
This method is used to set the mode associated with a particular item
in the menu which is currently attached to window wind
.
itm
is a programmer defined macro which identifies one particular
choice among those available within the menu which is currently attached
to window wind
. This macro is defined while the programmer defines
the entire menu using the resource editor.
mod
may be one of MF_DISABLED
, MF_ENABLED
or
MF_GRAYED
and is documented in the Windows documentation under
the function EnableMenuItem
.
The menu object associated with the window is returned.
Example: mMenuItemMode(win, ID_FILE_MESSAGE, MF_GRAYED); |
See also: LoadMenu, Associate
r = gMessage(wind, msg); object wind; /* window object */ char *msg; /* message */ object r; /* window object */ |
This method is used to open up a temporary informational window. The
window will contain the message given by msg
and the user must
acknowledge the window prior to continuing by hitting an OK button.
The value returned is the window passed.
Example: object myWind; gMessage(myWind, "Press OK to continue."); |
See also: MessageWithTopic
r = gMessageWithTopic(wind, msg, tpc); object wind; /* window object */ char *msg; /* message */ char *tpc; /* help topic */ object r; /* window object */ |
This method is used to open up a temporary informational window. The
window will contain the message given by msg
and the user must
acknowledge the window prior to continuing by hitting an OK button.
If the user hits the F1
key while presented with the message,
the help topic identified by tpc
will get displayed via the Windows
help system.
The value returned is the window passed.
Example: object myWind; gMessageWithTopic(myWind, "Press OK to continue.", "mytopic"); |
See also: Message
and the HelpSystem
class.
r = vNew(Window); object r; /* new window */ |
This class method is used to create a basic window object. It is used
by all the subclasses of Window
and would not normally be
used by a programmer.
The value returned is the new window created.
Example: object myWind; myWind = vNew(Window); |
See also: New::MainWindow, New::ChildWindow, New::PopupWindow, Show
Dispose
r = gNewBuiltIn(Window, class, parent); char *class; /* Windows built in class designation */ object parent; /* parent window object */ object r; /* new child window */ |
This class method is used to create a child window which is used as a
Windows-built-in control. Window
represents the Window
class and is typed in as shown. class
is a string representing
one of the window classes build into Windows. This string is defined
and documented by Windows under the function named CreateWindow
.
parent
represents the parent window object and must be specified.
The value returned is the new child window (control) created.
Example: object myWind, ctl; myWind = vNew(MainWindow, "App Name"); ctl = gNewBuiltIn(Window, "button", myWind); |
See also: New::ButtonWindow
r = gPopMenu(wind); object wind; /* a window object */ object r; /* menu object */ |
This method is used to remove and destroy the current menu associated
with window wind
and restore the previous menu associated with
the window. A last-in-first-out list of menus associated with a window
may be established via the LoadMenu
, LoadMenuStr
or
Use
methods.
All function associations and modes previously associated with the new menu will be restored.
The object returned is the new menu object.
Example: object myWind; gPopMenu(myWind); |
See also: LoadMenu, Use
r = vPrintf(wind, fmt, ...); object wind; /* a window object */ char *fmt; /* format string */ int r; /* length of output */ |
This method is used to display a string of text (str
) in a sequential
fashion on window wind
. It is analogous to the standard C library
function fprintf
. All of the standard features of your C library
fprintf
function are supported and that documentation should be
consulted for full documentation on the arguments.
This method is used to support the standard streams interface, is
actually defined by the Stream
class, and is documented here for
convenience.
Note that this method begins with “v” since it takes variable arguments. The length of the resulting output will be returned.
Example: object myWind; int age = 32; vPrintf(myWind, "My age =- %d\n", age); |
See also: TextOut, Puts, Write
r = gPuts(wind, str); object wind; /* a window object */ char *str; /* string to be output */ int r; /* length of str */ |
This method is used to display a string of text (str
) in a sequential
fashion on window wind
. This method is used to support the standard
streams interface, is actually defined by the Stream
class, and
is documented here for convenience.
str
is the text to be displayed. Text str
will be
displayed on window wind
and its length will be returned.
Example: object myWind; gPuts(myWind, "Hello World\n"); |
See also: TextOut, Printf, Write
r = gRead(wind, buf, len); object wind; /* a window object */ char *buf; /* input buffer */ unsigned len; /* length of buffer */ int r; /* bytes read */ |
This method is used to read (accept) len
key strokes from the user
and place them in buf
.
Since the Window
class is a subclass of Stream
, this
method is mainly provided to support the standard interface dictated by
the Stream
class.
This method returns the number of characters actually accepted. It will
not be more than len
, but may be less if non-blocking io is selected
(via SetBlock
) and there aren’t enough characters available.
SetRaw
may also be used to control whether backspace processing will
be performed.
Example: object myWind; char buf[80]; gRead(myWind, buf, sizeof(buf)-1); |
See also: SetBlock, SetRaw, Gets, Getch
r = gScrollHorz(wind, cols); object wind; /* a window object */ int cols; /* columns to scroll */ object r; /* the window object */ |
This method is used to perform a horizontal scrolling of the text in
window wind
. This has the same effect as if the user caused
horizontal scrolling via the horizontal scroll bar at the bottom
of the window. No text is lost, a different portion of the text is
displayed.
wind
is the window which is to be affected, and cols
is the
number of columns to scroll. If cols
is positive the scroll moves
the text to the left, and negative moves the text to the right.
The scaling factor associated with cols
is set by
SetScalingMode::Application
.
Example: object myWind; gScrollHorz(myWind, 2); |
See also: ScrollVert, SetScalingMode::Application
r = gScrollVert(wind, rows); object wind; /* a window object */ int rows; /* rows to scroll */ object r; /* the window object */ |
This method is used to perform a vertical scrolling of the text in
window wind
. This has the same effect as if the user caused
vertical scrolling via the vertical scroll bar at the right side
of the window. No text is lost, a different portion of the text is
displayed.
wind
is the window which is to be affected, and rows
is the
number of rows to scroll. If rows
is positive the scroll moves
the text up, and negative moves the text down.
The scaling factor associated with rows
is set by
SetScalingMode::Application
.
Example: object myWind; gScrollVert(myWind, 2); |
See also: ScrollHorz, VertShift, SetScalingMode::Application
r = gSetBlock(wind, flag); object wind; /* a window object */ int flag; /* enable/disable flag */ int r; /* previous flag */ |
This method is used to set the blocking mode associated with keyboard
IO. It only has effect on Read
, Gets
, and Getch
.
If flag is 1, blocking is enabled, and 0 disables blocking. When a
new window is created it defaults to blocking enabled.
If blocking is turned on and a keyboard entry is requested (via
Read
, Gets
or Getch
), the keyboard entry function
will not return until the request can be satisfied. If, however,
blocking is disabled, a keyboard request is made, and insufficient
characters are available, then the input function will return immediately
with a return value indicating the result was short.
The value returned by this method is the previous blocking mode.
Example: object myWind; gSetBlock(myWind, 0); |
See also: Getch, SetRaw, Gets
r = gSetMaxLines(wind, rows); object wind; /* a window object */ int rows; /* max rows */ int r; /* previous max rows */ |
This method is used to set or obtain the maximum number of lines of text
which may be associated to a window. This includes all lines associated
with a window, including lines not being displayed because they are
scrolled off the screen. Whenever rows
number of lines are
exceeded, WDS automatically and permanently removes the lines at the
logical top of the internal buffer in order to make room for new
lines.
WDS keeps a buffer which holds a programmer definable number of lines of
text. The user is then able to scroll through this text. If the
application attempts to display more lines than this maximum (via
vPrintf
for example) the system will automatically call
gVertShift
in order to eliminate the top line and make room for
the new line being appended.
wind
is the window which is to be affected, and rows
is the
maximum number of rows to retain. If rows
is zero or negative,
the value associated with the window will not be changed. This is used
to obtain the current value without changing it.
The value returned is the previous value associated with the window.
Example: object myWind; gSetMaxLines(myWind, 60); |
See also: VertShift
r = gSetName(wind, name); object wind; /* a window object */ char *name; /* the new name */ object r; /* w arg passed */ |
This method is used to set the name associated with window wind
.
The name associated with a window is what is displayed at the top of the
window, if it has a title bar. name
may also be an object
typecast to a (char *
). The value returned is the window
(wind
) object passed.
Example: object myWind; myWind = vNew(MainWindow, "Old Name"); gSetName(myWind, "New Name"); |
See also: New::MainWindow, GetName
r = gSetParent(wind, prnt); object wind; /* child window object */ object prnt; /* parent window object */ object r; /* wind */ |
This method is used to create a child / parent window relationship. This relationship is automatically established when a child window is created. However, this method is provided for increased flexibility.
Whenever the parent window is disposed, WDS will automatically dispose
of all its children windows. This relationship should normally be
established prior to the child window being Shown
.
The value returned is the child window passed.
Example: object myWind, parentWind; gSetParent(myWind, parentWind); |
See also: GetParent
r = gSetPosition(wind, vert, horz); object wind; /* a window object */ int vert; /* vertical position */ int horz; /* horizontal position */ object r; /* wind arg passed */ |
This method is used to set the initial position of a window.
vert
and horz
are in increments dictated by the
mode selected by SetScalingMode::Application
. The window
object passed is returned.
If this function is not called, Windows will automatically set it to a reasonable default.
Example: object myWind; myWind = vNew(MainWindow, "App Name"); gSetPosition(myWind, 3, 10); |
See also: SetScalingMode::Application, SetSize, GetPosition
r = gSetRaw(wind, flag); object wind; /* a window object */ int flag; /* enable/disable flag */ int r; /* previous flag */ |
This method is used to set the raw mode associated with keyboard
IO. It only has effect on Read
, Gets
, and Getch
.
If flag is 1, raw mode is enabled, and 0 disables raw mode. The
default is raw mode disabled.
Normally, with raw mode disabled, when a user enters keyboard data, they are able to correct mistakes by using the backspace and reentering the correct data. The resulting data the program receives is the final, corrected input.
When raw mode is enabled, every key the user hits gets returned. This includes backspaces. Therefore, with raw mode enabled, if the user types “ABD” followed by backspace and then “C”, the program will receive all five characters hit. However, with raw mode disabled, the program would only receive the resulting string, “ABC”.
The value returned by this method is the previous raw mode.
Example: object myWind; gSetRaw(myWind, 1); |
See also: Getch, SetBlock, Gets
r = gSetSize(wind, vert, horz); object wind; /* a window object */ int vert; /* vertical size */ int horz; /* horizontal size */ object r; /* wind arg passed */ |
This method is used to set the initial size of a window.
vert
and horz
are in increments dictated by the
mode selected by SetScalingMode::Application
. The window
object passed is returned.
If this function is not called, Windows will automatically set it to a reasonable default.
Example: object myWind; myWind = vNew(MainWindow, "App Name"); gSetSize(myWind, 10, 40); |
See also: SetScalingMode::Application, SetPosition, GetSize
r = gSetStyle(wind, sty); object wind; /* a window object */ DWORD sty; /* the window style to use */ object r; /* returns wind */ |
This method is used to set the window style associated with window
wind
to style sty
. The DWORD
data type and valid
styles are defined by Windows and fully documented by the Windows
documentation. See the Windows documentation for the function called
CreateWindow
. The style types normally begin with WS_
and would be or’ed together to form the selected style.
Note that WDS automatically assigns reasonable defaults to a window
style when it is created.
Example: object myWind; myWind = vNew(MainWindow, "App Name"); gSetStyle(myWind, WS_OVERLAPPEDWINDOW | WS_VSCROLL | WS_HSCROLL); |
r = gSetTag(wind, tag); object wind; /* a window object */ object tag; /* tag */ object r; /* previous tag */ |
This method is used to associated an arbitrary Dynace object with a
window object. This may later be retrieved via the GetTag
method.
Since WDS passes around the window object to all Window
methods
this mechanism may be used to pass additional information with the
window. And since Dynace treats all objects in a uniform manner, this
information attached to the window may be arbitrarily complex.
WDS does not dispose of the tag when the window object is disposed.
This method returns any previous object associated with the window or
NULL
.
Example: object myWind; gSetTag(myWind, gNewWithInt(ShortInteger, 17)); |
See also: GetTag, SetTag::Dialog
pt = gSetTopic(wind, tpc); object wind; /* child window object */ char *tpc; /* help topic */ char *pt; /* previous help topic */ |
This method is used to associate help text with window wind
.
The help text is defined using the Windows help system and labeled
with the topic indicated by tpc
. Then, if the user hits
the F1 key while in the window, WDS will automatically bring up
the Windows help system and find the indicated topic.
WDS also supports dialog and control specific topics. See the appropriate sections.
This method returns any previous topic associated with the window.
Example: object myWind; gSetTopic(myWind, "myWindHelp"); |
See also: The HelpSystem
class.
r = gShow(wind); object wind; /* a window object */ int r; /* always 0 */ |
Once a window object is created (via vNew
) and its various attributes
set, gShow
is called in order to actually create the Windows window,
with the selected attributes, and display (show) it.
Example: object myWind; myWind = vNew(PopupWindow, "Name", 10, 40); gShow(myWind); |
See also: AutoShow, ProcessMessages::MainWindow
r = gTextBrush(wind, brsh); object wind; /* a window object */ object brsh; /* brush object */ object r; /* wind */ |
This method is used to determine what brush object is used for foreground text which is displayed. Any previously associated brush object will be disposed. This brush object will also be automatically disposed when the window is disposed.
The window passed is returned.
Example: object myWind; gTextBrush(myWind, vNew(SolidBrush, 255, 0, 0)); |
See also: BackBrush, Use, SetBackBrush::Application
and the Brush
classes
r = gTextOut(wind, row, col, txt); object wind; /* a window object */ int row; /* row number of output */ int col; /* column number of output */ char *txt; /* string to be output */ object r; /* wind */ |
This method is used to display a string of text (txt
) at row
row
and column col
. row
and col
have their
origin in the upper left hand corner of the window and are scaled as
dictated by the SetScalingMode::Application
method.
Their index origin is 0.
This method returns the window argument passed.
Example: object myWind; gTextOut(myWind, 10, 30, "Hello World"); |
See also: Write, Puts, Printf
r = gUpdate(wind); object wind; /* a window object */ object r; /* wind */ |
This method is used to explicitly update the display with changes the program
may have made to window wind
. WDS normally handles this need, however,
this method is available in case the programmer performs special processing
and wishes to update the entire window at one time.
This method returns the window argument passed.
Update::MainWindow
.
Example: object myWind; gUpdate(myWind); |
r = gUse(wind, obj); object wind; /* a window object */ object obj; /* arbitrary object */ object r; /* the object passed */ |
This method is used as a general purpose mechanism to associated a
number of object types with a window. obj
may be a Font,
Icon, Cursor, Menu,
or the background Brush
object. Those
objects would have normally been created via their associated classes
and then may be associated with a window via this method.
Note that the same object should not be associated with more than one
window. The problem is that if one window is deleted, WDS would delete
all the objects associated with that window and then the other window
would reference objects which have been deleted. The way around this is
to use the Copy
method in order to make a copy of an object prior
to associating with a new window. This way there would be two
independent objects such that if one is deleted the other would still
exist.
Note also that the Application
class may be used to set application
wide defaults for these types of objects.
The value returned is the object passed.
Example: object myWind, myOtherWind, someFont; someFont = vNew(ExternalFont, "Times New Roman", 12); if (someFont) { gUse(myWind, someFont); gUse(myOtherWind, gCopy(someFont)); } |
See also: LoadFont, LoadIcon, LoadCursor, LoadMenu,
TextBrush, BackBrush
r = gVertShift(wind, rows); object wind; /* a window object */ int rows; /* rows to shift */ object r; /* the window object */ |
This method is used to perform a vertical shift of the text in the
memory buffer which is being displayed in the window. WDS keeps
a buffer which holds a programmer definable number of lines of text.
The user is then able to scroll through this text. If the application
attempts to display more lines than this maximum (via vPrintf
for example) the system will automatically call gVertShift
in
order to eliminate the top line and make room for the new line being
appended. This method is mainly used internally.
wind
is the window which is to be affected, and rows
is the
number of rows to scroll. If rows
is positive the scroll moves
the text up, and negative moves the text down. Scrolling up permanently
destroys lines at the beginning of the buffer and scrolling down
permanently destroys lines at the end of the buffer.
The scaling factor associated with rows
is set by
SetScalingMode::Application
and the maximum lines associated with
a window may be set with SetMaxLines
.
Example: object myWind; gVertShift(myWind, 2); |
See also: ScrollVert, SetMaxLines
r = gWrite(wind, txt, len); object wind; /* a window object */ char *txt; /* string to be output */ unsigned len; /* length of string */ int r; /* bytes written */ |
This method is used to display a string of text (txt
) in a sequential
fashion on window wind
. Since the Window
class is a subclass
of Stream
, this method is mainly provided to support the standard
interface dictated by the Stream
class. By providing this method,
the Window
class automatically inherits the Puts
and
Printf
capability.
txt
is the text to be displayed and len
is the length of that
string. Text txt
will be displayed on window wind
and
len
will be returned.
Example: object myWind; gWrite(myWind, "Hello World\n", 12); |
See also: TextOut, Puts, Printf
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
This class, named MainWindow
, is used to create and manipulate an
application’s main window. There is normally one main window associated
with each application and this is the first window created.
This class is a subclass of the Window
class and therefore
inherits all of the Window
class’s functionality. The methods
documented in this subsection are only those which are particular
to the MainWindow
class.
r = vNew(MainWindow, ttl); char *ttl; /* window title */ object r; /* new window */ |
This class method is used to create the main application window.
Since this is a class method the first argument must be literally
MainWindow
. The window title (ttl
) will appear at
the top of the window.
The value returned is the new window created.
Example: object myWind; myWind = vNew(MainWindow, "My Application"); |
See also: New::ChildWindow, New::PopupWindow,
Show, Dispose::Window
r = gProcessMessages(wind); object wind; /* a window object */ int r; /* final message result */ |
Once the main application window is created (via vNew
) and
its various attributes set, gProcessMessages
is called in order
to actually create the Windows window, with the selected attributes,
display (show) it, and process the application’s messages. Processing
the application’s messages is what allows the user to interact with the
application.
The value returned is the return value specified when the application is
terminated. This can be specified via QuitApplication::Application
.
Example: object myWind; myWind = vNew(MainWindow, "Application Name"); gProcessMessages(myWind); |
See also: New, Show::Window, ProcessMessages::MessageDispatcher
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The Child Window class, called ChildWindow
, is used in the creation
of windows which are children of other windows. As such, they can not
be positioned outside of their parent window, and they get iconized along
with their parent window.
This class is a subclass of the Window
class and therefore
inherits all of the Window
class’s functionality. The methods
documented in this subsection are only those which are particular
to the ChildWindow
class.
r = vNew(ChildWindow, prnt, rows, cols); object prnt; /* parent window object */ int rows; /* length of window */ int cols; /* width of window */ object r; /* new window */ |
This class method is used to create a child window.
Since this is a class method the first argument must be literally
ChildWindow
. prnt
represents the parent window
object of which the new window will be a child. rows
and
cols
determine the initial size of the window in are specified
in increments dictated by SetScalingMode::Application
.
The default style associated with the child window is
WS_CHILD | WS_VISIBLE
and may be changed with SetStyle::Window
.
The position may be set with
SetPosition::Window
.
The value returned is the new window created.
Example: object myWind, mainWind; myWind = vNew(ChildWindow, mainWind, 10, 45); |
See also: New::MainWindow, New::PopupWindow,
Show, Dispose::Window
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The PopupWindow
class is used to create arbitrary windows which
function independently of other windows. That is, they may overlap or
be moved outside of other windows and iconized independently of other
windows. If, however, a popup window is associated with a parent window
(via SetParent::Window
) then it may move outside the parent but
will be iconized with it.
This class is a subclass of the Window
class and therefore
inherits all of the Window
class’s functionality. The methods
documented in this subsection are only those which are particular
to the PopupWindow
class.
r = vNew(PopupWindow, name, rows, cols); char *name; /* window title */ int rows; /* length of window */ int cols; /* width of window */ object r; /* new window */ |
This class method is used to create a popup window. Since this is a
class method the first argument must be literally PopupWindow
.
name
represents the window title and will appear in the window’s
top border. rows
and cols
determine the initial size of
the window in are specified in increments dictated by
SetScalingMode::Application
.
The default style associated with the popup window is WS_POPUP |
WS_VISIBLE | WS_CAPTION | WS_THICKFRAME | WS_MINIMIZEBOX |
WS_MAXIMIZEBOX | WS_SYSMENU
and may be changed with
SetStyle::Window
. The position may be set with
SetPosition::Window
.
The value returned is the new window created.
Example: object myWind, mainWind; myWind = vNew(PopupWindow, "Window Title", 10, 45); |
See also: New::MainWindow, New::ChildWindow,
Show, Dispose::Window
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The Printer
class is used for all aspects of printing.
It is a subclass of the Dynace Stream
class and as
such inherits all of its functionality.
All methods in the class use an argument referred to as pntr
.
This will always be the printer object returned by QueryPrinter
,
New
or NewWithHDC
and used to identify the printer
which is to be effected.
The value returned by all methods which cause text or graphics output is
very significant. During normal operation, the printer object passed
will be returned. However, if an error occurs or the user aborted the
report a NULL
will be returned. In this case further output
should be avoided (although it won’t hurt - it’ll just be ignored) and
the printer object should be disposed.
All positioning parameters are in increments dictated by
SetScale
. Positions begin in the upper left hand corner and have
an index origin of 0.
r = gArc(pntr, yBeg, xBeg, yEnd, xEnd, yaBeg, xaBeg, yaEnd, xaEnd); object pntr; /* printer object */ int yBeg; /* starting row */ int xBeg; /* starting column */ int yEnd; /* ending row */ int xEnd; /* ending column */ int yaBeg; /* starting arc row */ int xaBeg; /* starting arc column */ int yaEnd; /* ending arc row */ int xaEnd; /* ending arc column */ object r; /* printer object */ |
This method is used to output an elliptical arc to the printer. The
currently selected pen object will indicate the thickness and pattern of
the outline of the shape, and the currently selected brush object will
be used to determine what pattern the shape will be filled with. The
parameters indicate location of the beginning and ending of the shape as
well as the coordinated of the arc and are in increments dictated by
SetScale
.
See the note at the beginning of this section regarding the return value.
Example: object pntr; if (!gArc(pntr, 10, 10, 180, 140, 12, 12, 128, 135)) abort report; |
See also: NewPage, SetScale, Use,
Line, Rectangle, Ellipse, RoundRect,
Chord, Pie
r = gChord(pntr, yBeg, xBeg, yEnd, xEnd, ylBeg, xlBeg, ylEnd, xlEnd); object pntr; /* printer object */ int yBeg; /* starting row */ int xBeg; /* starting column */ int yEnd; /* ending row */ int xEnd; /* ending column */ int ylBeg; /* starting line row */ int xlBeg; /* starting line column */ int ylEnd; /* ending line row */ int xlEnd; /* ending line column */ object r; /* printer object */ |
This method is used to output a chord shape to the printer. The
currently selected pen object will indicate the thickness and pattern of
the outline of the shape, and the currently selected brush object will
be used to determine what pattern the shape will be filled with. The
parameters indicate location of the beginning and ending of the shape as
well as the coordinated of the intersecting line and are in increments
dictated by SetScale
.
See the note at the beginning of this section regarding the return value.
Example: object pntr; if (!gChord(pntr, 10, 10, 180, 140, 12, 12, 128, 135)) abort report; |
See also: NewPage, SetScale, Use,
Line, Rectangle, Ellipse, RoundRect, Pie, Arc
This method performs the same function as Dispose
. See that
method for details.
r = gDispose(pntr); object pntr; /* printer object */ object r; /* NULL */ |
This method is used to flush the final output page, close the printer and dispose of the printer object. It must be called when a report is is complete and the printer is no longer needed.
The value returned is always NULL
and may be used to null out
the variable which contained the object being disposed in order to
avoid future accidental use.
Example: object pntr; pntr = gDispose(pntr); |
r = gEllipse(pntr, yBeg, xBeg, yEnd, xEnd); object pntr; /* printer object */ int yBeg; /* starting row */ int xBeg; /* starting column */ int yEnd; /* ending row */ int xEnd; /* ending column */ object r; /* printer object */ |
This method is used to output an ellipse to the printer. The currently
selected pen object will indicate the thickness and pattern of the
outline of the shape, and the currently selected brush object will be
used to determine what pattern the shape will be filled with. The
parameters indicate location of the beginning and ending of the shape
and are in increments dictated by SetScale
.
See the note at the beginning of this section regarding the return value.
Example: object pntr; if (!gEllipse(pntr, 10, 20, 30, 40)) abort report; |
See also: NewPage, SetScale, Use,
Line, Rectangle, RoundRect, Chord, Pie, Arc
r = gHandle(pntr); object pntr; /* printer object */ HANDLE hdc; /* handle device context */ |
This method is used to obtain the device context handle associated with
an opened printer represented by pntr
. It is used internally
by Windows and should not normally be needed.
Example: HDC hdc; hdc = (HDC) gHandle(pntr); |
r = gLine(pntr, yBeg, xBeg, yEnd, xEnd); object pntr; /* printer object */ int yBeg; /* starting row */ int xBeg; /* starting column */ int yEnd; /* ending row */ int xEnd; /* ending column */ object r; /* printer object */ |
This method is used to output a line to the printer. The currently
selected pen object will indicate the thickness and pattern of the line.
The parameters indicate location of the beginning and ending of the line
and are in increments dictated by SetScale
.
See the note at the beginning of this section regarding the return value.
Example: object pntr; if (!gLine(pntr, 10, 20, 30, 40)) abort report; |
See also: NewPage, SetScale, Use,
Arc, Rectangle, Ellipse, RoundRect, Chord, Pie
r = gLoadFont(pntr, fname, sz); object pntr; /* printer object */ char *fname; /* font name */ int sz; /* point size */ object r; /* font object */ |
This method is used to load an arbitrary font by name at any point size
and associate it as the default font for future text output to printer
pntr
. fname
is the full name of the font as it appears
when you list the available fonts via the control-panel / fonts Windows
utility, minus the font type in parentheses. sz
indicates the
desired point size.
Any font object previously associated with the printer will be disposed. When the printer object is disposed, the font object will also be disposed.
The value returned is an object representing the font loaded, or
NULL
if the font was not found.
Note that fname
may also be a Dynace object cast as a (char *
).
Example: object pntr; gLoadFont(pntr, "Times New Roman", 12); |
See also: LoadSystemFont, Indirect::ExternalFont, Use
r = gLoadSystemFont(pntr, fnt); object pntr; /* a printer object */ unsigned fnt; /* font identifier */ object r; /* font object */ |
This method is used to load a Windows predefined font and associate it
with printer pntr
. The last font associated with a printer is the
one which will be used when any text is output to the printer.
fnt
is a Windows defined macro which identifies the font. The
available options are defined in the Windows documentation under the
function named GetStockObject
and normally end with _FONT
.
The font object will be automatically destroyed whenever the printer
object is disposed.
The value returned is an object representing the font, or
NULL
if the font was not found.
Example: object pntr; gLoadSystemFont(pntr, SYSTEM_FONT); |
See also: LoadFont, Load::SystemFont, Use
pntr = vNew(Printer, pwind, rname); object pwind; /* parent window */ char *rname; /* report name */ object pntr; /* new printer object */ |
This class method is used to create a new Printer
object which
will be used by the Printer
instance methods to control the
printer, fonts and content of output. This method opens up the
default printer.
pwind
is the window which will act as the parent to any
messages which may be displayed when a report is being printed.
rname
determines what the report is referred to as in any
messages.
The value returned represents the printer to be used. If the default
printer couldn’t be opened, NULL
will be returned. If an object
is returned, it must be disposed (via Dispose
) when it is no
longer needed.
Example: object pntr, pwind; pntr = vNew(Printer, pwind, "My Report"); |
See also: QueryPrinter, NewWithHDC
r = gNewPage(pntr); object pntr; /* printer object */ object r; /* printer object */ |
This method is used to flush and eject the current output page (if anything had been output to it) and prepare for a possible new page of output.
See the note at the beginning of this section regarding the return value.
Example: object pntr; if (!gNewPage(pntr)) abort report; |
pntr = gNewWithHDC(Printer, pwind, rname, hdc); object pwind; /* parent window */ char *rname; /* report name */ HDC hdc; /* device context */ object pntr; /* new printer object */ |
This class method is used to create a new Printer
object which
will be used by the Printer
instance methods to control the
printer, fonts and content of output.
This method opens up the printer identified by hdc
. This is
a Windows internal identifier and may be obtained via the
PrintDialog
class.
pwind
is the window which will act as the parent to any
messages which may be displayed when a report is being printed.
rname
determines what the report is referred to as in any
messages.
The value returned represents the printer to be used. If the
printer couldn’t be opened, NULL
will be returned.
This method is seldom needed due to QueryPrinter
and New
.
Use them. If an object is returned, it must be disposed (via
Dispose
) when it is no longer needed.
Example: object pntr, pwind; HDC hdc; pntr = gNewWithHDC(Printer, pwind, "My Report", hdc); |
See also: QueryPrinter, New
r = gPie(pntr, yBeg, xBeg, yEnd, xEnd, yaBeg, xaBeg, yaEnd, xaEnd); object pntr; /* printer object */ int yBeg; /* starting row */ int xBeg; /* starting column */ int yEnd; /* ending row */ int xEnd; /* ending column */ int yaBeg; /* starting arc row */ int xaBeg; /* starting arc column */ int yaEnd; /* ending arc row */ int xaEnd; /* ending arc column */ object r; /* printer object */ |
This method is used to output a pie shaped wedge to the printer. The
currently selected pen object will indicate the thickness and pattern of
the outline of the shape, and the currently selected brush object will
be used to determine what pattern the shape will be filled with. The
parameters indicate location of the beginning and ending of the shape as
well as the coordinated of the intersecting line and are in increments
dictated by SetScale
.
See the note at the beginning of this section regarding the return value.
Example: object pntr; if (!gPie(pntr, 10, 10, 180, 140, 12, 12, 128, 135)) abort report; |
See also: NewPage, SetScale, Use,
Line, Rectangle, Ellipse, RoundRect,
Chord, Arc
r = vPrintf(pntr, fmt, ...); object pntr; /* printer object */ char *fmt; /* format string */ int r; /* length of output */ |
This method is used to output a string of text (str
) in a sequential
fashion on printer pntr
. It is analogous to the standard C library
function fprintf
. All of the standard features of your C library
fprintf
function are supported and that documentation should be
consulted for full documentation on the arguments.
This method is used to support the standard streams interface, is
actually defined by the Stream
class, and is documented here for
convenience.
Note that this method begins with “v” since it takes variable arguments.
The value returned by this method is very significant. During normal
operation, the length of the output string will be returned. However,
if an error occurs or the user aborted the report a -1
will be
returned. In this case further output should be avoided (although it
won’t hurt - it’ll just be ignored) and the printer object should be
disposed.
Example: object pntr; int age = 32; if (-1 == vPrintf(pntr, "My age =- %d\n", age)) goto abort report; |
See also: TextOut, Puts
r = gPuts(pntr, str); object pntr; /* printer object */ char *str; /* string to be output */ int r; /* length of str */ |
This method is used to output a string of text (str
) in a sequential
fashion on printer pntr
. This method is used to support the standard
streams interface, is actually defined by the Stream
class, and
is documented here for convenience. str
is the text to be output.
The value returned by this method is very significant. During normal
operation, the length of the output string will be returned. However,
if an error occurs or the user aborted the report a -1
will be
returned. In this case further output should be avoided (although it
won’t hurt - it’ll just be ignored) and the printer object should be
disposed.
Example: object pntr; if (-1 == gPuts(pntr, "Hello World\n")) goto abort report; |
See also: TextOut, Printf
pntr = gQueryPrinter(Printer, pwind, rname); object pwind; /* parent window */ char *rname; /* report name */ object pntr; /* new printer object */ |
This class method is used to create a new Printer
object which
will be used by the Printer
instance methods to control the
printer, fonts and content of output.
This method queries the user for printer selection and optional configuration, and uses that information to open the selected printer.
pwind
is the window which will act as the parent to any
messages which may be displayed when a report is being printed.
rname
determines what the report is referred to as in any
messages.
The value returned represents the printer to be used. If the user
canceled the printer selection or the printer couldn’t be opened,
NULL
will be returned. If an object is returned, it must be
disposed (via Dispose
) when it is no longer needed.
Example: object pntr, pwind; pntr = gQueryPrinter(Printer, pwind, "My Report"); |
See also: New, NewWithHDC
r = gRectangle(pntr, yBeg, xBeg, yEnd, xEnd); object pntr; /* printer object */ int yBeg; /* starting row */ int xBeg; /* starting column */ int yEnd; /* ending row */ int xEnd; /* ending column */ object r; /* printer object */ |
This method is used to output a rectangle to the printer. The currently
selected pen object will indicate the thickness and pattern of the outline
of the shape, and the currently selected brush object will be used to determine
what pattern the shape will be filled with.
The parameters indicate location of the beginning and ending of the shape
and are in increments dictated by SetScale
.
See the note at the beginning of this section regarding the return value.
Example: object pntr; if (!gRectangle(pntr, 10, 20, 30, 40)) abort report; |
See also: NewPage, SetScale, Use,
Line, Ellipse, RoundRect, Chord, Pie, Arc
r = gRoundRect(pntr, yBeg, xBeg, yEnd, xEnd, eHt, eWth); object pntr; /* printer object */ int yBeg; /* starting row */ int xBeg; /* starting column */ int yEnd; /* ending row */ int xEnd; /* ending column */ int eHt; /* corner ellipse height */ int eWth; /* corner ellipse width */ object r; /* printer object */ |
This method is used to output a rectangle with rounded corners to the
printer. The currently selected pen object will indicate the thickness
and pattern of the outline of the shape, and the currently selected
brush object will be used to determine what pattern the shape will be
filled with. The parameters indicate location of the beginning and
ending of the shape and are in increments dictated by SetScale
.
See the note at the beginning of this section regarding the return value.
Example: object pntr; if (!gRoundRect(pntr, 10, 20, 30, 40, 1, 1)) abort report; |
See also: NewPage, SetScale, Use,
Line, Rectangle, Ellipse, Chord, Pie, Arc
r = gSetScale(pntr, ht, wth); object pntr; /* printer object */ int ht; /* logical height */ int wth; /* logical width */ object r; /* printer object */ |
This method is used to set the logical scaling factor associated with an
output device. Each output page is divided up into ht
evenly
spaced row and wth
evenly spaced columns. This scaling factor
will be used by all text and graphics output when determining output size
and location on the page.
Coordinates begin at the upper left hand of the page and are zero origin. The defaults are set to 80 columns and 66 lines.
Example: object pntr; gSetScale(pntr, 132, 160); |
See also: TextOut
r = gTextOut(pntr, row, col, txt); object pntr; /* printer object */ int row; /* output row */ int col; /* output column */ char *txt; /* text to output */ object r; /* printer object */ |
This method is used to output a line of text (txt
) to the printer.
row
and col
indicate the position of the text and are in
increments dictated by SetScale
. Positions begin in the upper
left hand corner and have an index origin of 0.
The text will be printed in the currently selected font. Note that the actual printing will not occur until the report is complete and the print object disposed.
See the note at the beginning of this section regarding the return value.
Example: object pntr; if (!gTextOut(pntr, 10, 20, "output text")) abort report; |
See also: NewPage, Printf, SetScale, LoadFont
r = gUse(pntr, obj); object pntr; /* printer object */ object obj; /* arbitrary object */ object r; /* the object passed */ |
This method is used as a general purpose mechanism to associated a
number of object types with a printer. obj
may be a Font,
Brush
or Pen
object. Those objects would have normally been
created via their associated classes and then may be associated with a
printer via this method.
Note that the same object should not be associated with more than one
printer object. The problem is that if one printer object is disposed, WDS
would dispose of all the objects associated with that printer and then the
other printer would reference objects which have been deleted. The way
around this is to use the Copy
method in order to make a copy of
an object prior to associating it with a new printer. This way there would
be two independent objects such that if one is deleted the other would
still exist.
The value returned is the object passed.
Example: object myPntr, myOtherPntr, someFont; someFont = vNew(ExternalFont, "Times New Roman", 12); if (someFont) { gUse(myPntr, someFont); gUse(myOtherPntr, gCopy(someFont)); } |
See also: LoadFont
and the Brush
and Pen
classes.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The Menu
class, although not used directly by an application, is
used to house the common functionality associated with the
ExternalMenu
and InternalMenu