home *** CD-ROM | disk | FTP | other *** search
-
- ╔══════════════════════════════════════════════════════════════╗
- ║ Steve Gibson's Second InfoWorld TechTalk Column ║
- ║ about Microsoft's new Visual Basic ║
- ╚══════════════════════════════════════════════════════════════╝
-
- Microsoft's new Visual Basic product is destined to dramatically
- change the way the world feels about and uses the Windows
- operating environment. In the few short days I spent learning
- and understanding this new system, I stunned myself and my co-
- workers by created two lovely and significant networked
- applications as well as several simpler experimental programs.
- Although deliberate programming still lies at the heart of VB,
- and complex applications can still become complicated, Visual
- Basic rewards investment so rapidly that you're literally sucked
- into the experience of finding out more about how to make it do
- the things you want. After Microsoft left a copy of VB with me,
- I began to play, skipping a night of sleep just to cram more VB-
- time into my life. It really is THAT addictive. In the past few
- weeks I've written several quite-significant applications that I
- would have never attempted in any other programming environment.
- I would simply have gone without.
-
- Visual Basic will succeed like few products ever have by
- offering significant value to an extremely wide audience. Casual
- computer hobbyists will enjoy crafting their own entertaining
- applications that look as good as anything available
- commercially. In-house corporate developers, who will now be
- spared the horrendous task of mastering the Windows Software
- Development Kit (SDK), can quickly assemble sophisticated and
- readily maintainable networked applications to suit their
- company's unique needs. Since VB applications have full access
- to the Dynamic Link (DLL) Libraries and Dynamic Data Exchange
- (DDE) links of other applications, VB can be used to provide
- customized extensions to existing applications, as well as to
- glue disparate applications together.
-
- Consultants will be able to build custom packages to solve their
- client's needs overnight. They'll be able to charge more and
- deliver more by capitalizing upon VB's amazing programming
- leverage. Full-time Windows developers, who would probably
- choose not to develop their commercial applications in Visual
- Basic, can still use VB to quickly implement prototype user-
- interface scenarios for management's approval. What's more, less
- technical front-end designers of commercial products can quickly
- prototype their ideas for final implementation by SDK power
- programmers.
-
- And finally, since the entire Windows SDK function library is
- directly available through Visual Basic, would-be SDK developers
- can easily learn and experiment with the operation of the
- Windows SDK functions from within VB's comfortable and forgiving
- environment.
-
- Visual Basic is a powerfully leveraging language product with
- something for every programmer. However, I don't want anyone to
- receive the mistaken impression that Visual Basic instantly
- turns everyone into a programmer. It doesn't. It's probably
- better to think of VB as an incredible power tool for existing
- programmers of any level. Unlike Borland's forms-oriented
- ObjectVision product, which uses the metaphor of fill-in forms
- driven by graphical decision trees to create living "intelligent
- forms," Visual Basic is NOT a product for non-programmers.
-
- Visual Basic uses the concept of a "project" to collect and
- organize the application's component files. A VB project
- consists of one project make file, one global file, zero or more
- forms, zero or more code-modules, and zero or more controls
- extension files. Let's look at each file type in turn.
-
- The project's "make file" lists the collection of files upon
- which the project depends. When a project is "Opened" the make
- file window shows the file name and its corresponding project
- name for each file component. When the "Save Project" command is
- given, VB saves any of the project's files that have been
- changed.
-
- Every project also consists of exactly one global declarations
- file into which project-wide constant and variable declarations
- are placed. A provided file called CONSTANTS.TXT is usually
- loaded into the project's global file to pre-define a number of
- system-wide constants. Since the global file cannot contain
- executable code, each project also requires a minimum of at
- least one form or code-module file containing executable
- instructions. The form files are perhaps the most interesting
- since they represent and define the visible surfaces in a VB
- application. When a new project is created, one form is created
- by default, though this may be removed for applications not
- requiring significant user interaction. Code module files
- contain executable code that's not directly related to the
- controls on individual forms. For example, a general-purpose
- subroutine library might be placed into and referenced in a code
- module file. Controls extension files allow the standard Windows
- controls such as push buttons, radio buttons, check boxes,
- scroll bars, etc. to be extended beyond those supported by
- Windows. SDK power programmers can create libraries of
- additional controls such as gas gauges, slider knobs, or
- whatever, and provide them for use by Visual Basic programmers.
- I predict that we'll see an active market of these VBX (Visual
- Basic Xtension) controls before long.
-
- When a new project is first started, a blank form is presented
- to the user. To the left of the form is the familiar toolbox
- menu which contains an assortment of "things." Unlike a simple
- drawing program that rubberbands rectangles, circles, and so
- forth, Visual Basic allows its user to literally "draw" command
- buttons, radio buttons, check boxes, text boxes, list boxes,
- scroll bars, and all of the other Windows objects we've become
- familiar with. If .VBX files have also been loaded into the
- project's make file, their own toolbox icons will also appear
- appended to the standard VB toolbox. The significant difference
- with Visual Basic is that rather than these being dead images of
- Windows controls, these things are actually living, functional
- control objects which are then "wired up."
-
- It's convenient to think of a form as a visible surface
- containing controls with control-handling code buried
- underneath. Double-clicking upon any of a form's control objects
- takes the user beneath the form's surface to that object's
- collection of associated methods. For example, double-clicking
- upon the first command button that was created on a form would
- take you to a window containing the two lines: "Sub
- Command1_Click ()" and "End Sub". "Sub" is shorthand for
- subroutine, and the subroutine name "Command1_Click" indicates
- that it will be automatically executed by VB when the Command1
- button receives a "click" action from the user. This means that
- each control object is associated with a collection of
- subroutine methods which are invoked when the respective action
- is received by the control.
-
- Designing an entire Visual basic application amounts to defining
- and drawing a collection of forms and controls, then filling-in
- the subroutines with the actions you want each control to
- respond with.
-
- In addition to subroutine methods, every Visual Basic object
- also maintains a collection of internal "properties." Object
- properties are like internal variables that specify design-time
- things like the control's location and size on the form, as well
- as run-time things like whether or not the control is enabled or
- visible at this moment. Even the forms that contain control
- objects are objects with user settable properties such as the
- style of their outlines and whether or not they're resizable and
- minimizable at run-time.
-
- The properties assigned to objects are referred to in program
- code with a familiar record-style "dot" syntax. For example, a
- command button's width could be accessed by the phrase
- "Command1.Width". Most properties can thus be determined and
- changed by program code.
-
- Since most object properties are accessible both at design-time
- and during run-time, many unusual effects are possible. For
- example, in the first application I designed, a control button
- shot across the control panel hitting the far edge, then bounced
- along to its final position. In another of my first applications
- a list of instructions initially appeared above a three-line
- list box. When the user had read the instructions and started
- the application by clicking upon the "Start" button, the
- instructions disappeared and the list box sprang to full
- operating size. All these effects were achieved by altering the
- object's initial design-time properties at run-time.
-
- Visual Basic supports such easy tinkering and fiddling with the
- user's experience of a Window's application that the resulting
- Windows EXE applications have more intrinsic friendly
- functionality than any we've seen before. What's more, such
- applications would have been impossible to create if it weren't
- for the leveraging power provided by Visual Basic.
-
- The people to whom I've demonstrated VB have evidenced the
- standard turned-up nose at the notion of programming in anything
- named "Basic." I've explained that this is just a standard
- Microsoft dementia about the insistence of the use of the term
- Basic. Yes, I wish Microsoft had left this new "thing" named
- Thunder, the product's internal code name, just as Apple left
- their winning graphical machine named Macintosh. On the other
- hand, after seeing how VB has empowered me to create Windows
- applications for the first time, even my skeptical Basic-hating
- friends have wanted to get their hands on it. I predict that you
- will too.
- - Steve.
-
- ════════════════════════════════════════════════════════════════