Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
140
How to add cue banner or hint to UltraTextEditor
posted

I would like to add placeholder text similar to what you see on HTML Inputs.  I am using Net Advantage 2008 v1 in Visual Studio 2010, targeting 3.5.  I can do this with standard Windows Controls with the following:

    Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        CueProvider.SetCueText(TextBox1, "blah")
        CueProvider.SetCueText(TextBox2, "blahblah")
        CueProvider.SetCueText(UltraTextEditor1, "InfraCool") 'Does not work
        CueProvider.SetCueText(UltraTextEditor2, "UltraCool") 'Does not work
    End Sub

 

This is in a separate class:

Imports System.Runtime.InteropServices

Public Class CueProvider
    Private Const EM_SETCUEBANNER As Integer = &H1501

    <DllImport("user32.dll", CharSet:=CharSet.Auto)> _
    Private Shared Function SendMessage(ByVal hWnd As IntPtr, ByVal msg As Integer, ByVal wParam As Integer, <MarshalAs(UnmanagedType.LPWStr)> ByVal lParam As String) As Int32
    End Function

    Public Shared Sub SetCueText(ByVal control As Control, ByVal text As String)
        SendMessage(control.Handle, EM_SETCUEBANNER, 0, text)
    End Sub
End Class

Textbox1 and TextBox2 are just standard Winforms textbox controls.  UltraTexteditor1 and UltraTextEditor2 are Infragistics UltraTextEditors.  The first two controls behave as expected, the Infragistics editors show no cue banner.  I know there are other ways to override the class and set and remove the "placeholder" text, but I've already got a thousand of these in my app.  Is there another property to use, or does this function appear in later releases?

Thank you for your time and attention to this.

 

Parents Reply Children
No Data