Author Topic: Double-click message  (Read 5053 times)

0 Members and 1 Guest are viewing this topic.

Offline peaslee

  • Partner Developer
  • Hero Member
  • *****
  • Posts: 1191
  • Location: Site Y
Double-click message
« on: October 29, 2015, 10:35:04 AM »
I am enjoying my new IWGrid project.

Is there a way to process a double click?
Bruce Peaslee
"Born too loose."
iTired (There's a nap for that.)
Well, I headed for Las Vegas
Only made it out to Needles

Offline LarryMc

  • Administrator
  • Hero Member
  • *****
  • Posts: 5897
  • 'All I like is finishing'
Re: Double-click message
« Reply #1 on: October 29, 2015, 12:31:22 PM »
Not without me modifying the code to return a message.
Can you be more specific about why you are needing the double click?
LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library

Offline peaslee

  • Partner Developer
  • Hero Member
  • *****
  • Posts: 1191
  • Location: Site Y
Re: Double-click message
« Reply #2 on: October 29, 2015, 12:45:41 PM »
There is no need to modify the code for just for me.

I have a list of items. I would like to be able to double click on a row and have a dialog open. I currently have a regular button control that will do that, button double-clicking seems intuitive.
Bruce Peaslee
"Born too loose."
iTired (There's a nap for that.)
Well, I headed for Las Vegas
Only made it out to Needles

Offline LarryMc

  • Administrator
  • Hero Member
  • *****
  • Posts: 5897
  • 'All I like is finishing'
Re: Double-click message
« Reply #3 on: October 29, 2015, 05:46:04 PM »
you want to DC on a cell or on a row?
LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library

Offline peaslee

  • Partner Developer
  • Hero Member
  • *****
  • Posts: 1191
  • Location: Site Y
Re: Double-click message
« Reply #4 on: October 30, 2015, 09:04:20 AM »
For this application it would be a row, but in the long run it would not matter.
Bruce Peaslee
"Born too loose."
iTired (There's a nap for that.)
Well, I headed for Las Vegas
Only made it out to Needles

Offline LarryMc

  • Administrator
  • Hero Member
  • *****
  • Posts: 5897
  • 'All I like is finishing'
Re: Double-click message
« Reply #5 on: October 30, 2015, 11:09:06 AM »
I'll look into it for you Bruce.  Might be something real easy.
LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library

Offline LarryMc

  • Administrator
  • Hero Member
  • *****
  • Posts: 5897
  • 'All I like is finishing'
Re: Double-click message
« Reply #6 on: November 24, 2015, 11:48:05 AM »
While looking into the double-click possibility it brought back some old memories from when I was writing the custom control tutorial.
Separating the action of a click and a double click is not a simple process.
In IWG I have already complicated the matter because I have things happening on the left button-down event and I have things happening on the left button-up event to determine if a cell was clicked; a button was clicked;a check box was clicked; an edit has been started; and whether or not a column is being resized.  Trying to fit a double-click in all that mess would make my like a lot more complicated than I want to make it right now.

Now, adding a right click message is a different story.  It appears that shouldn't cause me any grief.  I could add that if that would help you out.  If you don't need that right now I'll put it on my to-do list.  Let me know.
LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library

Offline peaslee

  • Partner Developer
  • Hero Member
  • *****
  • Posts: 1191
  • Location: Site Y
Re: Double-click message
« Reply #7 on: November 24, 2015, 11:53:48 AM »
That's fine. I do not see any need for a right-click message so it can go on the list.

Thanks for taking a look.
Bruce Peaslee
"Born too loose."
iTired (There's a nap for that.)
Well, I headed for Las Vegas
Only made it out to Needles

Offline Brian Pugh

  • Paid Subscriber
  • Hero Member
  • *****
  • Posts: 989
  • Hobby Programmer
Re: Double-click message
« Reply #8 on: November 24, 2015, 12:04:43 PM »
Bruce,

In an application that I have written with IWGrid, I am using the F1 key when a line is highlighted,
rather than not being able to double-click it. In my case, it brings up the database for editing

Brian

Offline peaslee

  • Partner Developer
  • Hero Member
  • *****
  • Posts: 1191
  • Location: Site Y
Re: Double-click message
« Reply #9 on: November 24, 2015, 12:12:44 PM »
Bruce,

In an application that I have written with IWGrid, I am using the F1 key when a line is highlighted,
rather than not being able to double-click it. In my case, it brings up the database for editing

Brian

Not a bad idea. I was thinking of adding F-keys to the buttons for those who are mouse-adverse  ;)

I might also experiment with how far apart two single clicks are to see if that can detect a double click. As I said, things are fine right now so I want to concentrate on the other data elements and of course how to save the data.
Bruce Peaslee
"Born too loose."
iTired (There's a nap for that.)
Well, I headed for Las Vegas
Only made it out to Needles

Offline peaslee

  • Partner Developer
  • Hero Member
  • *****
  • Posts: 1191
  • Location: Site Y
Re: Double-click message
« Reply #10 on: October 16, 2016, 05:33:08 PM »
I am back on this project. When looking at the documentation (yes, I have been known to do that  :D ), I found that the grid control does detect single clicks. I thought to myself that then I should be able to detect double clicks. It turns out that I can. Here is the code.

Code: [Select]
'—————————————————————————————————————————————————————————————————————————————————————————————————————————————————
Sub dlgAGENDA_HANDLER(), int
'-----------------------------------------------------------------------------------------------------------------

Static bool bClicked = false

Select @MESSAGE
'------------------
Case WM_CTLCOLORDLG
Return CreateSolidBrush(DLGCOLOR)
Case @IDINITDIALOG
dlgAgenda_Initialize()
Case @IdTimer
bClicked = false
StopTimer dlgAgenda
Case @IDCONTROL
Select @CONTROLID
Case iwgAgendaItems
If (@NOTIFYCODE == @IWGN_CELLCLICKED)
If (bClicked == true)
bClicked = false
StopTimer dlgAgenda
DoModal dlgItem, dlgAgenda
Else
bClicked = true
StartTimer dlgAgenda, 250 [color=red]'deadline for second click[/color]
EndIf

EndIf
'-----------------------------------
If (@NOTIFYCODE == @IWGN_ROWCHANGED)
dlgAgenda_SetControls()
gCurrentAgendaRow = IWG_GetCurrentRow(dlgAgenda, iwgAgendaItems)
EndIf
Case btnAgendaRecordNonMotion
If (@NOTIFYCODE == BN_CLICKED)
dlgAgenda_RecordNonMotion()
EndIf
Case btnAgendaOpenItem
If @NOTIFYCODE == BN_CLICKED
DoModal dlgItem, dlgAgenda
EndIf
EndSelect
Case @IDMENUPICK
Select @MENUNUM
Case AGENDA_FILE_SHOWMINUTES
wMinutes_WriteMinutes()
ShowWindow wMinutes, @SWSHOW
EndSelect
EndSelect

Return 0
EndSub

Makes me smile. (Hope it works well in production.)
Bruce Peaslee
"Born too loose."
iTired (There's a nap for that.)
Well, I headed for Las Vegas
Only made it out to Needles