Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Handling double click in Windows Forms.  (Read 3023 times)

0 Members and 1 Guest are viewing this topic.

Khepri

  • Newbie
  • *
  • Posts: 3
    • View Profile
Handling double click in Windows Forms.
« on: December 04, 2013, 07:47:38 am »
Hi,
I'm trying to solve this problem for hours and I haven't found a solution yet. I want to use SFML on a windows forms application, my application runs very well, I've handled a RenderWindow inside of a label using that in form_load Method :
 window = gcnew RenderWindow(lblWindow->Handle);
                                 window->MouseButtonPressed += gcnew EventHandler<SFML::Window::MouseButtonEventArgs^ >(this, &frmPrincipale::OnMouseButtonPressed);
 
That works fine, except for a point... when the label is double clicked, the program does nothing, what I want is to execute the OnClick method 2 times. Is there a way I can handle double click in a label? I've tried to handle on another window like that :
window = gcnew RenderWindow(VideoMode(480, 206), "SFML Window");
and it works fine. How can I do that in a label?
Thanks a lot.
Khepri.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: Handling double click in Windows Forms.
« Reply #1 on: December 04, 2013, 08:32:12 am »
I don't know, maybe the label processes the second click itself and cancels the event (at the OS level), so that it cannot be interpreted as a second single click?

Maybe you can configure your label to not react to double-clicks.
Laurent Gomila - SFML developer

wintertime

  • Sr. Member
  • ****
  • Posts: 255
    • View Profile
Re: Handling double click in Windows Forms.
« Reply #2 on: December 04, 2013, 12:09:22 pm »
I would bet the window you reuse the handle from was created from a class with CS_DBLCLKS style and SFML ignores double click messages, cause of the assumption of creating the window itself without this, while not caring as much for the option to reuse a window handle as nearly noone uses it.
That should be an easy fix inside SFML, just add those message identifiers to the switch statement where the normal clicks are processed, to avoid having them lost.

Khepri

  • Newbie
  • *
  • Posts: 3
    • View Profile
Re: Handling double click in Windows Forms.
« Reply #3 on: December 04, 2013, 11:33:18 pm »
How can I do that?
Thanks a lot.

 

anything