Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Multi-Page Tabbed Dialog With Splitter
#2
I think I figured out the problem. The key was adding in the hid all line
for(i 0 ta.len) if(ta[i].hwndwb) hid ta[i].hwndwb ;;hide all
before making things visible.
I also chose CLIPCHILDREN/CLIPSIBLINGS in controls when I could.
It works now as desired.
Thanks so much for making so many good examples on forum to learn from!
S

Function dlg_MultiPage_tabbed_web_browser
Code:
Copy      Help
\Dialog_Editor
function# hDlg message wParam lParam
if(hDlg) goto messages

InitSplitter
out
str controls = "6 7"
str cb6 e7
e7 = "always present element"
if(!ShowDialog("dlg_MultiPage_tabbed_web_browser" &dlg_MultiPage_tabbed_web_browser &controls)) ret

;BEGIN DIALOG
;0 "" 0x92CF0AC8 0x40101 0 0 706 663 "QM tabbed web browser"
;6 ComboBox 0x54230243 0x0 4 28 96 213 ""
;36 QM_Splitter 0x54440000 0x1 122 340 568 24 ""
;7 Edit 0x54030080 0x200 122 50 568 290 ""
;1003 SysTabControl32 0x40040040 0x21 122 347 566 288 "402"
;4 Button 0x54032000 0x0 0 0 110 18 "Show MultiBrowser"
;5 Button 0x54032000 0x0 124 0 88 18 "Hide Browser"
;END DIALOG
;DIALOG EDITOR: "" 0x2030605 "" "0" "" ""

ret
;messages

type TWB_TAB ~path ~name hwndwb
ARRAY(TWB_TAB)- ta
int- iTab
SHDocVw.WebBrowser wbDTWB2
int htb
RECT rct
int- CbIndex

DlgSplitter ds.Init(hDlg 36)

sel message
,case WM_INITDIALOG
,,;specify tabs in CSV format: title, URL.
,,str pagesCSV=
,,;Google, www.google.com
,,;Bing, www.bing.com    
,,;NYT, www.nyt.com
,,;WashPo, www.washingtonpost.com    
,,;Google News, news.google.com
,,;Google Images, images.google.com

,,int- ctrlId            
,,;add tabs
,,ICsv csv=CreateCsv(1); csv.FromString(pagesCSV)
,,htb=id(1003 hDlg)
,,TCITEMW ti.mask=TCIF_TEXT
,,for iTab 0 csv.RowCount
,,,TWB_TAB& r=ta[]
,,,r.path=csv.Cell(iTab 1)
,,,ti.pszText=@csv.Cell(iTab 0)
,,,SendMessage htb TCM_INSERTITEMW iTab &ti        
,,,CB_Add id(6 hDlg) csv.Cell(iTab 0)
,,,TabControlGetClientRect htb hDlg rct
,,,ctrlId=iTab*100+1000 ;;this id will work with DT_Page
,,,r.hwndwb=CreateControl(0 "ActiveX" "SHDocVw.WebBrowser" 0 rct.left rct.top rct.right-rct.left rct.bottom-rct.top hDlg ctrlId)
,,,BringWindowToTop r.hwndwb
,,,ds.AttachControls(1)
,,,wbDTWB2._getcontrol(r.hwndwb)
,,,wbDTWB2.Silent=TRUE
,,,wbDTWB2.Navigate(r.path)

,,iTab=-1
,,SelectTab htb iTab ;;none
,,DT_Page hDlg -1

,case WM_PAINT        
,
,case WM_DESTROY
,
,case WM_SIZE

,
,case WM_COMMAND goto messages2
,case WM_NOTIFY goto messages3
ret
;messages2
sel wParam
,
,case CBN_SELCHANGE<<16|6
,,CbIndex =  CB_SelectedItem(id(6 hDlg))
,,htb=id(1003 hDlg)
,,SelectTab(htb CbIndex)
,,
,case 4

,,CbIndex =  CB_SelectedItem(id(6 hDlg))
,,if(CbIndex<0); CbIndex = 0
,,if(CbIndex>=ta.len); ret
,,CB_SelectItem(id(6 hDlg) CbIndex)

,case 5
,,for(iTab 0 ta.len) if(ta[iTab].hwndwb) hid ta[iTab].hwndwb ;;hide all
,,iTab = -1        
,,DT_Page hDlg -1

ret 1
;messages3
NMHDR* nh=+lParam
sel nh.code
,case TCN_SELCHANGE ;;a tab selected
,htb=nh.hwndFrom
,for(iTab 0 ta.len) if(ta[iTab].hwndwb) hid ta[iTab].hwndwb ;;hide all
,iTab=SendMessage(htb TCM_GETCURSEL 0 0); if(iTab<0 or iTab>=ta.len) ret
,;iTab=i
,&r=ta[iTab]
,if(r.hwndwb)
,,hid- r.hwndwb ;;if the control already created, unhide
,,BringWindowToTop r.hwndwb
,,ds.AttachControls(1)


Messages In This Thread
RE: Multi-Page Tabbed Dialog With Splitter - by stupomer - 04-10-2018, 01:33 AM

Forum Jump:


Users browsing this thread: 1 Guest(s)