Hi Everybody,
The attached code shows the use of Super and Sub classing. Nothing really interesting is really going on here, it's basically a demo derived from Iczelion's Tutorials.
One thing did I want to add to my programs is the ability to 'tab' between edit boxes on a dialog box. You see this all the time in Windows applications and wanted to be able to do the same. So, I subclass an edit box and trap for the tab key being pushed. When it is, I can invoke SetFocus to the next box. But in coding this up, I realize that it will only work with Subclassed edit boxes. I can't add this to a Superclassed edit box as there is only one procedure, how to I know which of the Superclassed boxes I am in and how can I direct it to the next one?
When you see a Windows application where you can tab between edit boxes, have they all been Subclassed to allow that. Or is there a another or 'correct' way to handle tabbing between options in ASM?
Regards,
Lightman
Use IsDialogMessage in message loop.
Ah, Thanks Tim...
A little like where I trap the colour change in the parent dialog. In my SuperClassed procedure I can call IsDialogMessage to get the handle of which SuperClassed box is talking. Then just trap it out... .if eax==hHandleOfBox1 invoke SetFocus hHandleOfBox2.. and so on...?
Regards,
Lightman
Hi,
I think this might be it, but my code is wrong somewhere... My trap for the tab key...
.elseif al==VK_TAB
; The tab key has been pushed but who is talking?
invoke IsDialogMessage, hManyEdit, addr msgMyMessage
mov eax, msgMyMessage.hwnd ; Who was it? Handle of the talking control.
; Got the handle, get the next in the list...
invoke GetNextDlgTabItem, hManyEdit, eax, FALSE
invoke SetFocus, eax
.endif
When I created the two SuperClassed windows, I've added the WS_TABSTOP to the window style.
Can anyone nudge me in the right direction? - I've attached the full code...
Regards,
Lightman
read up on WS_GROUP and WS_TABSTOP window styles
https://msdn.microsoft.com/en-us/library/windows/desktop/ms632600%28v=vs.85%29.aspx (https://msdn.microsoft.com/en-us/library/windows/desktop/ms632600%28v=vs.85%29.aspx)
I mean like this C example while (GetMessage(&msg, NULL, 0, 0) == TRUE)
{
if (!IsDialogMessage(hWnd, &msg))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
}