Link to home
Start Free TrialLog in
Avatar of Blondie050798
Blondie050798

asked on

Subclassed CFileDialog - Double click?

I have a subclassed cfiledialog which displays an image preview window.  When a file is selected, the window displays it.  Trouble is, when dealing with large files (15MB+) this obviously takes a while, and is annoying when you know which file you want, and simply want to double click on it to load it, without the OnFileNameChange()getting called to display the preview.

I guess what I am saying is that I need to be able to tell when I have a single click or double click in the edit, so that when OnFileNameChange() is called I can either display the preview or ignore it...
Avatar of jstolan
jstolan

If I'm not mistaken the window is actually a list control and not an edit.  I think the message you want to look at is the WM_NOTIFY class which passes messages to the parent from the child control.  Take a look at NM_CLICK and NM_DBLCLICK.
Avatar of Blondie050798

ASKER

Rather short answer, but jolted me in the correct direction..
Trouble is the messages never get there..?
I put the following in my message map...

ON_NOTIFY(NM_CLICK, lst2, OnSingleClick)
ON_NOTIFY(NM_DBLCLK, lst2, OnDoubleClick)



Hmmm

I'm not sure why that message wouldn't be received.  I looked back at the documentation and didn't see anything obvious.  I suspect that the CFileDialog base class is handling the message and you may need to override an existing function.

I suppose you've tried overriding OnFileNameChange?

By the way sorry about the short answer, but I haven't tried this exact thing myself.  As you said, I was just trying to point you in the right direction.
OnFileNameChange() is overridden and being called..but gets called each time a click occurs..ie. once for the single click and twice for the double...

I would like to get the click messages (cos it would make my life easy...)  Otherwise I guess I would need to create a thread or timer to check the duration between successive calls to OnFileNameChange()...and based on the duration I can predict that a single click or double click has occurred...seems rather nasty though :-(
ASKER CERTIFIED SOLUTION
Avatar of jstolan
jstolan

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
You're right...I don't like it...I've had to write a hock for a filedialog before...I didn't like it then, and I still don't...guess I was looking for a nice clean simple answer that doesn't exist... :-(  Still, 'an answer' is better than none...
Thanks for your help :-)