Date: 02-16-2022
Return to Index
created by gbSnippets
'Compilable Example: (Jose Includes)
#Compiler PBWin 9, PBWin 10
#Compile Exe
#Dim All
%Unicode=1
#Include "win32api.inc"
#Include "commctrl.inc"
Global hDlg,hPage1,hPage2,hPage3,hTAB As Dword
Function PBMain() As Long
Dialog New Pixels, 0, "TAB Test",300,300,200,230, %WS_SysMenu, 0 To hDlg
Control Add Tab, hDlg, 500, "", 20,10,150,180
Control Handle hDlg, 500 To hTAB
Tab Insert Page hDlg, 500, 1,0,"Page1" To hPage1
Control Add Label, hPage1, 600, "Page1", 20,20,60,20
Control Add Label, hPage1, 601, "Page1", 20,50,60,20
Control Add Label, hPage1, 602, "Page1", 20,80,60,20
Tab Insert Page hDlg, 500, 2,0,"Page2" To hPage2
Control Add TextBox, hPage2, 603, "Page2", 40,20,60,20
Control Add TextBox, hPage2, 604, "Page2", 40,50,60,20
Control Add TextBox, hPage2, 605, "Page2", 40,80,60,20
Tab Insert Page hDlg, 500, 3,0,"Page3" To hPage3
Control Add TextBox, hPage3, 606, "Page3", 60,20,60,20
Control Add TextBox, hPage3, 607, "Page3", 60,50,60,20
Control Add TextBox, hPage3, 608, "Page3", 60,80,60,20
Dialog Show Modal hDlg Call DlgProc
End Function
CallBack Function DlgProc() As Long
Local HT As TC_HitTestInfo, pt As Point, OldPage, NewPage As Long
Select Case Cb.Msg
Case %WM_Notify
Select Case Cb.NmId
Case 500
Select Case Cb.NmCode
Case %TCN_SelChanging
OldPage = TabCtrl_GetCurSel(hTAB) 'page leaving
GetCursorPos HT.pt : ScreenToClient htab, HT.pt 'pt now has dialog client coordinates
NewPage = SendMessage(hTab, %TCM_HitTest, 0, VarPtr(HT))
If NewPage = 2 Then
Tab Select hDlg, 500, OldPage+1
Function = %True : Exit Function
End If
End Select
End Select
End Select
End Function
'gbs_01156
'Date: 03-14-2012
http://www.garybeene.com/sw/gbsnippets.htm