KiXforms Forum Index KiXforms
The Forum for the KiXforms Community
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
 Quick Links 
Site News
Downloads
Documentation
Donations
Script Archive
Tracking Systems

Sample ProgressBar

 
Post new topic   Reply to topic    KiXforms Forum Index -> KiXforms.NET Discussion
View previous topic :: View next topic  
Author Message
benny69
KiXforms Advocate
KiXforms Advocate


Joined: 30 Oct 2003
Posts: 567
Location: Lincoln, Ne

PostPosted: Wed Nov 23, 2005 4:57 am    Post subject: Sample ProgressBar Reply with quote

Here is a Sample ProgressBar used in the StatusBar:

Code:
Break On
$System = CreateObject("Kixforms.System")
If Not $System
   $nul= MessageBox("KiXforms.Net Not Initiated. This Script Will Now Close.","Error",16)
   Quit()
EndIf
$nul = $System.Application.EnableVisualStyles

$MainForm = $System.Form()
$MainForm.StartPosition = 1  ;FormStartPosition_CenterScreen
$MainForm.Size = $System.Size(401,150) ;(Width,Height)
$MainForm.Text = "Sample ProgressBar"

$MainPanel = $System.Panel()
$MainPanel.Dock = 5  ;Fill
$nul = $MainForm.Controls.Add($MainPanel)

$StatusBar = $System.StatusBar()
$nul = $MainForm.Controls.Add($StatusBar)

$ProgressBar = $System.ProgressBar()
$ProgressBar.Left = $StatusBar.Right-20-100
$ProgressBar.Height = 18
$ProgressBar.Top = 3
$ProgressBar.Width = 100
$ProgressBar.Value = 0
$ProgressBar.Visible = 0
$nul = $StatusBar.Controls.Add($ProgressBar)

$GroupBox = $System.GroupBox()
$GroupBox.Height = $MainForm.ClientRectangle.Height-$StatusBar.Height-5
$GroupBox.Left = $MainForm.ClientRectangle.Left+5
$GroupBox.Top = $MainForm.ClientRectangle.Top;+5
$GroupBox.Width = $MainForm.ClientRectangle.Width-10
$nul = $MainPanel.Controls.Add($GroupBox)

$Label = $System.Label()
$Label.Height = 60
$Label.Left = 10
$Label.TextAlign = 32  ;MiddleCenter
$Label.Top = 20
$Label.Width = 370
$nul = $GroupBox.Controls.Add($Label)

$MainForm.AcceptButton = $Start
$MainForm.CancelButton = $Stop
$MainForm.Show  ;Displays the Form

StartProcesses()

While $MainForm.Visible
   $Nul = Execute($MainForm.DoEvents())
Loop
Exit 0

Function ExitForm()
   Quit()
EndFunction

Function AdvanceProgressBar($Step,Optional $Text)
   
   $Count = $Count + $Step
   If $Count > 100
      $Count = 0
   EndIf
   $ProgressBar.Value = $Count
   $ProgressBar.Refresh
   $StatusBar.Text = $Text
   Sleep 0.03
   
EndFunction

Function StartProcesses()
   
   $GroupBox.Text = "Process"
   $processes = "Checking Groups...","Modifying Registry...","Mapping Drives...","Creating Icons...","Adding Printers...","Finalizing..."
   $ProgressBar.Visible = -1
   For Each $process in $processes
      $X=$x+1
      $Label.Text = $process
      AdvanceProgressBar(10,"Process #"+$x)
      Sleep 1
   Next
   ResetProgressBar()
   $GroupBox.Text = ""
   Sleep 1
   ExitForm()
   
EndFunction

Function ResetProgressBar()
   
   $Count = 0
   AdvanceProgressBar(0,"")
   $Label.Text = ""
   $ProgressBar.Visible = 0
   
EndFunction

_________________
Wait don't order yet,... get KiXforms Designer .NET 2.0 (Beta)
KiXforms Designer .NET 2.0 (Beta)
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic    KiXforms Forum Index -> KiXforms.NET Discussion All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group