PowerWEB LiveControls for ASP.NET
GotFocus Event
See Also  Example Send comments on this topic.
Dart.LiveControls Namespace > LiveImage Class : GotFocus Event



Occurs when the PowerWEB control gains focus.

Syntax

Visual Basic (Declaration) 
<DescriptionAttribute("Event raised when the control receives focus.")>
<CategoryAttribute("Action")>
Public Event GotFocus As EventHandler
Visual Basic (Usage)Copy Code
Dim instance As LiveImage
Dim handler As EventHandler
 
AddHandler instance.GotFocus, handler
C# 
[DescriptionAttribute("Event raised when the control receives focus.")]
[CategoryAttribute("Action")]
public event EventHandler GotFocus
C++/CLI 
[DescriptionAttribute("Event raised when the control receives focus.")]
[CategoryAttribute("Action")]
public:
event EventHandler^ GotFocus

Example

The following example demonstrates PowerWEB events not found in other Server controls.
Visual BasicCopy Code
'In this example, events fire as the user interacts with a PowerWEB Control
'These events are not found in non-PowerWEB Server controls
'When an event is raised, a PowerWEB control updates with a message

Private Sub PowerWEBControl1_ContextMenuChanged(ByVal sender As Object, ByVal e As LocationEventArgs) Handles PowerWEBControl1.ContextMenuChanged
    PowerWEBControl1.Text = "You pressed the right button"
End Sub

Private Sub PowerWEBControl1_DoubleClick(ByVal sender As Object, ByVal e As LocationEventArgs) Handles PowerWEBControl1.DoubleClick
    PowerWEBControl1.Text = "That was a nice double-click"
End Sub

Private Sub PowerWEBControl1_GotFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles PowerWEBControl1.GotFocus
    PowerWEBControl1.Text = "I am focused"
End Sub

Private Sub PowerWEBControl1_HelpRequested(ByVal sender As Object, ByVal e As LocationEventArgs) Handles PowerWEBControl1.HelpRequested
    PowerWEBControl1.Text = "You pressed F1  Need some help?"
End Sub

Private Sub PowerWEBControl1_KeyDown(ByVal sender As Object, ByVal e As KeyEventArgs) Handles PowerWEBControl1.KeyDown
    PowerWEBControl1.Text = "The " + Convert.ToChar(e.KeyCode).ToString() + " key has gone down"
End Sub

Private Sub PowerWEBControl1_KeyPress(ByVal sender As Object, ByVal e As KeyEventArgs) Handles PowerWEBControl1.KeyPress
    PowerWEBControl1.Text = "The " + Convert.ToChar(e.KeyCode).ToString() + " key has been pressed"
End Sub

Private Sub PowerWEBControl1_KeyUp(ByVal sender As Object, ByVal e As KeyEventArgs) Handles PowerWEBControl1.KeyUp
    PowerWEBControl1.Text = "The " + Convert.ToChar(e.KeyCode).ToString() + " key has gone up"
End Sub

Private Sub PowerWEBControl1_LocationClick(ByVal sender As Object, ByVal e As LocationEventArgs) Handles PowerWEBControl1.LocationClick
    PowerWEBControl1.Text = "The button was pressed at (" + e.X.ToString() + "," + e.Y.ToString() + ")"
End Sub

Private Sub PowerWEBControl1_LostFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles PowerWEBControl1.LostFocus
    PowerWEBControl1.Text = "I'm losing focus"
End Sub

Private Sub PowerWEBControl1_MouseDown(ByVal sender As Object, ByVal e As LocationEventArgs) Handles PowerWEBControl1.MouseDown
    PowerWEBControl1.Text = "Down goes the mouse button"
End Sub

Private Sub PowerWEBControl1_MouseEnter(ByVal sender As Object, ByVal e As LocationEventArgs) Handles PowerWEBControl1.MouseEnter
    PowerWEBControl1.Text = "That tickles"
End Sub

Private Sub PowerWEBControl1_MouseLeave(ByVal sender As Object, ByVal e As LocationEventArgs) Handles PowerWEBControl1.MouseLeave
    PowerWEBControl1.Text = "Come back"
End Sub

Private Sub PowerWEBControl1_MouseUp(ByVal sender As Object, ByVal e As LocationEventArgs) Handles PowerWEBControl1.MouseUp
    PowerWEBControl1.Text = "Up goes the mouse button"
End Sub
C#Copy Code
//In this example, events fire as the user interacts with a PowerWEB Control
//These events are not found in non-PowerWEB Server controls
//When an event is raised, a PowerWEB control updates with a message

private void PowerWEBControl1_ContextMenuChanged(object sender, LocationEventArgs e)
{
	PowerWEBControl1.Text = "You pressed the right button!";
}

private void PowerWEBControl1_DoubleClick(object sender, LocationEventArgs e)
{
	PowerWEBControl1.Text = "That was a nice double-click!";
}

private void PowerWEBControl1_GotFocus(object sender, System.EventArgs e)
{
	PowerWEBControl1.Text = "I am focused!";
}

private void PowerWEBControl1_HelpRequested(object sender, LocationEventArgs e)
{
	PowerWEBControl1.Text = "You pressed F1!  Need some help?";
}

private void PowerWEBControl1_KeyDown(object sender, KeyEventArgs e)
{
	PowerWEBControl1.Text = "The " + Convert.ToChar(e.KeyCode).ToString() + " key has gone down!";
}

private void PowerWEBControl1_KeyPress(object sender, KeyEventArgs e)
{
	PowerWEBControl1.Text = "The " + Convert.ToChar(e.KeyCode).ToString() + " key has been pressed!";
}

private void PowerWEBControl1_KeyUp(object sender, KeyEventArgs e)
{
	PowerWEBControl1.Text = "The " + Convert.ToChar(e.KeyCode).ToString() + " key has gone up!";
}

private void PowerWEBControl1_LocationClick(object sender, LocationEventArgs e)
{
	PowerWEBControl1.Text = "The button was pressed at (" + e.X.ToString() + "," + e.Y.ToString() + ")!";
}

private void PowerWEBControl1_LostFocus(object sender, System.EventArgs e)
{
	PowerWEBControl1.Text = "I'm losing focus!";
}

private void PowerWEBControl1_MouseDown(object sender, LocationEventArgs e)
{
	PowerWEBControl1.Text = "Down goes the mouse button!";
}

private void PowerWEBControl1_MouseEnter(object sender, LocationEventArgs e)
{
	PowerWEBControl1.Text = "That tickles!";
}

private void PowerWEBControl1_MouseLeave(object sender, LocationEventArgs e)
{
	PowerWEBControl1.Text = "Come back!";
}

private void PowerWEBControl1_MouseUp(object sender, LocationEventArgs e)
{
	PowerWEBControl1.Text = "Up goes the mouse button!";
}

Remarks

The GotFocus event fires when the PowerWEB control gains focus. LostFocus fires when the PowerWEB control loses focus.

Requirements

Target Platforms: Microsoft .NET Framework 2.0

See Also

Documentation Version 4.0.2
© 2012 Dart Communications. All Rights Reserved.