Dawid Dawid
Top achievements
Rank 1
Dawid Dawid
asked on 15 Feb 2011, 02:37 PM
Hello
I have a question about focus on control TextBox, DropDownList etc.
How is the best solution for highlight control when got focus? Focus primitive, maybe some themes support this functionallity?
Please some example for solution.
Thanks so much.
I have a question about focus on control TextBox, DropDownList etc.
How is the best solution for highlight control when got focus? Focus primitive, maybe some themes support this functionallity?
Please some example for solution.
Thanks so much.
5 Answers, 1 is accepted
0
Richard Slade
Top achievements
Rank 2
answered on 15 Feb 2011, 03:52 PM
Hello,
You can focus on RadControls in the same way you would focus on regular controls.
For exmaple
Hope that helps
Richard
You can focus on RadControls in the same way you would focus on regular controls.
For exmaple
private
void
Form1_Shown(
object
sender, EventArgs e)
{
this
.radTextBox1.Focus();
this
.radTextBox1.SelectionStart =
this
.radTextBox1.Text.Length;
}
Hope that helps
Richard
0
Dawid Dawid
Top achievements
Rank 1
answered on 15 Feb 2011, 06:24 PM
No. I need solution for control when it got focus, something red highlight or blur shadow when I for example tab key down to another control.
Customer have to know which control is already selected. Do you now what I mean?
Customer have to know which control is already selected. Do you now what I mean?
0
Accepted
Richard Slade
Top achievements
Rank 2
answered on 15 Feb 2011, 08:41 PM
Hello,
If I understand correctly, you wish to highlight the controls with a back color to show when they have focus. If so, then here is an example which you can copy and paste into a new project
Designer File
Form1.vb
hope that helps but let me know if you have further questions
Richard
If I understand correctly, you wish to highlight the controls with a back color to show when they have focus. If so, then here is an example which you can copy and paste into a new project
Designer File
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Partial
Class
Form1
Inherits
System.Windows.Forms.Form
'Form overrides dispose to clean up the component list.
<System.Diagnostics.DebuggerNonUserCode()> _
Protected
Overrides
Sub
Dispose(
ByVal
disposing
As
Boolean
)
Try
If
disposing
AndAlso
components IsNot
Nothing
Then
components.Dispose()
End
If
Finally
MyBase
.Dispose(disposing)
End
Try
End
Sub
'Required by the Windows Form Designer
Private
components
As
System.ComponentModel.IContainer
'NOTE: The following procedure is required by the Windows Form Designer
'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
<System.Diagnostics.DebuggerStepThrough()> _
Private
Sub
InitializeComponent()
Me
.RadTextBox1 =
New
Telerik.WinControls.UI.RadTextBox()
Me
.RadDropDownList1 =
New
Telerik.WinControls.UI.RadDropDownList()
Me
.RadCheckBox1 =
New
Telerik.WinControls.UI.RadCheckBox()
Me
.RadButton1 =
New
Telerik.WinControls.UI.RadButton()
CType
(
Me
.RadTextBox1, System.ComponentModel.ISupportInitialize).BeginInit()
CType
(
Me
.RadDropDownList1, System.ComponentModel.ISupportInitialize).BeginInit()
CType
(
Me
.RadCheckBox1, System.ComponentModel.ISupportInitialize).BeginInit()
CType
(
Me
.RadButton1, System.ComponentModel.ISupportInitialize).BeginInit()
Me
.SuspendLayout()
'
'RadTextBox1
'
Me
.RadTextBox1.Location =
New
System.Drawing.Point(23, 22)
Me
.RadTextBox1.Name =
"RadTextBox1"
Me
.RadTextBox1.Size =
New
System.Drawing.Size(210, 20)
Me
.RadTextBox1.TabIndex = 0
Me
.RadTextBox1.TabStop =
False
Me
.RadTextBox1.Text =
"RadTextBox1"
'
'RadDropDownList1
'
Me
.RadDropDownList1.Location =
New
System.Drawing.Point(23, 66)
Me
.RadDropDownList1.Name =
"RadDropDownList1"
Me
.RadDropDownList1.ShowImageInEditorArea =
True
Me
.RadDropDownList1.Size =
New
System.Drawing.Size(210, 21)
Me
.RadDropDownList1.TabIndex = 2
Me
.RadDropDownList1.Text =
"RadDropDownList1"
'
'RadCheckBox1
'
Me
.RadCheckBox1.Location =
New
System.Drawing.Point(23, 109)
Me
.RadCheckBox1.Name =
"RadCheckBox1"
Me
.RadCheckBox1.Size =
New
System.Drawing.Size(94, 18)
Me
.RadCheckBox1.TabIndex = 3
Me
.RadCheckBox1.Text =
"RadCheckBox1"
'
'RadButton1
'
Me
.RadButton1.Location =
New
System.Drawing.Point(142, 216)
Me
.RadButton1.Name =
"RadButton1"
Me
.RadButton1.Size =
New
System.Drawing.Size(130, 24)
Me
.RadButton1.TabIndex = 4
Me
.RadButton1.Text =
"RadButton1"
'
'Form1
'
Me
.AutoScaleDimensions =
New
System.Drawing.SizeF(6.0!, 13.0!)
Me
.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
Me
.ClientSize =
New
System.Drawing.Size(284, 262)
Me
.Controls.Add(
Me
.RadButton1)
Me
.Controls.Add(
Me
.RadCheckBox1)
Me
.Controls.Add(
Me
.RadDropDownList1)
Me
.Controls.Add(
Me
.RadTextBox1)
Me
.Name =
"Form1"
Me
.Text =
"Form1"
CType
(
Me
.RadTextBox1, System.ComponentModel.ISupportInitialize).EndInit()
CType
(
Me
.RadDropDownList1, System.ComponentModel.ISupportInitialize).EndInit()
CType
(
Me
.RadCheckBox1, System.ComponentModel.ISupportInitialize).EndInit()
CType
(
Me
.RadButton1, System.ComponentModel.ISupportInitialize).EndInit()
Me
.ResumeLayout(
False
)
Me
.PerformLayout()
End
Sub
Friend
WithEvents
RadTextBox1
As
Telerik.WinControls.UI.RadTextBox
Friend
WithEvents
RadDropDownList1
As
Telerik.WinControls.UI.RadDropDownList
Friend
WithEvents
RadCheckBox1
As
Telerik.WinControls.UI.RadCheckBox
Friend
WithEvents
RadButton1
As
Telerik.WinControls.UI.RadButton
End
Class
Form1.vb
Imports
Telerik.WinControls.UI
Public
Class
Form1
Private
Sub
Form1_Load(
ByVal
sender
As
System.
Object
,
ByVal
e
As
System.EventArgs)
Handles
MyBase
.Load
End
Sub
Private
Sub
Form1_Shown(
ByVal
sender
As
System.
Object
,
ByVal
e
As
System.EventArgs)
Handles
MyBase
.Shown
Me
.RadTextBox1.Focus()
Me
.RadTextBox1.
Select
()
End
Sub
Private
Sub
RadTextBox1_Enter(
ByVal
sender
As
System.
Object
,
ByVal
e
As
System.EventArgs)
Handles
RadTextBox1.Enter
Me
.RadTextBox1.TextBoxElement.BackColor = Color.Yellow
Me
.RadTextBox1.TextBoxElement.Fill.BackColor = Color.Yellow
End
Sub
Private
Sub
RadTextBox1_Leave(
ByVal
sender
As
System.
Object
,
ByVal
e
As
System.EventArgs)
Handles
RadTextBox1.Leave
Me
.RadTextBox1.TextBoxElement.ResetValue(LightVisualElement.BackColorProperty)
Me
.RadTextBox1.TextBoxElement.Fill.ResetValue(LightVisualElement.BackColorProperty)
End
Sub
Private
Sub
RadDropDownList1_Enter(
ByVal
sender
As
System.
Object
,
ByVal
e
As
System.EventArgs)
Handles
RadDropDownList1.Enter
Me
.RadDropDownList1.DropDownListElement.TextBox.BackColor = Color.Yellow
Me
.RadDropDownList1.DropDownListElement.TextBox.Fill.BackColor = Color.Yellow
End
Sub
Private
Sub
RadDropDownList1_Leave(
ByVal
sender
As
System.
Object
,
ByVal
e
As
System.EventArgs)
Handles
RadDropDownList1.Leave
Me
.RadDropDownList1.DropDownListElement.TextBox.ResetValue(LightVisualElement.BackColorProperty)
Me
.RadDropDownList1.DropDownListElement.TextBox.Fill.ResetValue(LightVisualElement.BackColorProperty)
End
Sub
Private
Sub
RadCheckBox1_Enter(
ByVal
sender
As
System.
Object
,
ByVal
e
As
System.EventArgs)
Handles
RadCheckBox1.Enter
Me
.RadCheckBox1.RootElement.BackColor = Color.Yellow
End
Sub
Private
Sub
RadCheckBox1_Leave(
ByVal
sender
As
System.
Object
,
ByVal
e
As
System.EventArgs)
Handles
RadCheckBox1.Leave
Me
.RadCheckBox1.RootElement.ResetValue(LightVisualElement.BackColorProperty)
End
Sub
End
Class
hope that helps but let me know if you have further questions
Richard
0
Dawid Dawid
Top achievements
Rank 1
answered on 15 Feb 2011, 09:17 PM
Yes, this is it :-) Thanks
0
Richard Slade
Top achievements
Rank 2
answered on 15 Feb 2011, 09:18 PM
You're welcome. Glad to help. Please remember to mark as answer
thanks
Richard
thanks
Richard