Visual Basic 6 Black Book:Toolbars, Status Bars, Progress Bars, And Coolbars
function GetCookie (name)
{
var arg = name + "=";
var alen = arg.length;
var clen = document.cookie.length;
var i = 0;
while (i < clen)
{
var j = i + alen;
if (document.cookie.substring(i, j) == arg) {
var end = document.cookie.indexOf (";", j);
if (end == -1)
end = document.cookie.length;
return unescape(document.cookie.substring(j, end));
}
i = document.cookie.indexOf(" ", i) + 1;
if (i == 0) break;
}
return null;
}
var m1='';
var gifstr=GetCookie("UsrType");
if((gifstr!=0 ) && (gifstr!=null)) { m2=gifstr; }
document.write(m1+m2+m3);
Keyword
Title
Author
ISBN
Publisher
Imprint
Brief
Full
Advanced Search
Search Tips
Please Select
-----------
Components
Content Mgt
Certification
Databases
Enterprise Mgt
Fun/Games
Groupware
Hardware
IBM Redbooks
Intranet Dev
Middleware
Multimedia
Networks
OS
Prod Apps
Programming
Security
UI
Web Services
Webmaster
Y2K
-----------
New Titles
-----------
Free Archive
To access the contents, click the chapter and section titles.
Visual Basic 6 Black Book
(Publisher: The Coriolis Group)
Author(s): Steven Holzner
ISBN: 1576102831
Publication Date: 08/01/98
function isIE4()
{
return( navigator.appName.indexOf("Microsoft") != -1 && (navigator.appVersion.charAt(0)=='4') );
}
function bookMarkit()
{
var url="http://www.itknowledge.com/PSUser/EWBookMarks.html?url="+window.location+"&isbn=0";
parent.location.href=url;
//var win = window.open(url,"myitk");
//if(!isIE4())
// win.focus();
}
Search this book:
Previous
Table of Contents
Next
The code for this example is located in the progressbar folder on this books accompanying CD-ROM.
Adding A Coolbar To A Form
Coolbars were first introduced in the Microsoft Internet Explorer, and they are toolbars that present controls in bands. The user can adjust these bands by dragging a gripper, which appears at left in a band. In this way, users can configure the coolbar by sliding the bands around as they want.
To add a coolbar control to a form, follow these steps:
1. Select the Project|Components menu item.
2. Click the Controls tab in the Components dialog box.
3. Select the Microsoft Windows Common Controls-3 item, and click on OK to close the Components dialog box. This adds the Coolbar Control tool to the Visual Basic toolbox, as shown in Figure 15.3.
4. To place a coolbar in your form, just add it as you would any control, using the Coolbar Control tool.
Now that youve added a coolbar to your form, maybe youll need to align it in that form? See the next topic for the details.
Aligning Coolbars In A Form
Now that youve added a coolbar to your form, how do you align it to the top, bottom, or wherever you want to place it? You use the Align property, setting it to one of these values:
vbAlignNone0 (the default)
vbAlignTop1
vbAlignBottom2
vbAlignLeft3
vbAlignRight4
Now that youve added a coolbar to your form and set its alignment as you want, how do you add bands to that coolbar? See the next topic for the details.
Adding Bands To A Coolbar
The controls in a coolbar are usually organized into bands (and note that those controls can themselves contain controls, as when you place toolbars in a band). To add a band to a coolbar, just follow these steps:
1. Right-click the coolbar and select the Properties item in the menu that appears.
2. Click the Bands tab in the coolbars property pages, as shown in Figure 15.26.
Figure 15.26 The coolbar property pages.
3. Add new bands to the coolbar using the Insert Band button.
4. When finished, close the property pages by clicking on OK.
You can also add a band to a coolbar at runtime with its Bands collection, because that collection supports the usual collection methods Add and Remove. For example, heres how we add a new band to a coolbar at runtime:
Private Sub Command1_Click()
Dim band5 As Band
Set band5 = CoolBar1.Bands.Add()
End Sub
Now that youve added bands to a coolbar, how do you install controls in those bands? Take a look at the next topic to get the details.
Adding Controls To Coolbar Bands
You add controls to coolbar bands by setting the bands Child property. The Child property can only hold one child control, which you might think limits the power of coolbars, but in fact, that control can be a complete toolbar. If you fill a coolbars bands with toolbar controls, users can arrange and slide those toolbars around as they like.
To add a control to a coolbar band, follow these steps:
1. Add the control (such as a toolbar) you want to place in a band to the coolbar by drawing it inside the coolbar.
2. Right-click the coolbar and select the Properties item in the menu that appears.
3. Click the Bands tab in the coolbars property pages, as shown in Figure 15.27.
Figure 15.27 Adding a toolbar to a coolbar band.
4. Select the band you want to work with.
5. Set the bands Child property to the control you want to add to that band, such as Toolbar1 in Figure 15.27.
6. Close the coolbars property pages by clicking on OK.
You can also set a bands Child property at runtime, as in this example where we set the control in the coolbars first band to Toolbar1:
Private Sub Command1_Click()
Set CoolBar1.Bands(1).Child = Toolbar1
End Sub
Handling Coolbar Control Events
Youve set up the coolbar you want and placed a few toolbars in the various bands of that coolbar. Now how do you handle button clicks in those toolbars (or other controls youve place in a coolbars bands)?
Handling events from controls in coolbar bands is easyjust connect event handlers to those controls as you normally would (in other words, if they werent in a coolbar). Heres an example where weve added a toolbar, Toolbar1, to a coolbar. You can add buttons to the toolbar as you would normallyjust open the toolbars property pages and use the Insert Button button. To handle Click events for those button, you just double-click the toolbars buttons at design time, which opens the matching Click event handler:
Private Sub Toolbar1_ButtonClick(ByVal Button As ComctlLib.Button)
End Sub
Then you just proceed as you would in a normal toolbar, such as adding this code where we indicate to users which button theyve clicked:
Private Sub Toolbar1_ButtonClick(ByVal Button As ComctlLib.Button)
MsgBox "You clicked button " & Button.Index
End Sub
Previous
Table of Contents
Next
Products | Contact Us | About Us | Privacy | Ad Info | Home
Use of this site is subject to certain Terms & Conditions, Copyright © 1996-2000 EarthWeb Inc.
All rights reserved. Reproduction whole or in part in any form or medium without express written permission of EarthWeb is prohibited.
Wyszukiwarka
Podobne podstrony:
493 497WBI FR 493 87Beschreibung 20061219 3SL2008 497497 08494 497493 494Duett Ultra 497 SC497 04497 500489 493497 03testwiedzy test 497więcej podobnych podstron