EnableExplicit Define EventID Global color = CreateSolidBrush_(RGB(255,0,0)) Procedure myCallback(hWnd, uMsg, wParam, lParam) Select uMsg Case #WM_CTLCOLORSTATIC If lparam = GadgetID(1) ProcedureReturn color EndIf EndSelect ProcedureReturn #PB_ProcessPureBasicEvents EndProcedure If OpenWindow(0,0,0,500,400,"Window",#PB_Window_SystemMenu|#PB_Window_ScreenCentered) OptionGadget(1,10,10,200,20,"Link") SetWindowCallback(@myCallback()) Repeat EventID=WaitWindowEvent() If EventID = #PB_Event_CloseWindow DeleteObject_(color) End EndIf ForEver EndIf