Ticket Q483398
Visible to All Users

SelectAll on focus for A RepositoryItemTextEdit and RepositoryItemButtonEdit button state on EditValueChanged

created 12 years ago

Hi,

I was able to create a class that inherited a TextEdit and add it one property, the SelectAllOnFocus:

Visual Basic
Option Strict On Imports DevExpress.XtraEditors Imports System.ComponentModel Public Class XTextEdit Inherits TextEdit Private _AlreadyFocused As Boolean <Category("Behavior")> _ <DefaultValue(False)> _ <Description("On focus, SelectAll")> _ Public Property SelectAllOnFocus As Boolean Protected Overrides Sub OnLeave(e As EventArgs) MyBase.OnLeave(e) If SelectAllOnFocus Then _AlreadyFocused = False End If End Sub Protected Overrides Sub OnGotFocus(e As EventArgs) MyBase.OnGotFocus(e) If SelectAllOnFocus Then If MouseButtons = Windows.Forms.MouseButtons.None Then _AlreadyFocused = True SelectAll() End If End If End Sub Protected Overrides Sub OnMouseUp(e As MouseEventArgs) MyBase.OnMouseUp(e) If Not _AlreadyFocused AndAlso SelectionLength = 0 Then _AlreadyFocused = True SelectAll() End If End Sub End Class

That code works as expected. Now, I'd like to add that same property to a RepositoryItemTextEdit. Since a RITE has none of the events I need, how would I be able to do that?

Thanks for your time.

Answers approved by DevExpress Support

created 12 years ago (modified 12 years ago)

Hi, Marc,
I created a small example for you. This example shows how to integrate your SelectAllOnFocus property in RepositoryItem. Now you can find your property in the yourEditorName.Properties container.
You can find more information on how to create a custom editor in the following KB article:
How to register a custom editor for use in the XtraGrid
If you have any further questions, please let us know.

    Show previous comments (15)
    Yaroslav (DevExpress Support) 12 years ago

      We have updated bug report, please check it. Attached is your updated project.
      I am looking forward to your feedback once you have had an opportunity to review the project.

        Hi Yaroslav,
        Two things:
        1- Link "http://www.devexpress.dev/Support/Center/Issues/ViewIssue.aspx?issueid=B233036&ShowHidden=True" does not exists.
        2- Nothing was attached to your last message…
        Thanks.

        DevExpress Support Team 12 years ago

          Hi Marc,
          Please refer to the following link: Editorbutton descendant doesn't serialize correctly. You can find the most recent information on this issue and a project that Yaroslav mentioned in that thread.
          Feel free to contact us if you have further difficulties. We are happy to help you at any time.

          Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

          Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.