September 25, 2022, 11:34:40 PM

News:

Own IWBasic 2.x ? -----> Get your free upgrade to 3.x now.........


Double-click message

Started by Bruce Peaslee, October 29, 2015, 10:35:04 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Bruce Peaslee

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

LarryMc

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

Bruce Peaslee

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

LarryMc

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

Bruce Peaslee

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

LarryMc

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

LarryMc

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

Bruce Peaslee

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

Brian

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

Bruce Peaslee

Quote from: Brian Pugh 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

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

Bruce Peaslee

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.


'â€"â€"â€"â€"â€"â€"â€"â€"â€"â€"â€"â€"â€"â€"â€"â€"â€"â€"â€"â€"â€"â€"â€"â€"â€"â€"â€"â€"â€"â€"â€"â€"â€"â€"â€"â€"â€"â€"â€"â€"â€"â€"â€"â€"â€"â€"â€"â€"â€"â€"â€"â€"â€"â€"â€"â€"â€"â€"â€"â€"â€"â€"â€"â€"â€"â€"â€"â€"â€"â€"â€"â€"â€"â€"â€"â€"â€"â€"â€"â€"â€"â€"â€"â€"â€"â€"â€"â€"â€"â€"â€"â€"â€"â€"â€"â€"â€"â€"â€"â€"â€"â€"â€"â€"â€"â€"â€"â€"â€"â€"â€"â€"â€"
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