Date: 02-16-2022
Return to Index
created by gbSnippets
'Change the icon on the TAB page
'Compiler Comments:
'This code is written to compile in PBWin10. To compile in PBWin9, add this line:
#Include "commctrl.inc"
'Compilable Example: (Jose Includes)
#Compiler PBWin 9, PBWin 10
#Compile EXE
#Dim All
%Unicode=1
#Include "win32api.inc"
#Resource "gbsnippets.pbr"
%IDC_Tab = 500
Global hDlg, hImgListTab, hTab As Dword
Function PBMain() As Long
Dim hPage1 As Long, hPage2 As Long
Dialog New Pixels, 0, "TAB Test",300,300,250,200, %WS_SysMenu, 0 To hDlg
Control Add Button, hDlg, 200, "Press", 20,125,50,25
'tab control
Control Add Tab, hDlg, 500, "", 20,20,200,75
Control Handle hDlg, %IDC_TAB To hTab
'imagelist
ImageList New Icon 8,8,24,2 To hImgListTab ' w,h,depth,size
ImageList Add Icon hImgListTab, "add" '1
ImageList Add Icon hImgListTab, "minus" '2
Tab Set ImageList hDlg, %IDC_Tab, hImgListTab
'pages
Tab Insert Page hDlg, 500, 1,1,"Page1" To hPage1
Tab Insert Page hDlg, 500, 2,2,"Page2" To hPage2
Dialog Show Modal hDlg Call DlgProc
End Function
CallBack Function DlgProc() As Long
If Cb.Msg = %WM_Command And Cb.Ctl = 200 And Cb.CtlMsg = %BN_Clicked Then
Local xtcItem As TC_ITEM
Static iImage As Long
iImage = iImage Xor 1
xtcItem.mask = %TCIF_Image
xtcItem.iImage = iImage
SendMessage hTab, %TCM_SETITEM, 0, VarPtr(xtcItem)
SendMessage hTab, %TCM_SETITEM, 1, VarPtr(xtcItem)
End If
End Function
'gbs_00806
'Date: 03-10-2012
http://www.garybeene.com/sw/gbsnippets.htm