Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Check This Out!! Loading Fonts With ProgressBar!!

Status
Not open for further replies.

MrVB50au

Programmer
Mar 16, 2003
326
AU
Here's some source code for those who have a huge list of
fonts and would like to show some kind of indication that fonts are loading.

The Timer1 control is simply there to allow the font loading indicator form to be displayed, if the timer wasn't present, I found the form that suposed to be shown DID NOT! You can set the Timer1 interval to a low 5, this at least gives the indicator form time to show itself.

Remember, The Timer1 control is on the indicator form NOT the form that is loading. The form that is loading simply wont show itself untill all the fonts are loaded into the combo box of that form.

---------------------------------------------------------------------
TIMER CONTROL AND PROGRESS BAR IS PLACE ON 'frmLoadFonts' FORM.

Private Sub Timer1_Timer()
'//Set the mouse pointer to show an hourglass.
Screen.MousePointer = vbHourglass
'//Load 'frmMain' which triggers Progress bar.
Load frmMain
'//Fonts are now loaded so set mouse pointer to default.
Screen.MousePointer = vbDefault
'//Unload 'frmLoadFonts' and set it to nothing.
Unload Me
Set frmLoadFonts = Nothing
'//Show frmMain that now has all screen fonts in combo box.
frmMain.Show
End Sub
---------------------------------------------------------------------
frmMain IS NOW EXECUTING THE CODE BELOW BEFORE ITS BEEN SHOWN.

Private Sub Form_Load()
'//Set the Progress bar Maximum value to fontcount.
frmLoadFonts.ProgressBar1.Max = Screen.FontCount
'//Set "i" to load fonts as well as for progress bar.
For i = 0 To Screen.FontCount - 1
cmbFontName.AddItem Screen.Fonts(i)
'//Progress bar is moving along till reaches fontcount.
frmLoadFonts.ProgressBar1.Value = i
Next i
'//Show us the first fontname in the list.
.ListIndex = 0
End Sub
 
Given that I can view and select fonts from the common dialog box, I'd have to have a very specific reason to want to load a combo box with exactly the same information...
 
strongm

I totally agree with you. But in certain specific reasons, YES! Someone would want to use something like this. I just thought that I'd share some of my code that's all.

Sorry!

Andrew.
 
No, no, don't apologise. As you say, this may be useful to someone in the future
 
I use this with my own application as it doesn't display any of the usual boxes. I have a customed color box, open file box, save file box. etc...

As the look of my application doesn't resemble the standard look of the windows default. It's also good programming practice for me to try and not rely on windows boxes.

I know it's like reinventing the wheel, but heck it's good fun, you got to agree on that. LOL.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top