Page 1 of 1
Callback, Windows being stupid? (or PB?)
Posted: Sat Mar 05, 2005 11:47 pm
by TimmyTom
Code: Select all
Procedure CheckFocus(WinID.l, message, wParam, lParam)
Result = #PB_ProcessPureBasicEvents
Select message
Case #WM_SETFOCUS
Debug "got focus"
Case #WM_KILLFOCUS
Debug "lost focus"
EndSelect
ProcedureReturn Result
EndProcedure
A simple callback to check focus.. you'd think...
What happens is that when i change tab in my tabber gadget, it tells me that my window lost focus...
what's going on here? and how do i detect that my window looses focus (instantly i need to know this when it happens) without just changing tabs in the app telling me that my window (in which this tabber resides) has lost focus?
Tim
Posted: Sun Mar 06, 2005 12:09 am
by Sparkie
If you're using #WM_KILLFOCUS and #WM_SETFOCUS, you'll have to check wParam and only react to the handle to your app's window. Otherwise you'll be catching keyboard focus activity for gadgets as well.
Try catching #WM_ACTIVATEAPP instead.
Code: Select all
#MainWindow = 0
Procedure MyWindowCallback(hWnd.l, msg.l, wParam.l, lParam.l)
result = #PB_ProcessPureBasicEvents
Select msg
Case #WM_ACTIVATEAPP
Select wParam
Case #True
Debug "Received focus"
Case #False
Debug "Lost focus"
EndSelect
EndSelect
ProcedureReturn result
EndProcedure
If OpenWindow(#MainWindow, 0, 0, 322, 150, #PB_Window_SystemMenu|#PB_Window_ScreenCentered, "#WM_ACTIVATEAPP") And CreateGadgetList(WindowID(0))
SetWindowCallback(@MyWindowCallback())
PanelGadget(0, 0, 0, 322, 150)
AddGadgetItem(0, 0, "Tab 0")
AddGadgetItem(0, 1, "Tab 1")
CloseGadgetList()
Repeat : Until WaitWindowEvent() = #PB_Event_CloseWindow
EndIf
Posted: Sun Mar 06, 2005 1:26 am
by NoahPhense
Damn Sparkie.. always crisp and clean.
So, what do you have out there.. you have some custom apps.. I would
like to see your stuff, if you have some..
- np
Posted: Sun Mar 06, 2005 3:11 am
by Sparkie
NoahPhense wrote:I would like to see your stuff, if you have some..
Damn! I know there's a good comeback for that line, but I can't come up with it.
Seriously though, I have about 3 projects going at this time. The one I'm working on at the moment is a reminder type app for myself.
My wife is always asking me to remind her of this and remind her of that. She knows I can't even remember my own things to do, let alone keep track of her "stuff", but yet she asks me anyways. I just adore her loving confidence in me.
This app has the added bonus of helping my boss communicate with me at work. She's forever neglecting to tell me what print jobs are due for the week. (I'm a t-shirt screen printer by day). Now all she has to do is fill in the blanks and I'm a happy camper with no more last minute surprises

(Oh if it were only that easy!) :roll:
So enter my project. It's about 75% done. More features to add as well as some resize optimization to reduce flickering. Noting fancy, just the facts as I need them
Screenshot 1
Screenshot 2
Posted: Sun Mar 06, 2005 6:25 pm
by NoahPhense
Very nice.. so, can you place my bills up in your calendar.. then *you*
can pay them?
- np
Posted: Sun Mar 06, 2005 6:37 pm
by Sparkie
Thanks np
I'll be happy to pay your bills...
...just have to wait for that major lottery jackpot to come my way
