Results 1 to 5 of 5

Thread: [RESOLVED] [2.0] Rename DoubleClick (Delayed DoubleClick)

  1. #1

    Thread Starter
    Fanatic Member LITHIA's Avatar
    Join Date
    Dec 2002
    Location
    UK, England
    Posts
    575

    Resolved [RESOLVED] [2.0] Rename DoubleClick (Delayed DoubleClick)

    Hi everyone,

    I was just working on my program and I'm implementing a Rename ability.

    At the moment the user has to right click the item and choose rename in order to rename it, but I'd like it so the user can also do a slow double click (like you do in Windows Explorer to rename a file), where you click the the item, wait a second or so and click it again.

    I was expecting VS to have this built in as a mouse event, however... I can't see it. All I can see is a normal click and a normal double click.

    Does anyone know of this "Delayed Double Click"? I guess it probably isn't built into VS.

    If it isn't, I'll be happy to make my own method using a timer (I'll figure something out). I just wanted to make sure there isn't already this method somewhere before I go writing my own. Anyone already written one?

    Thanks very much!

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: [2.0] Rename DoubleClick (Delayed DoubleClick)

    There's no such thing as a slow double-click. There are only clicks and double-clicks. Windows Explorer just uses a ListView with its Activation property set to Standard and its LabelEdit property set to True (or at least the unmanaged equivalent to that). Try creating one yourself and you'll see that two single clicks on an item will start editing its label. It's in-built functionality of the ListView. Clicking an item that is not selected will select it, while clicking an item that is selected will start editing it.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  3. #3

    Thread Starter
    Fanatic Member LITHIA's Avatar
    Join Date
    Dec 2002
    Location
    UK, England
    Posts
    575

    Re: [2.0] Rename DoubleClick (Delayed DoubleClick)

    Wow! I never knew about the LabelEdit property. Thanks very much jmcilhinney!

    I guess my method that I wrote is obsolete now. I was using some complex code to put a textbox into the label's place, and then using events to re-name the listitem when the textbox's "Leave" event was fired.

    Now I feel silly. I wish I knew about the LabelEdit beforehand.

    Only one question with this though... Is there a way to manually fire it?

    I have the option (on a context menu) to rename the listitem, and I'd like to keep this as an alternative to rename it. Is there a way to fire the LabelEdit?

    I was guessing it might have been fired when the listitem was activated, but I didn't see an Activate method to do that manually.

    Thanks!

  4. #4
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: [2.0] Rename DoubleClick (Delayed DoubleClick)

    It's important that if you want to do something with a class that you read the help topic for that class and its member listing. When you do that the answer to your question is often obvious.
    Attached Images Attached Images  
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  5. #5

    Thread Starter
    Fanatic Member LITHIA's Avatar
    Join Date
    Dec 2002
    Location
    UK, England
    Posts
    575

    Re: [2.0] Rename DoubleClick (Delayed DoubleClick)

    Quote Originally Posted by jmcilhinney
    It's important that if you want to do something with a class that you read the help topic for that class and its member listing. When you do that the answer to your question is often obvious.
    Ok sorry, I had checked the ListViewItem properties and didn't see the BeginEdit. I'm at College and don't have access to the help files, so I quickly checked on MSDN and was searching for LabelEdit. I would probably have found it straight away if I had been at home.

    Thanks for the help.

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