August 31st, 2012, 07:13 AM
How to catch TAB in ATL Dialog
In short I have an ATL Dialog, which contains a listview created at runtime as a contained window. I have added an editing option to it by creating an edit box over the cell user selects (again created at runtime as a contained window). Up to this point everything works well.
What I need next is the to use tab to move to the "next cell" (ie. terminate editing and move it over the next cell in the list view). This however falls to a simple, yet vexing, problem where I can not trap the TAB key. I can catch the ENTER for example, which I use to terminate the editing and save the value, but TAB does not even enter WM_NOTIFY, WM_CHAR nor WM_KEYDOWN.
I have studied this quite a bit and found some juicy looking examples but every one of them falls to some small problem which I can not solve. I am not really an expert on WIN API programming, so it may well be that the answer is simple and I just can't see it.
The most vexing part is that many who ask about catching TAB want to move between EXISTING components thus their solutions end up having nothing to do with actually catching the TAB, which is what I really need as I am working with a single dynamically created CEdit box.
I have been trying to get a Hook to do this for me as on article I found suggested that in ATL it is the only way to catch the TAB. However while I can make the hook work, it apparently needs to be a static function and thus I can not access the few non static methods I need to move the edit box to it's new location.
So help? Please?
Tags for this Thread
Click Here to Expand Forum to Full Width
This is a Codeguru.com survey!