For example, If I created a box with rounded corners with a text gadget in it with the following code:
Code: Select all
Procedure CallbackStoreBox(hwnd, msg, wparam, lparam)
result1 = #PB_ProcessPureBasicEvents
Select msg
Case #WM_PAINT
hdc = BeginPaint_(hwnd, @ps.PAINTSTRUCT)
RoundRect_(hdc,600, 20, 780, 75, 20, 20)
EndPaint_(hwnd,@ps)
EndSelect
ProcedureReturn result1
EndProcedure
Code: Select all
wFlags = #PB_Window_SystemMenu | #PB_Window_MinimizeGadget | #PB_Window_ScreenCentered ;Window flags
If OpenWindow(#MainWindow, 0, 0, 800, 600, "Main Window", wFlags) SetWindowColor(#MainWindow, RGB(235,235,235))
SetWindowCallback(@CallbackStoreBox())
Now if I add a second box with rounded corners with the following code.
Code: Select all
Procedure CallbackStoreBox(hwnd, msg, wparam, lparam)
result1 = #PB_ProcessPureBasicEvents
Select msg
Case #WM_PAINT
hdc = BeginPaint_(hwnd, @ps.PAINTSTRUCT)
RoundRect_(hdc,600, 20, 780, 75, 20, 20)
EndPaint_(hwnd,@ps)
EndSelect
ProcedureReturn result1
EndProcedure
Procedure CallbackCustBox(hwnd, msg, wparam, lparam)
result2 = #PB_ProcessPureBasicEvents
Select msg
Case #WM_PAINT
hdc = BeginPaint_(hwnd, @ps.PAINTSTRUCT)
RoundRect_(hdc,15, 100, 700, 200, 20, 20)
EndPaint_(hwnd,@ps)
EndSelect
ProcedureReturn result2
EndProcedure
And add the call to it like this:
Code: Select all
wFlags = #PB_Window_SystemMenu | #PB_Window_MinimizeGadget | #PB_Window_ScreenCentered ;Window flags
If OpenWindow(#MainWindow, 0, 0, 800, 600, "Main Window", wFlags) SetWindowColor(#MainWindow, RGB(235,235,235))
SetWindowCallback(@CallbackStoreBox())
SetWindowCallback(@CallbackCustBox())
Is there a problem using the SetWindowCallback more than once in the same window or am I coding it incorrectly?
I’m pretty new at all this.
Thanks