Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Acting on Website elements in a Tabbed Dialog WebBrowser
#2
Function dlg_simple_web_browser2
Code:
Copy      Help
\Dialog_Editor
function# hDlg message wParam lParam
if(hDlg) goto messages

;BEGIN DIALOG
;0 "" 0x10CB0A40 0x100 0 0 507 522 ""
;3 SysTabControl32 0x56080240 0x0 2 40 506 642 ""
;77 Button 0x54032000 0x0 542 690 24 14 ">>|"
;6 Button 0x54032000 0x0 456 6 48 30 "Close"
;END DIALOG
;DIALOG EDITOR: "" 0x2030208 "" "" ""

if(!ShowDialog("dlg_simple_web_browser2" &dlg_simple_web_browser2)) ret
ret
;messages
SHDocVw.WebBrowser c
sel message
,case WM_INITDIALOG
,int htbJB=id(3 hDlg)
,TCITEM ti.mask=WINAPI.TCIF_TEXT
,ti.pszText="Google"
,SendMessage htbJB WINAPI.TCM_INSERTITEMA 0 &ti
,ti.pszText="Yahoo"
,SendMessage htbJB WINAPI.TCM_INSERTITEMA 1 &ti
,ti.pszText="QuickMacros.Com"
,SendMessage htbJB WINAPI.TCM_INSERTITEMA 2 &ti
,SelectTab htbJB 2 ;;none
,
,case WM_DESTROY
,case WM_COMMAND goto messages2
,case WM_NOTIFY goto messages3
ret
;messages2
c._getcontrol(child("" "ActiveX" hDlg)); err
sel wParam
,case 5 ;;Go
,str a.getwintext(id(4 hDlg))
,c.Navigate(a); err
,
,case 6
,c.GoBack; err

,case IDOK
,but 5 hDlg ;;on Enter press GO
,ret 0 ;;disable closing on Enter
,case IDCANCEL
,ifk(Z) ret 0 ;;disable closing on Esc
ret 1
;messages3
NMHDR* nh=+lParam
sel nh.code
,case WINAPI.TCN_SELCHANGE
,int htb=nh.hwndFrom
,int iTab=SendMessage(htb TCM_GETCURSEL 0 0)
,RECT rct; GetClientRect htb &rct; SendMessage htb TCM_ADJUSTRECT 0 &rct; MapWindowPoints htb hDlg +&rct 2
,int ctrlId=iTab*100+1000 ;;this id will work with DT_Page
,int isNewTab t=id(ctrlId hDlg)
,if(!t) t=CreateControl(0 "ActiveX" "SHDocVw.WebBrowser" 0 rct.left rct.top rct.right-rct.left rct.bottom-rct.top hDlg ctrlId); isNewTab=1
,DT_Page hDlg iTab
,BringWindowToTop t
,if isNewTab
,,str urls=
,,;http://www.google.com
,,;http://www.yahoo.com
,,;http://www.quickmacros.com
,,str url.getl(urls iTab)
,,url.setwintext(t)
,sel iTab
,,case 0;
,,opt waitmsg 1 ;;always use this in dialogs before a wait function
,,Htm GoogleSearchField=htm("INPUT" "q" "" t 0 2 0x221 3)
,,GoogleSearchField.SetText("Sample Search")
,,Htm GoogleSearchButton=htm("INPUT" "btnG" "" t 0 3 0x221 3)
,,GoogleSearchButton.Click


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)