Hi Anupam, welcome to the board.
Here's a script I just happened to have kixing around. Take a peek at the section for building a progressbar ... here it is:
code:
$PBar = $Form.ProgressBar
$PBar.Size = 370,25
$PBar.Location = 10,$Msg.Bottom + 5
$PBar.Min = 0
$PBar.Max = 100
$PBar.Value = 0
Basically, you create a progressbar with the $form.progressbar method (constructor) - that returns a handle to a progressbar object ($PBar) ... then we set its Size and Location on the form, and the Min(imum) value and the Max(imum) value and the current Value ... then later on in the script, simply change the value of Value to move the progressbar along ... heres the entire script:
INSTALL.KIX
code:
Break On
$Form = CreateObject("Kixtart.Form")
$Form.FontSize = 12
$Form.Size = 400,390
$Form.PrintXY(10,10,"Select a product and press enter:")
$ListBox = $Form.ListBox
$ListBox.Size = 200,205
$ListBox.Location = 10,50
$ListBox.FontName = Verdana
$ListBox.OnKeyDown = "ListBox_KeyDown"
$ListBox.OnDoubleClick = "ListBox_DoubleClick"
For $i = 0 to 100
$ListBox.AddItem("Product #$i")
Next
$InstallButton = $Form.Button
$InstallButton.Text = "Install"
$InstallButton.Left = $ListBox.Right + 30
$InstallButton.Top = $ListBox.Top
$InstallButton.OnClick = "InstallButton_Click()"
$ExitButton = $Form.Button
$ExitButton.Text = "Exit"
$ExitButton.Left = $ListBox.Right + 30
$ExitButton.Top = $InstallButton.Bottom + 10
$ExitButton.OnClick = "ExitButton_Click()"
$Msg = $Form.Label
$Msg.Size = 370,25
$Msg.Location = 10,$ListBox.Bottom + 25
$Msg.Text = "Ready ..."
$PBar = $Form.ProgressBar
$PBar.Size = 370,25
$PBar.Location = 10,$Msg.Bottom + 5
$PBar.Min = 0
$PBar.Max = 100
$PBar.Value = 0
$Form.Center
$Form.Show
$ListBox.SetFocus
$ListBox.ListIndex = 0
While $Form.Visible
$=Execute($Form.DoEvents)
Loop
Exit 1
Function ListBox_KeyDown
If $ListBox.KeyCode = 13 ; RETURN
Install($ListBox.Value)
$ListBox.SetFocus
EndIf
EndFunction
Function InstallButton_Click()
Install($ListBox.Value)
EndFunction
Function ListBox_DoubleClick()
Install($ListBox.Value)
EndFunction
Function Install($Product)
If $Product
$Msg.Text = "Installing " + $Product
For $i = 0 to $PBar.Max
$PBar.Value = $i
Sleep (0.025)
Next
$Msg.Text = "Ready ..."
$PBar.Value = 0
EndIf
EndFunction
Function ExitButton_Click()
$Form.Hide
EndFunction
Please feel free to post any questions or concerns you may have ...
-Shawn
[ 20. October 2002, 05:31: Message edited by: Shawn ]