Trouble with Click and DblClick

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • MFC

    Trouble with Click and DblClick

    Hi

    I'm from Denmark so I hope you understand my English. Well, I have a filebox
    and when I click on a picture-file, then I have a small picturebox, where I
    can preview the file. When I double-click on a file, then should the program
    load the file to a editor, but no matter how fast I double-click, then the
    filebox assume it's a single click. How can I use the Click and the DblClick
    with the filebox control ?? I hope someone is able to help me and thanks
    for reading my post.

    Oh yes, I use VB 6.0


    Sincerely,
    Mikael Gitt
    # slotgitt #



  • Raoul Watson

    #2
    Re: Trouble with Click and DblClick


    "MFC" <slotgitt@post. tele.dk> wrote in message
    news:42dcfc79$0 $23503$edfadb0f @dread16.news.t ele.dk...[color=blue]
    > Hi
    >
    > I'm from Denmark so I hope you understand my English. Well, I have a[/color]
    filebox[color=blue]
    > and when I click on a picture-file, then I have a small picturebox, where[/color]
    I[color=blue]
    > can preview the file. When I double-click on a file, then should the[/color]
    program[color=blue]
    > load the file to a editor, but no matter how fast I double-click, then the
    > filebox assume it's a single click. How can I use the Click and the[/color]
    DblClick[color=blue]
    > with the filebox control ?? I hope someone is able to help me and[/color]
    thanks[color=blue]
    > for reading my post.
    >[/color]

    Well, the single click will always be executed, which is OK because if the
    intent of the user is double click, first it will execute the single click
    (which according to you shows a "preview / thumb" image) and then if the
    user continues, it will load the file.

    Using the example below, you will see that the *FINAL* result is what is
    intended.

    Private Sub File1_Click()
    Label1.Caption = "Single"
    End Sub

    Private Sub File1_DblClick( )
    Label1.Caption = "Double"
    End Sub


    Comment

    • David Rice, Esq.

      #3
      Re: Trouble with Click and DblClick

      On Tue, 19 Jul 2005 15:13:12 +0200, "MFC" <slotgitt@post. tele.dk>
      wrote:
      [color=blue]
      >Hi
      >
      >I'm from Denmark so I hope you understand my English. Well, I have a filebox
      >and when I click on a picture-file, then I have a small picturebox, where I
      >can preview the file. When I double-click on a file, then should the program
      >load the file to a editor, but no matter how fast I double-click, then the
      >filebox assume it's a single click. How can I use the Click and the DblClick
      >with the filebox control ?? I hope someone is able to help me and thanks
      >for reading my post.
      >
      >Oh yes, I use VB 6.0[/color]

      Greetings. You might wish to do a "work-around." You can assign a
      variable that holds the file name for the image that is already
      being displayed, and if subsequent Click events match that file
      name, call the DblClick event.

      Dim DisplayedImageN ame As String

      Private Sub File1_Click()
      If File1.List(File 1.ListIndex) = DisplayedImageN ame Then
      File1_DblClick

      DisplayedImageN ame = File1.List(File 1.ListIndex)
      Set Picture1.Pictur e = LoadPicture(Dis playedImageName )
      End Sub

      Private Sub File1_DblClick( )
      EditRoutime DisplayedImageN ame
      End Sub


      [color=blue]
      >Sincerely,
      >Mikael Gitt
      ># slotgitt #[/color]

      Comment

      • J French

        #4
        Re: Trouble with Click and DblClick

        On Tue, 19 Jul 2005 15:13:12 +0200, "MFC" <slotgitt@post. tele.dk>
        wrote:
        [color=blue]
        >Hi
        >
        >I'm from Denmark so I hope you understand my English. Well, I have a filebox
        >and when I click on a picture-file, then I have a small picturebox, where I
        >can preview the file. When I double-click on a file, then should the program
        >load the file to a editor, but no matter how fast I double-click, then the
        >filebox assume it's a single click. How can I use the Click and the DblClick
        >with the filebox control ?? I hope someone is able to help me and thanks
        >for reading my post.[/color]

        You could try doing something like this :-

        Private Sub File1_Click()
        Timer1.Interval = 500
        Timer1.Enabled = True
        End Sub

        Private Sub File1_DblClick( )
        Timer1.Enabled = False
        Me.Print "Double"
        End Sub

        Private Sub Timer1_Timer()
        Timer1.Enabled = False
        Me.Print "Click"
        End Sub

        You should really get the system's DoubleClickTime

        Private Declare Function GetDoubleClickT ime _
        Lib "user32" () As Long



        Comment

        Working...