Results 1 to 2 of 2

Thread: edit text label

  1. #1

    Thread Starter
    New Member
    Join Date
    Feb 1999
    Posts
    1

    Post

    Does any one know how to create a editable text field like one that appears in a treeview or a listview control? It can also be seen in the windows explorer or desktop under a file icon. Is there an API function?

  2. #2
    Frenzied Member
    Join Date
    Jan 2000
    Location
    Bellevue, WA, USA
    Posts
    1,357

    Post

    Here's kind of a silly way to replicate the feature, but I'm sure there is a much better way...

    Create a form with a single textbox (Text1) and some other control to switch the focus to. Then add the following to the form's code module:

    Code:
    Option Explicit
    
    Private Sub Form_Load()
    
        With Text1
            .BackColor = Me.BackColor
            .BorderStyle = 0
            .Appearance = 0
            .TabStop = False
        End With
        
        'SomeOtherControl.SetFocus
    
    End Sub
    
    Private Sub Text1_Click()
    
        With Text1
            .BackColor = vbWindowBackground
            .BorderStyle = vbFixedSingle
            .SelStart = 0
            .SelLength = Len(.Text)
        End With
            
    End Sub
    
    Private Sub Text1_KeyPress(KeyAscii As Integer)
    
        If KeyAscii = 13 Then
            'SomeOtherControl.SetFocus
        End If
            
    End Sub
    
    Private Sub Text1_LostFocus()
            
            With Text1
                .BackColor = Me.BackColor
                .BorderStyle = 0
            End With
    
    End Sub
    Hope that helps a little!

    ~seaweed

    [This message has been edited by seaweed (edited 02-03-2000).]

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width