Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
'TAB' key in web control
#1
I can't get the tab key to traverse a web form using the SHDocVw.WebBrowser control.
I am using a nonmodal declaration :
Code:
Copy      Help
str controls = "3"
str ax3SHD = ""
int hDlg = ShowDialog("kMain_Dlg" &kMain_Dlg &controls 0 1 WS_VISIBLE 0 0 -1 -1)
MessageLoop

The dialog :
Code:
Copy      Help
;\Dialog_Editor
function# hDlg message wParam lParam
if(hDlg) goto messages

;BEGIN DIALOG
;0 "" 0x90CF0A44 0x110 0 0 454 287 "K H E M U :::: Webmail"
;3 ActiveX 0x54000000 0x10 16 40 422 232 "SHDocVw.WebBrowser"
;1 Button 0x54030001 0x4 306 8 48 14 "OK"
;2 Button 0x54030000 0x4 368 8 48 14 "Cancel"
;END DIALOG
;DIALOG EDITOR: "" 0x2020002 "" ""


ret
;messages
sel message
,case WM_INITDIALOG
,,MSHTML.HTMLDocument doc
,,doc=DT_GetHtmlDocument(hDlg 3)
,,doc.open("text/html")
,,;create html
,,str form.getmacro("login")
,,_s.format("%s\images\" CURDIR)
,,form.replacerx("QMIMAGEPATH/" _s)

,,doc.write(form) ;;variable number of arguments

,,out form
,,MSHTML.HTMLInputElement te=+doc.getElementById("user")
,,doc.focus
,,te.focus
,
,,MSHTML.HTMLInputElement- btn=+doc.getElementById("Login")
,,btn._setevents("btn_HTMLEvents")

,case WM_SIZE
,,kResizeMain(hDlg)
,
,case WM_DESTROY
,case WM_COMMAND goto messages2
ret
;messages2
sel wParam
,case IDOK
,case IDCANCEL
ret 1
#2
Tab works for me. Maybe you need to upgrade QM. Navigation in web browser control did not work before QM 2.2.0 probably.

------

Tab does not work in nonmodal dialogs when you try to navigate between controls that are not in web browser control. To enable keyboard navigation in nonmodal dialogs, MessageLoop must call IsDialogMessage. Here is updated MessageLoop version:

Code:
Copy      Help
;/
function# [notmain]

;Standard message loop.
;Returns when the thread receives WM_QUIT message (when destroying main window, call PostQuitMessage(0)), or message 2000.
;notmain must be nonzero if the message loop is not the main message loop of the thread.
;Thread with message loop should not use "wait" or "wait for" commands with long wait time, unless opt waitmsg 1 is set.



MSG m
rep
,if(GetMessage(&m 0 0 0)<1 or m.message=2000)
,,if(notmain and m.message=WM_QUIT) PostQuitMessage(m.wParam)
,,ret m.wParam
,if(IsDialogMessage(GetActiveWindow &m)) continue
,TranslateMessage &m
,DispatchMessage &m

------

More about nonmodal dialogs and MessageLoop:

When you close the dialog, MessageLoop does not return. You still can see the main function in Threads dialog. To tell MessageLoop to return when you close the dialog, on WM_DESTROY call PostQuitMessage or post message 2000.

Code:
Copy      Help
,case WM_DESTROY
,;use one of the following to end MessageLoop when you close the dialog
,;PostQuitMessage 0 ;;use this if you will not need to continue the thread after MessageLoop returns
,PostThreadMessage GetCurrentThreadId 2000 0 0 ;;use this if you will need to continue the thread
#3
Excellent ...as always..
Thx G !


Forum Jump:


Users browsing this thread: 1 Guest(s)