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"
#Resource "gbsnippets.pbr"
Global hDlg As Dword, hLst1 As Dword, hLst2 As Dword, hMenu As Dword, hMenuHelp As Dword
Function PBMain() As Long
Dim MyArray(1) As String
MyArray(0) = "Items" : MyArray(1)= "ListBox"
Dialog New Pixels, 0, "Test Code",300,300,600,500, %WS_OverlappedWindow To hDlg
AddToolbar : AddStatusBar : AddListView : AddTreeView : AddTAB
Control Add Button, hDlg, 100,"Button", 20,60,100,20
Control Add Label, hDlg, 110,"Label1", 20,90,120,20
Control Add TextBox, hDlg, 120,"TextBox", 20,120,100,20
Control Add ListBox, hDlg, 130,MyArray() , 20,150,100,100
Control Add ComboBox, hDlg, 140,MyArray(), 20,260, 100,20
Control Add Option, hDlg, 150, "Pick Me!", 20,285, 100,20
Control Add CheckBox, hDlg, 160, "No, Pick Me!", 20, 325, 100,20
Control Add Check3State, hDlg, 170, "Forget them, pick Me!", 20, 350, 120,20
Control Add ScrollBar, hDlg, 180, "", 20, 380, 120,20
Control Add Line, hDlg, 190, "", 20, 420, 100,8 ',%SS_Notify Or %WS_Border
Control Add Progressbar, hDlg, 8200, "", 20, 440, 100,20
Control Add ImgButton, hDlg, 300,"cowgirl", 140,60,100,100
Control Add ImgButtonX, hDlg, 310,"cowgirl", 140,180,100,100
Control Add Image, hDlg, 500,"cowgirl", 270,60,100,100
Control Add ImageX, hDlg, 510,"cowgirl", 270,180,100,100
Control Add Graphic, hDlg, 520,"", 270,300,100,100
Graphic Attach hDlg, 520 : Graphic Render "cowgirl", (0,0)-(100,100)
Control Add Frame, hDlg, 530,"Frame", 400,300,150,50
Dialog Show Modal hDlg Call DlgProc
End Function
CallBack Function DlgProc() As Long
Local pt As Point
Select Case Cb.Msg
Case %WM_Command
Case %WM_Notify
End Select
End Function
Sub AddToolbar
Control Add Toolbar, hDlg, 700,"", 0,0,0,0
ImageList New Icon 16,16,32,3 To hLst1
ImageList Add Icon hLst1, "x" '1
Toolbar Set ImageList hDlg, 700, hLst1, 0
Toolbar Add Button hDlg, 700, 1, 200, %TbStyle_Button, "x"
End Sub
Sub AddStatusBar
Control Add Statusbar, hDlg, 800, "",0,0,0,0
Statusbar Set Parts hDlg, 800, 75,75,99999
Statusbar Set Text hDlg, 800, 1, 0, "one"
Statusbar Set Text hDlg, 800, 2, 0, "two"
Statusbar Set Text hDlg, 800, 3, 0, "three"
End Sub
Sub AddListView
Control Add ListView, hDlg, 900, "", 400,60,150,100
ImageList New Icon 16,16,32,3 To hLst2 'create SMALL imagelist w,h,depth,size
ImageList Add Icon hLst2, "x"
ListView Set ImageList hDlg, 900, hLst2, %lvsil_small
ListView Insert Column hDlg, 900, 1, "test1", 75, 0 'columns hdlg, id&, col, "test", width, format
ListView Insert Item hDlg, 900, 1, 1, "one" 'row 1, col1 'rows hdlg, id&, row, image, "text"
ListView Set Text hDlg, 900, 1,2, "12" 'row1 col2 'items hdlg, id&, row, col, "text"
ListView Set Mode hDlg, 900, 1 '0-icon 1-report 2-small 3-list
End Sub
Sub AddTreeView
Local hItem,hTemp,hTemp2 As Dword
Control Add Treeview, hDlg, 950, "", 400,180,150,100
Treeview Insert Item hDlg, 950, 0, %TVI_Last, 0,0,"Root" To hItem
Treeview Insert Item hDlg, 950, hItem, %TVI_Last, 0,0,"Mother" To hTemp
Treeview Insert Item hDlg, 950, hTemp, %TVI_Last, 0,0,"Dan" To hTemp2
Treeview Set Expanded hDlg, 950, hItem, %True
Treeview Set Expanded hDlg, 950, hTemp, %True
End Sub
Sub AddTab
Local hPage1 As Dword, hPage2 As Dword
Control Add Tab, hDlg, 540, "", 400,370,150,75
Tab Insert Page hDlg, 540, 1,0,"Page1" To hPage1
Control Add Label, hPage1, 550, "Label1", 20,20,60,20
Tab Insert Page hDlg, 540, 2,0,"Page2" To hPage2
Control Add TextBox, hPage2, 560, "Text1", 20,20,60,20
End Sub
'gbs_01184
'Date: 03-25-2012
http://www.garybeene.com/sw/gbsnippets.htm