Telerik Forums
UI for WinForms Forum
1 answer
17 views

I have a custom RadForm class that has inherited over a hundred forms. I have a custom RadTextBox class where I added some validation fired on the LostFocus event. To replace all RadTextBox controls with custom ones are a thousand controls to update, which are not an option.
I am looking for a way to maybe use events on my custom Radform which I can fire on Radtextbox control, it may be a way to update Radtextbox control to a custom one. Maybe other ideas on how I can use custom RadTextBox  control without updating one by one

Nadya | Tech Support Engineer
Telerik team
 answered on 11 Mar 2024
1 answer
32 views

Hi,

I have a RadDropDownList control in my WinForms window. Right now, when I click on this control for the first time since opening a window, the whole text inside RadDropDownList text box is selected.  What I would like to happen is to just set cursor at the end of existing text with no text selection.

I tried handling most of the events for RadDropDownList (like GotFocus or Click) with:

    private void OnGotFocus(object sender, EventArgs e)
    {
      SelectionLength = 0;
      SelectionStart = Text.Length;
    }

When I checked during debugging, the selection is properly changed by my method, but in the end the text is selected whole by something else after that.

How can I get no text selection when clicking first time into this RadDropDownList text box?

Any ideas?

 

Thanks

Wojtek

 

Dinko | Tech Support Engineer
Telerik team
 answered on 01 Feb 2024
1 answer
26 views

Hello,

I created a custom column and cell in my grid following the progress-bar example

https://docs.telerik.com/devtools/winforms/controls/gridview/cells/creating-custom-cells

But I have modified it so that I can view either a textBoxElement or a dropDownListElement depending on what data is in the cell. It all seems to work just fine until I scroll the grid. Scrolling visualy shuffles the data in the custom column. I've tried to take the cell-formatting route but without success. Is it possible to achieve this result somehow?

 Public Class GridParameterValueElement
        Inherits GridDataCellElement

        Public Sub New(ByVal column As GridViewColumn, ByVal row As GridRowElement)
            MyBase.New(column, row)
        End Sub

        Private isInitialized As Boolean
        Private firstTimeIndexChanged As Boolean = True
        Private dropDown As RadDropDownListElement
        Private textBox As RadTextBoxElement
        Protected Overrides Sub CreateChildElements()
            MyBase.CreateChildElements()
            dropDown = New RadDropDownListElement() With { 
                .DropDownStyle = Telerik.WinControls.RadDropDownStyle.DropDownList
            }
            textBox = New RadTextBoxElement() With {
                .Enabled = True,
                .ClickMode = Telerik.WinControls.ClickMode.Press,
                .ZIndex = -1
            }
            If Me.Children.Contains(dropDown) Then Me.Children.Remove(dropDown)
            If Me.Children.Contains(textBox) Then Me.Children.Remove(textBox)
            Me.Children.Add(dropDown)
            Me.Children.Add(textBox)
            AddHandler dropDown.SelectedIndexChanged, AddressOf SelectedIndexChanged
            AddHandler textBox.TextChanged, AddressOf TextInBoxChanged
            'AddHandler textBox.Click, AddressOf TextBox_Click

        End Sub

        Protected Overrides Sub DisposeManagedResources()
            RemoveHandler dropDown.SelectedIndexChanged, AddressOf SelectedIndexChanged
            RemoveHandler textBox.TextChanged, AddressOf TextInBoxChanged
            MyBase.DisposeManagedResources()
        End Sub
            
        'Private Sub TextBox_Click(sender As Object, e As EventArgs)
        '    Dim test  = sender
        'End Sub


        Public Overrides Sub SetContent()
            MyBase.SetContent()

            If Me.RowInfo.Cells("DisplayValue").Tag IsNot Nothing Then

                If Not Me.isInitialized Then 
                    If Me.Children.Contains(textBox) Then Me.Children.Remove(textBox)

                    With Me.dropDown
                        .DataSource = Me.RowInfo.Cells("DisplayValue").Tag
                        .ValueMember = ("DevelopmentTypeParameterValueId")
                        .DisplayMember = ("ParameterValue")
                    End With 
                End If

                If Me.RowInfo.Tag IsNot Nothing Then
                    RemoveHandler dropDown.SelectedIndexChanged, AddressOf SelectedIndexChanged
                    dropDown.SelectedIndex = DirectCast(Me.RowInfo.Tag, Integer)
                    AddHandler dropDown.SelectedIndexChanged, AddressOf SelectedIndexChanged
                Else
                    RemoveHandler dropDown.SelectedIndexChanged, AddressOf SelectedIndexChanged
                    dropDown.SelectedIndex = -1
                    AddHandler dropDown.SelectedIndexChanged, AddressOf SelectedIndexChanged
                End If

            ElseIf Me.Value IsNot Nothing AndAlso Me.Value IsNot DBNull.Value Then

                If Not Me.isInitialized Then 
                    If Me.Children.Contains(dropDown) Then Me.Children.Remove(dropDown)
                    Me.textBox.Text = CStr(Me.Value)
                End If
       
            End If

            Me.isInitialized = True
        
        End Sub


        Protected Overrides ReadOnly Property ThemeEffectiveType() As Type
            Get
                Return GetType(GridDataCellElement)
            End Get
        End Property

        Public Overrides Function IsCompatible(ByVal data As GridViewColumn, ByVal context As Object) As Boolean
            Return TypeOf data Is GridViewParameterValueColumn AndAlso TypeOf context Is GridDataRowElement
        End Function

    End Class
    
    Public Class GridViewParameterValueColumn
        Inherits GridViewDataColumn
        Public Sub New(ByVal fieldName As String)
            MyBase.New(fieldName)
        End Sub
        Public Overrides Function GetCellType(ByVal row As GridViewRowInfo) As Type
            If TypeOf row Is GridViewDataRowInfo Then
                Return GetType(GridParameterValueElement)
            End If
            Return MyBase.GetCellType(row)
        End Function
    End Class


Nadya | Tech Support Engineer
Telerik team
 answered on 16 Jan 2024
3 answers
24 views

Hi, I found out that for some languages like Hungarian <html> tag used in radLabel.text white spaces are escaped.

See an example below:

Is there a way to not remove these white spaces?

Br

Pawel

 

Nadya | Tech Support Engineer
Telerik team
 answered on 11 Jan 2024
1 answer
19 views

Hi,

I use the RadSpellChecker for some Textbox Controls and it worked great.

But when I have words with more than 9 letters, I don't get the contextmenu die Add these Words to the dictonary.

Any Idead to solve this problem?

Attached a screenshot with the contextmenu on a word with max 9 letters and a screenshot with more than 9 letters.

 

Thank you

Nadya | Tech Support Engineer
Telerik team
 answered on 20 Dec 2023
1 answer
17 views

Mouse Down event invalid.

private void radTextBox1_MouseDown(object sender, MouseEventArgs e)
{
    radTextBox1.Text = "test";
}
Dinko | Tech Support Engineer
Telerik team
 answered on 11 Dec 2023
1 answer
33 views

Hello,

I am trying to get the ClearButton of the RadTextBox next to the TextBoxElement to work but when I place it next to it (via Margin and a bit of Padding) the ClearButton does not react to any mouse events anymore. All the mouse releated hover properties of the ClearButton are false, as well (ContainsMouse, IsHovered, IsMouseOver).

Most interesting here is that the tbxWithMargin.TextBoxElement.MouseMove event is triggered but it does not recognize that the mouse is over the ClearButton. I've also tried to check here if the cursor is over its BoundingRectangle without success.

You can see this behaviour in the attached project.

If this would be possible (without a general mouse move check event of the whole form!), I'd also would like to use this ClearButton placement for a RadTextBoxControl.

Nadya | Tech Support Engineer
Telerik team
 answered on 19 Sep 2023
1 answer
40 views

I have several RadTextBox controls on a form and want to use a single RadContextMenu to provide my own context menu. Depening on which control is selected the resulting action will be a little different. 

I have this code to assign my context menus to the 2 controls.

this.txtBreedersAccount.TextBoxElement.TextBoxItem.HostedControl.ContextMenu = new ContextMenu();
this.txtBreedersAccount.TextBoxElement.TextBoxItem.HostedControl.MouseDown += new MouseEventHandler(this.AccountContextMenu_MouseDown);
this.txtMemberAccount.TextBoxElement.TextBoxItem.HostedControl.ContextMenu = new ContextMenu();
this.txtMemberAccount.TextBoxElement.TextBoxItem.HostedControl.MouseClick += new MouseEventHandler(this.AccountContextMenu_MouseDown);

This is my MouseDown procedure.

   private void AccountContextMenu_MouseDown(object sender, MouseEventArgs e)
        {
            if (e.Button == MouseButtons.Right)
            {                
                this.cmnuAccount.Show(MousePosition);
            }
        }

All of this works perfectly. My issue is the I can't seem to find a way to determine which of my 2 controls was actually used to instantiate the RadContextMenu. Searching the closest I could get was something like this, but it doesn't work.

        private void cmnuAccount_DropDownOpening(object sender, System.ComponentModel.CancelEventArgs e)
        {
            RadElement element = sender as RadElement;

            if (element == null)
            {
                return;
            }

            this._currentControl = element.ElementTree.Control as RadControl;
        }

Textboxes seem to be treated differently than other RadControls. If I setup the context menu on a checkbox for example it work without any issues.

I'd appreciate any help that anyone could give. Thanks.

Dess | Tech Support Engineer, Principal
Telerik team
 answered on 15 Aug 2023
1 answer
322 views

Hi,
     I try to set tooltip for textbox which is disabled , it not showing tooltip, but if the textbox in enabled it showing, Is there any way to show tooltip while it disabled ?

I tried following ways , but not working
in 2nd way i added Windows ToolTip control in that form and set the value for radtexbox, but not working.


       RadTextBoxControl1.Enabled = False
       '1 st way
        RadTextBoxControl1.TextBoxElement.ToolTipText = "This is the tooltip text."
        '2 nd way
        ToolTip1.SetToolTip(RadTextBoxControl1, "This is the tooltip text.")


Pls reply asap
Regards
Aravind
Aravind
Top achievements
Rank 2
Iron
Iron
Iron
 answered on 01 Aug 2023
1 answer
57 views

I Have One GridViewTextBox Column in a grid and One ComboBox Column based on selection in a combobox column I need cells of TextBox Column to contain either string or integer value how I can do this please help me.

already used below mentioned code but having issue with that I cannot able to put values more than 100 in that and getting up/down arrows to increases and decrease values but I dont need them.

 radGridView1.EditorRequired += new Telerik.WinControls.UI.EditorRequiredEventHandler(radGridView1_EditorRequired);  // binding event on grid

void radGridView1_EditorRequired(object sender, Telerik.WinControls.UI.EditorRequiredEventArgs e)
        {
            if (this.radGridView1.Columns[1].IsCurrent)
            {
                var a = TextCodes.SingleOrDefault(t => t.Name.Equals(this.radGridView1.CurrentRow.Cells[0].Value));
                if (a == null)
                    return;
                if (a.TextCodeType == TextCodeTypeEnum._datetime)
                {
                    e.Editor = new RadDateTimeEditor();
                    e.EditorType = typeof(RadDateTimeEditor);
                }
                else if (a.TextCodeType == TextCodeTypeEnum._string && a.TextCodeValueList == null)
                {
                    e.Editor = new RadTextBoxEditor();
                    e.EditorType = typeof(RadTextBoxEditor);
                }
                else if (a.TextCodeType == TextCodeTypeEnum._string && a.TextCodeValueList != null)
                {
                    e.Editor = new RadDropDownListEditor();
                    try
                    {
                        ((RadDropDownListEditor)e.Editor).DropDownStyle = Telerik.WinControls.RadDropDownStyle.DropDownList;
                    }
                    catch (System.Exception)
                    {
                    }
                    e.EditorType = typeof(RadDropDownListEditor);
                }
                else if (a.TextCodeType == TextCodeTypeEnum._number)
                {
                    e.Editor = new GridSpinEditor();
                    e.EditorType = typeof(GridSpinEditor);
                }
            }
        }

Dess | Tech Support Engineer, Principal
Telerik team
 answered on 26 Jun 2023
Narrow your results
Selected tags
Tags
GridView
General Discussions
Scheduler and Reminder
Treeview
Dock
RibbonBar
Themes and Visual Style Builder
ChartView
Calendar, DateTimePicker, TimePicker and Clock
Buttons, RadioButton, CheckBox, etc
DropDownList
ComboBox and ListBox (obsolete as of Q2 2010)
ListView
Chart (obsolete as of Q1 2013)
Form
PageView
MultiColumn ComboBox
Menu
RichTextEditor
PropertyGrid
RichTextBox (obsolete as of Q3 2014 SP1)
Panelbar (obsolete as of Q2 2010)
Tabstrip (obsolete as of Q2 2010)
PivotGrid and PivotFieldList
MaskedEditBox
CommandBar
PdfViewer and PdfViewerNavigator
ListControl
Carousel
Diagram, DiagramRibbonBar, DiagramToolBox
Panorama
GanttView
New Product Suggestions
Toolstrip (obsolete as of Q3 2010)
AutoCompleteBox
Label
VirtualGrid
Spreadsheet
ContextMenu
Panel
Visual Studio Extensions
TitleBar
Documentation
SplitContainer
Map
DesktopAlert
ProgressBar
Rotator
TrackBar
MessageBox
CheckedDropDownList
SpinEditor
StatusStrip
CheckedListBox
Wizard
ShapedForm
SyntaxEditor
TextBoxControl
LayoutControl
CollapsiblePanel
Conversational UI, Chat
DateTimePicker
CAB Enabling Kit
TabbedForm
DataEntry
GroupBox
ScrollablePanel
WaitingBar
ImageEditor
ScrollBar
Tools - VSB, Control Spy, Shape Editor
BrowseEditor
DataFilter
ColorDialog
FileDialogs
Gauges (RadialGauge, LinearGauge, BulletGraph)
ApplicationMenu
RangeSelector
CardView
WebCam
BindingNavigator
PopupEditor
RibbonForm
TaskBoard
Barcode
Styling
ColorBox
PictureBox
Callout
VirtualKeyboard
FilterView
Accessibility
DataLayout
NavigationView
ToastNotificationManager
CalculatorDropDown
Localization
TimePicker
ValidationProvider
FontDropDownList
Licensing
BreadCrumb
ButtonTextBox
LocalizationProvider
Dictionary
Overlay
Security
Separator
SparkLine
TreeMap
StepProgressBar
SplashScreen
ToolbarForm
NotifyIcon
Rating
TimeSpanPicker
BarcodeView
Calculator
OfficeNavigationBar
Flyout
TaskbarButton
HeatMap
SlideView
PipsPager
+? more
Top users last month
horváth
Top achievements
Rank 2
Iron
Iron
Steve
Top achievements
Rank 2
Iron
Erkki
Top achievements
Rank 1
Iron
Mark
Top achievements
Rank 2
Iron
Iron
Veteran
Jakub
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
horváth
Top achievements
Rank 2
Iron
Iron
Steve
Top achievements
Rank 2
Iron
Erkki
Top achievements
Rank 1
Iron
Mark
Top achievements
Rank 2
Iron
Iron
Veteran
Jakub
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?