Page 1 of 1
StatusBar background color.
Posted: Sat Jul 17, 2021 6:33 pm
by dibor
Hello guys.
How can I set StatusBar background color as window color?
PureBasic do not has any command for status bar color changing.
Please provide small and simple example if possible.
I am not programmer and use this compiler for small hamradio programs.
Best Wishes.
Re: StatusBar background color.
Posted: Sat Jul 17, 2021 6:47 pm
by skywalk
Search for ts-soft example using canvas gadget statusbar. You get way more flexibility and control.
Do not try the statusbar direct approach since it will be more complicated with os specific callbacks and subclassing and api cmd's.
Re: StatusBar background color.
Posted: Sat Jul 17, 2021 7:10 pm
by dibor
Tnx for answer.
ts-soft ???
Maybe mk-soft?
Anyway, do not find any example

Give me link if U have.
Thank U
Re: StatusBar background color.
Posted: Sat Jul 17, 2021 7:35 pm
by davido
@
dibor,
Thorsten1867 has designed a canvas version. I haven't used it myself, but I have used a few of his other canvas-based gadgets and found them very useful, to me!
Please take a look at the following link:
viewtopic.php?p=534381#p534381
Re: StatusBar background color.
Posted: Sat Jul 17, 2021 8:32 pm
by Paul
This was posted way back when for Windows...
Code: Select all
; Title: Custom Statusbar Text Colors
; Author: Fluid Byte/RASHAD
; Date: December 28, 2006
Structure ODSBTEXT
szText.s
clrFront.i
hBrush.i
EndStructure
Global Result
Global Dim osbt.ODSBTEXT(5)
Procedure WindowCallback(hWnd,uMsg,wParam,lParam)
Select uMsg
Case #WM_DRAWITEM
If wParam = GetDlgCtrlID_(Result)
*lpdis.DRAWITEMSTRUCT = lParam
*osbt.ODSBTEXT = *lpdis\itemData
SetTextColor_(*lpdis\hDC, *osbt\clrFront)
SetBkMode_(*lpdis\hDC, #TRANSPARENT)
FillRect_(*lpdis\hDC, *lpdis\rcItem, *osbt\hBrush)
DrawText_(*lpdis\hDC, *osbt\szText, -1, *lpdis\rcItem, #DT_SINGLELINE | #DT_VCENTER | #DT_RIGHT)
EndIf
EndSelect
ProcedureReturn #PB_ProcessPureBasicEvents
EndProcedure
Procedure myStatusBarText(Field, Text.s, fCol, bCol)
Text+" "
osbt(Field)\szText = Text
osbt(Field)\clrFront = fCol
osbt(Field)\hBrush = CreateSolidBrush_(bCol)
SendMessage_(Result,#SB_SETTEXT, Field | #SBT_OWNERDRAW, osbt(Field))
EndProcedure
OpenWindow(0,0,0,350,100,"Custom Statusbar Text Colors",#WS_OVERLAPPEDWINDOW | 1)
SetWindowCallback(@WindowCallback())
Result = CreateStatusBar(0,WindowID(0))
AddStatusBarField(100)
AddStatusBarField(100)
AddStatusBarField(900)
SendMessage_(Result, #SB_SETMINHEIGHT, 40, 0)
SendMessage_(Result, #WM_SIZE, 0,0)
Text.s="1"
Field=0
fCol.l=#Green
bCol.l=#Gray
myStatusBarText(Field, Text, fCol, bCol)
Text.s="2"
Field=1
fCol.l=#Yellow
bCol.l=#Blue
myStatusBarText(Field, Text, fCol, bCol)
Text.s="3"
Field=2
fCol.l=#Red
bCol.l=#Yellow
myStatusBarText(Field, Text, fCol, bCol)
While WaitWindowEvent() ! #PB_Event_CloseWindow : Wend
Re: StatusBar background color.
Posted: Sat Jul 17, 2021 9:31 pm
by dibor
Tnx davido and Paul!
Will try to use Thorsten module because I do not understand windows API at all.
Best Wishes!
Re: StatusBar background color.
Posted: Sun Jul 18, 2021 1:23 am
by skywalk
dibor wrote: Sat Jul 17, 2021 7:10 pm
Tnx for answer.
ts-soft ???
Maybe mk-soft?
Anyway, do not find any example

Give me link if U have.
Thank U
ts-soft container as statusbar
Re: StatusBar background color.
Posted: Sun Jul 18, 2021 2:41 pm
by dibor
Hello.
Thorsten Hoeppner module looks good and has many options.
His example also runs as should, but when I try to implement this module in my program - I got status bar but in wrong location.
Looks like wrong window size determination, only with statusbar height 48 I can see text.
Will try to understand where and what I did wrong.
Re: StatusBar background color.
Posted: Sun Jul 25, 2021 8:36 pm
by dibor
Looks like this too complicate for me.

I do not understand where the problem.

In the windows module works wrong
But in the Mac - looks GOOD
