Code: Select all
Structure ODSBTEXT
szText.l
clrFront.l
clrBack.l
EndStructure
Procedure WindowCallback(hWnd.l,uMsg.l,wParam.l,lParam.l)
Select uMsg
Case #WM_DRAWITEM
*lpdis.DRAWITEMSTRUCT = lParam
ClassName$ = Space(19) : GetClassName_(*lpdis\hwndItem,ClassName$,19)
If ClassName$ = "msctls_statusbar32"
*osbt.ODSBTEXT = *lpdis\itemData
SetTextColor_(*lpdis\hDC,*osbt\clrFront)
SetBkColor_(*lpdis\hDC,*osbt\clrBack)
SendMessage_(*lpdis\hwndItem,#SB_GETBORDERS,0,aBorders.RECT)
InflateRect_(*lpdis\rcItem,-aBorders\right / 2,0)
DrawText_(*lpdis\hDC,*osbt\szText,-1,*lpdis\rcItem,#DT_SINGLELINE | #DT_VCENTER)
EndIf
EndSelect
ProcedureReturn #PB_ProcessPureBasicEvents
EndProcedure
OpenWindow(0, 100, 100, 250, 50, "StatusBar", #PB_Window_SizeGadget | #PB_Window_SystemMenu)
SetWindowCallback(@WindowCallback())
CreateStatusBar(0, WindowID(0))
AddStatusBarField(100)
AddStatusBarField(100)
StatusBarText(0, 0, "Enabled")
StatusBarText(0, 1, "Disabled")
osbt.ODSBTEXT
osbt\szText = @"Disabled"
osbt\clrBack = GetSysColor_(#COLOR_3DFACE)
osbt\clrFront = #Gray
SendMessage_(StatusBarID(0), #SB_SETTEXT, 1 | #SBT_OWNERDRAW, osbt)
Repeat
Until WaitWindowEvent() = #PB_Event_CloseWindow

