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"
Global hDlg, hListBox As Dword, OldProc As Long
%IDC_ListBox = 500
%IDC_Button = 501
%IDC_TextBox = 502
Function PBMain() As Long
Dialog New Pixels, 0, "Test Code",300,300,200,200, %WS_OverlappedWindow To hDlg
Control Add Button, hDlg, %IDC_Button, "Find", 10,10,50,20
Control Add TextBox, hDlg, %IDC_TextBox, "Row18", 70,10,100,20
Control Add ListBox, hDlg, %IDC_ListBox, , 10,40,180,160, %WS_VScroll Or %LBS_Notify, %WS_Ex_ClientEdge
Control Handle hDlg, %IDC_ListBox To hListBox
Dialog Show Modal hDlg Call DlgProc
End Function
CallBack Function DlgProc() As Long
Local i, iPos As Long, tempZ As AsciiZ * 50
Select Case Cb.Msg
Case %WM_InitDialog
For i = 0 To 100 : ListBox Add hDlg, %IDC_ListBox, "Row" + Format$(i,"00") : Next
Case %WM_Command
Select Case Cb.Ctl
Case %IDC_Button
Control Get Text hDlg, %IDC_TextBox To tempZ
iPos = SendMessage(hListBox, %LB_FindStringExact, -1, VarPtr(tempZ))
SendMessage hListBox, %LB_SetTopIndex, iPos, 0
End Select
End Select
End Function
'gbs_01119
'Date: 03-10-2012
http://www.garybeene.com/sw/gbsnippets.htm