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

StatusBar flash?

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


Joined: 27 Jan 2004
Posts: 332

PostPosted: Thu Jun 28, 2007 6:43 pm    Post subject: StatusBar flash? Reply with quote

Is it possible to flash the StatusBar with a color of choice?

I tried using the BackColor property, but it does not set the color. It seems to do nothing. Any ideas?
Back to top
View user's profile Send private message
benny69
KiXforms Advocate
KiXforms Advocate


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

PostPosted: Thu Jun 28, 2007 7:04 pm    Post subject: Reply with quote

like this?

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

$Form = $System.Form()
$Form.Left = 0
$Form.StartPosition = 0  ;FormStartPosition_Manual
$Form.Size = $System.Size(400,300) ;(Width,Height)
$Form.Text = "Form"
$Form.Top = 0

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

$Label = $System.Label()
$Label.Height = 16
$Label.Left = 3
$Label.Text = "Label"
$Label.TextAlign = 16  ;MiddleLeft
$Label.Top = 2
$nul = $StatusBar.Controls.Add($Label)

$Button = $System.Button()
$Button.Click = "FlashMeClick()"
$Button.Left = 150
$Button.Text = "Flash Me"
$Button.Top = 90
$nul = $Form.Controls.Add($Button)

$Form.Show  ;Displays the Form

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

Function FlashMeClick()
   $Colors = "red","control"
   For $index = 0 to 9
      For Each $color in $colors
         $Label.BackColor = $System.Color.FromName($color)
         $Label.refresh
         Sleep 0.1
      Next
   Next
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
pearly
KiXforms Aficionado
KiXforms Aficionado


Joined: 27 Jan 2004
Posts: 332

PostPosted: Thu Jun 28, 2007 7:09 pm    Post subject: Reply with quote

Thanks benny! You're the man!

I need to incorporate a Label inside the StatusBar. I don't have that currently.
Back to top
View user's profile Send private message
pearly
KiXforms Aficionado
KiXforms Aficionado


Joined: 27 Jan 2004
Posts: 332

PostPosted: Thu Jun 28, 2007 7:21 pm    Post subject: Reply with quote

Is there a way (like in KF Classic) where you can refresh the Form to allow the user to move the Form while it's working on an event?

In KF Classic it looked like this:

Code:

For $i = 0 to 24
  Sleep 0.2
  $Form.Refresh
Next
Back to top
View user's profile Send private message
benny69
KiXforms Advocate
KiXforms Advocate


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

PostPosted: Fri Jun 29, 2007 11:39 am    Post subject: Reply with quote

I think that in many situations you could do the same thing in kf.net (same property: $Form.Refresh)
_________________
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
pearly
KiXforms Aficionado
KiXforms Aficionado


Joined: 27 Jan 2004
Posts: 332

PostPosted: Fri Jun 29, 2007 3:27 pm    Post subject: Reply with quote

I've tried it, but it doesn't work. I can't move the form while an event is taking place (e.g., the statusbar flashing). Crying or Very sad
Back to top
View user's profile Send private message
Lonkero
KiXforms Devotee
KiXforms Devotee


Joined: 13 Mar 2003
Posts: 1022
Location: Espoo, Finland

PostPosted: Mon Jul 02, 2007 12:07 pm    Post subject: Reply with quote

the kf.net version is a tad different, yep.
iirc, you can't have really async events in it at all.

_________________
Hammer
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
Shawn
KiXforms Developer
KiXforms Developer


Joined: 22 Feb 2003
Posts: 1983
Location: Canada

PostPosted: Mon Jul 02, 2007 11:49 pm    Post subject: Reply with quote

Yea Jooel is right. In that tight flashy-loop you have - your spending 99.9% of the time in the Kixtart SLEEP state. Which means Kixtart (and any of its attached DLL's) cant respond to any events.
Back to top
View user's profile Send private message
Shawn
KiXforms Developer
KiXforms Developer


Joined: 22 Feb 2003
Posts: 1983
Location: Canada

PostPosted: Mon Jul 02, 2007 11:59 pm    Post subject: Reply with quote

Here's a fully async way of doing this:

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

$Form = $System.Form()
$Form.Left = 0
$Form.StartPosition = 0  ;FormStartPosition_Manual
$Form.Size = $System.Size(400,300) ;(Width,Height)
$Form.Text = "Form"
$Form.Top = 0

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

$Label = $System.Label()
$Label.Height = 16
$Label.Left = 3
$Label.Text = "Label"
$Label.TextAlign = 16  ;MiddleLeft
$Label.Top = 2
$nul = $StatusBar.Controls.Add($Label)

$Button = $System.Button()
$Button.Click = "FlashMeClick()"
$Button.Left = 150
$Button.Text = "Flash Me"
$Button.Top = 90
$nul = $Form.Controls.Add($Button)

$Timer = $System.Timer()
$Timer.Interval = 200
$Timer.Tick = "Timer_Tick()"
$Timer.Tag = 0 ;

$Form.Show  ;Displays the Form

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

Function FlashMeClick()

 $Timer.Tag = 10 ; # flashes
 $Timer.Start

EndFunction

Function Timer_Tick()

 $Count = Val($Timer.Tag)

 If $Count = 0
  $Timer.Stop
  Return
 Endif

 $Colors = "Red", "Control"

 $Label.BackColor = $System.Color.FromName($Colors[$Count Mod 2])
 $Label.Refresh

 $Timer.Tag = $Count - 1

EndFunction
Back to top
View user's profile Send private message
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