ListView - Editing a label as an icon is added 
Author Message
 ListView - Editing a label as an icon is added

Hello,

Can someone give me an example of how to select listitem text for editing after
an icon has been added to a listview control?

I have tried every possible way of doing this, but I only get as far as having
the icon be selected after adding it and then being able to edit it after
clicking it. I want to mimic the behavior when creating a "New Folder" in
Windows.

I have set LabelEdit to lvwAutomatic. I have also tried using StartLabelEdit
and along with _BeforeLabelEdit but haven't had any luck.

If someone could give me a quick example, I would appreciate it.

Thanks!

Anthony



Wed, 04 Jul 2001 03:00:00 GMT  
 ListView - Editing a label as an icon is added


Fri, 19 Jun 1992 00:00:00 GMT  
 ListView - Editing a label as an icon is added
never mind, I must've brainfarted. DoEvents solved my problem...

    Set itmx = lvwICON.ListItems.Add
    lvwICON.StartLabelEdit
    With itmx
        .Text = "New Product"
        .Icon = 2

    End With

    DoEvents

    lvwICON.StartLabelEdit


says...

Quote:

>Hello,

>Can someone give me an example of how to select listitem text for editing
after
>an icon has been added to a listview control?

>I have tried every possible way of doing this, but I only get as far as having
>the icon be selected after adding it and then being able to edit it after
>clicking it. I want to mimic the behavior when creating a "New Folder" in
>Windows.

>I have set LabelEdit to lvwAutomatic. I have also tried using StartLabelEdit
>and along with _BeforeLabelEdit but haven't had any luck.

>If someone could give me a quick example, I would appreciate it.

>Thanks!

>Anthony




Wed, 04 Jul 2001 03:00:00 GMT  
 ListView - Editing a label as an icon is added


Fri, 19 Jun 1992 00:00:00 GMT  
 ListView - Editing a label as an icon is added
Private Sub Command1_Click()

    Dim itmX As ListItem
    Dim imgX As ListImage

   'add the empty string
    Set itmX = ListView1.ListItems.Add(, , "")

   'assign an icon (optional)
    itmX.SmallIcon = ImageList1.ListImages(1).Index

   'if the item was added
    If itmX.Index Then

      'set focus to the listview
       ListView1.SetFocus

      'set the current item to the new index
       Set ListView1.SelectedItem = itmX

      'start the label edit
       ListView1.StartLabelEdit

    End If

   'free the variables
    Set itmX = Nothing
    Set imgX = Nothing

End Sub

--

Randy Birch, MVP Visual Basic

http://www.mvps.org/vbnet/
http://www.mvps.org/ccrp/

To assist in maintaining this thread for the benefit of
others, please post any response to this newsgroup.

Quote:

>Hello,

>Can someone give me an example of how to select listitem text for editing
after
>an icon has been added to a listview control?

>I have tried every possible way of doing this, but I only get as far as
having
>the icon be selected after adding it and then being able to edit it after
>clicking it. I want to mimic the behavior when creating a "New Folder" in
>Windows.

>I have set LabelEdit to lvwAutomatic. I have also tried using
StartLabelEdit
>and along with _BeforeLabelEdit but haven't had any luck.

>If someone could give me a quick example, I would appreciate it.

>Thanks!

>Anthony




Thu, 05 Jul 2001 03:00:00 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. WM_NOTIFY of ListView's Edit Control (during label edit)

2. Label Edit in Listview

3. Edit Listview labels

4. Listview label editing

5. Label edit in Listview

6. ListView - Editing Labels

7. ListView - editing Labels - HELP

8. Label Edit in new ListView control ???

9. Magic with Listview label editing.

10. How to add edit functionality to the ListView control

11. Adding icons to a Listview object

12. Adding icons to ListView boxes

 

 
Powered by phpBB® Forum Software