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, hAbout As Dword
Function PBMain() As Long
Dialog New Pixels, 0, "Test Code",300,300,300,200, %WS_OverlappedWindow To hDlg
' Control Add Button, hDlg, 500, "Main", 20,20,50,50
Dialog Show Modal hDlg Call DlgProc
End Function
CallBack Function DlgProc() As Long
Static LostFocus, iCount As Long
Select Case Cb.Msg
Case %WM_InitDialog
Dialog New Pixels, 0, "About gbSnippets", 125, 125, 300, 200, %WS_SysMenu Or %WS_Caption To hAbout
' Control Add Button, hAbout, 501, "About", 20,20,50,50
Dialog Show Modeless hAbout Call AboutProc
LostFocus = 0
Case %WM_SetCursor
' Incr iCount : Dialog Set Text hDlg, Str$(iCount)
If LostFocus Then SetFocus hDlg
LostFocus = 0
Case %WM_SetFocus
If LostFocus = 1 Then Dialog Set Text hDlg, Time$ + " Yippee, I got focus!"
Case %WM_KillFocus
If LostFocus = 0 Then Dialog Set Text hDlg, Time$ + " Bummer, I lost focus!"
LostFocus = 1
End Select
End Function
CallBack Function AboutProc() As Long
Static LostFocus, iCount As Long
Select Case Cb.Msg
Case %WM_InitDialog
LostFocus = 0
Case %WM_SetCursor
' Incr iCount : Dialog Set Text hAbout, Str$(iCount)
If LostFocus Then SetFocus hAbout
LostFocus = 0
Case %WM_SetFocus
If LostFocus = 1 Then Dialog Set Text hABout, Time$ + " Yippee, I got focus!"
Case %WM_KillFocus
If LostFocus = 0 Then Dialog Set Text hABout, Time$ + " Bummer, I lost focus!"
LostFocus = 1
End Select
End Function
'gbs_01030
'Date: 03-10-2012
http://www.garybeene.com/sw/gbsnippets.htm