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
Its also easy to add a new status bar panel at runtimejust use the Panels collections Add method. Heres an example where we add a panel to a status bar when the user clicks a command button:
Private Sub Command1_Click()
Dim panel5 As Panel
Set panel5 = StatusBar1.Panels.Add()
Panel5.Text = "Status: OK"
End Sub
Now that youve added panels to the status bar, how do you display text in those panels? See the next topic.
Displaying Text In A Status Bar
Youve added a new status bar to your program and added the panels you want to the status barbut how do you display text? The status bar control youve added doesnt seem to have a Text property.
The text in a status bar is displayed in the status bars panels (unless the status bar is a simple status barsee Creating Simple Status Bars later in this chapterin which case you use the status bars SimpleText property). Displaying text in a status bars panels is easyjust select the panel you want to work with as the index into the status bars Panels collection, and use that panels Text property.
Heres an examplein this case, well display the program status, OK, in the first panel of the status bar (note that the Panels collection is 1-based) when the user clicks a command button, Command1:
Private Sub Command1_Click()
StatusBar1.Panels(1).Text = "OK"
End Sub
Thats itthe result of this code appears in Figure 15.21. Now weve displayed text in a status bar.
Figure 15.21 Displaying text in a status bar control.
The code for this example is located in the statusbar folder on this books accompanying CD-ROM.
Displaying Time, Dates, And Key States In A Status Bar
The Testing Department has sent you some email: the clock-watchers who use your SuperDuperDataCrunch program want a clock to watch. Can you add one to your program?
You can, and you can display it in the status bar. In fact, status bar controls are already set up to display common status items like key states and dates. To display one of those items, just right-click the status bar, select the Properties item in the menu that appears, click the Panels tab, select the panel you want to work with, and set the Style property in the box labeled Style to one of the following:
sbrText0 (the default); text and/or a bitmap. Displays text in the Text property.
sbrCaps1; Caps Lock key. Displays the letters CAPS in bold when Caps Lock is enabled, and dimmed when disabled.
sbrNum2; Num Lock key. Displays the letters NUM in bold when the Num Lock key is enabled, and dimmed when disabled.
sbrIns3; Insert key. Displays the letters INS in bold when the Insert key is enabled, and dimmed when disabled.
sbrScrl4; Scroll Lock key. Displays the letters SCRL in bold when Scroll Lock is enabled, and dimmed when disabled.
sbrTime5; time. Displays the current time in the system format.
sbrDate6; date. Displays the current date in the system format.
sbrKana7; Kana lock. Displays the letters KANA in bold when kana lock is enabled, and dimmed when disabled (this feature is enabled on Japanese operating systems only).
See Figure 15.22 for a status bar showing the time.
Figure 15.22 Displaying time in a status bar.
Customizing A Status Bar Panels Appearance
You can customize the appearance of the panels in a status bar with the Bevel, AutoSize, and Alignment properties. The Bevel property specifies whether the panel will have an inset bevel (the default), raised, or none at all. Heres how you can set the Bevel property:
sbrNoBevel0; the Panel displays no bevel, and text looks like it is displayed right on the status bar.
sbrInset1; the Panel appears to be sunk into the status bar.
sbrRaised2; the Panel appears to be raised above the status bar.
The AutoSize property determines how a panel will resize itself when its container (usually a form) is resized by the user. Here are the settings for the AutoSize property:
sbrNoAutoSize0; None. No autosizing occurs. The width of the panel is always and exactly that specified by the Width property.
sbrSpring1; Spring. When the parent form resizes and there is extra space available, all panels with this setting divide the space and grow accordingly. (The panels width never falls below that specified by the MinWidth property.)
sbrContents2; Content. The panel is resized to fit its contents.
The Alignment property indicates how the text or image in a panel will align in the panel. The settings for the Alignment property are as follows:
sbrLeft0; text appears left-justified and to the right of any bitmap.
sbrCenter1; text appears centered and to the right of any bitmap.
sbrRight2; text appears right-justified but to the left of any bitmap.
Displaying Images In A Status Bar
The Aesthetic Design Department is on the phone. How about adding a few images to the status bar? In fact, how about some animation for the user to watch while the program does other things? You think, is that possible?
Yes, it is, because status bar panels have a Picture property. To place an image in a status bar panel at design time, follow these steps:
1. Right-click the status bar, and select the Properties item in the menu that appears.
2. Click the Panels tab in the property pages that open.
3. Select the panel you want to work with.
4. Set the panels Picture property by clicking the Browse button in the box labeled Picture. You can set this property with an image file on disk.
5. Close the property pages by clicking on OK.
Thats itnow when you run the program, the image youve selected appears in the panel youve chosen, as shown in Figure 15.23.
Figure 15.23 Displaying images in a status bar.
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:
485 489489 Polska reklamaq51 874 4485 Gordon Lucy Dziesiąta rocznica ślubu411 489489 Jaką metodę amortyzacji środków trwałych wybrać485 486RS 422 RS 485 Communication protocol user s guide(1)482 48506 (485)485 48805 (489)482 485index (485)489 493więcej podobnych podstron