Does a statusbar segment have an own handle?
Does a statusbar segment have an own handle?
The title says it. Does it? If so, how can I retrieve it? I know Windows provides statusbars with text and icons, but PB also has progressbars, so there must be something more. And I don't want to use a canvas.
PureBasic 6.04/XProfan X4a/Embarcadero RAD Studio 11/Perl 5.2/Python 3.10
Windows 11/Ryzen 5800X/32GB RAM/Radeon 7770 OC/3TB SSD/11TB HDD
Synology DS1821+/36GB RAM/130TB
Synology DS920+/20GB RAM/54TB
Synology DS916+ii/8GB RAM/12TB
Windows 11/Ryzen 5800X/32GB RAM/Radeon 7770 OC/3TB SSD/11TB HDD
Synology DS1821+/36GB RAM/130TB
Synology DS920+/20GB RAM/54TB
Synology DS916+ii/8GB RAM/12TB
Re: Does a statusbar segment have an own handle?
They don't appear to have and I can't really think of any reason why this would be neccessary to implement the status bar's own functionality. Text, separators and images are static so can be drawn directly in the same context as the bar's own features. When you add a progress bar this gets added as a child control.
Re: Does a statusbar segment have an own handle?
Thanks for the answer. My intention is very obvious (at least I thought so): putting a different control into a segment, like a combobox, checkbox, etc.
PureBasic 6.04/XProfan X4a/Embarcadero RAD Studio 11/Perl 5.2/Python 3.10
Windows 11/Ryzen 5800X/32GB RAM/Radeon 7770 OC/3TB SSD/11TB HDD
Synology DS1821+/36GB RAM/130TB
Synology DS920+/20GB RAM/54TB
Synology DS916+ii/8GB RAM/12TB
Windows 11/Ryzen 5800X/32GB RAM/Radeon 7770 OC/3TB SSD/11TB HDD
Synology DS1821+/36GB RAM/130TB
Synology DS920+/20GB RAM/54TB
Synology DS916+ii/8GB RAM/12TB
Re: Does a statusbar segment have an own handle?
Check out the below example
Edit: height fixed
Edit: height fixed
Code: Select all
OpenWindow(0,#PB_Ignore,0,420,100,"Status Test", #PB_Window_SizeGadget | #PB_Window_SystemMenu)
hstatus = CreateStatusBar(#PB_Any, WindowID(0))
SendMessage_(StatusBarID(hstatus), #SB_SETMINHEIGHT, 29, 0) ;;; thanks rashad!
SendMessage_(StatusBarID(hstatus), #WM_SIZE, 0,0)
AddStatusBarField(450)
Cont_1 = ContainerGadget(#PB_Any, 100, 1, 392, 25)
x = StringGadget(#PB_Any, 1, 3,100, 22, "HALLO")
y = ComboBoxGadget(#PB_Any, 200, 3,100, 22)
AddGadgetItem(y, -1, "Choose item")
AddGadgetItem(y, -1, "Item 1")
AddGadgetItem(y, -1, "Item 2")
SetGadgetState(y, 0)
SetGadgetColor(x, #PB_Gadget_FrontColor,#Red)
SetParent_(GadgetID(Cont_1),StatusBarID(hstatus))
Repeat : Until WaitWindowEvent() = 13116
Re: Does a statusbar segment have an own handle?
Firstly, thanks very much.
But this is not exactly what I'm looking for. The statusbar is not segmented. I know, I can simulate segments by myself, but this is not exactly what I wanted.
But this is not exactly what I'm looking for. The statusbar is not segmented. I know, I can simulate segments by myself, but this is not exactly what I wanted.
PureBasic 6.04/XProfan X4a/Embarcadero RAD Studio 11/Perl 5.2/Python 3.10
Windows 11/Ryzen 5800X/32GB RAM/Radeon 7770 OC/3TB SSD/11TB HDD
Synology DS1821+/36GB RAM/130TB
Synology DS920+/20GB RAM/54TB
Synology DS916+ii/8GB RAM/12TB
Windows 11/Ryzen 5800X/32GB RAM/Radeon 7770 OC/3TB SSD/11TB HDD
Synology DS1821+/36GB RAM/130TB
Synology DS920+/20GB RAM/54TB
Synology DS916+ii/8GB RAM/12TB
Re: Does a statusbar segment have an own handle?
Hi
No Handle for the StatusBar Field
But you can work around
Open the GadgetList() at any time then add,delete any PB gadget as usual then close the list
No Handle for the StatusBar Field
But you can work around
Open the GadgetList() at any time then add,delete any PB gadget as usual then close the list
Code: Select all
If OpenWindow(0, 0, 0, 600, 100, "PureBasic - StatusBar Example", #PB_Window_SystemMenu | #PB_Window_ScreenCentered | #PB_Window_SizeGadget)
CreateStatusBar(0, WindowID(0))
SendMessage_(StatusBarID(0), #SB_SETMINHEIGHT, 38, 0)
SendMessage_(StatusBarID(0), #WM_SIZE, 0,0)
AddStatusBarField(250)
AddStatusBarField(120)
AddStatusBarField(120)
UseGadgetList(StatusBarID(0))
ContainerGadget(0,1,1,248,38)
CloseGadgetList()
ContainerGadget(1,250,1,118,38)
CloseGadgetList()
;
ContainerGadget(2,370,1,118,38)
CloseGadgetList()
OpenGadgetList(0)
CheckBoxGadget(#PB_Any,5,5,60,28,"TEST")
comb0 = ComboBoxGadget(#PB_Any,70,5,170,28)
For a = 1 To 5
AddGadgetItem(comb0, -1,"ComboBox item " + Str(a))
Next
SetGadgetState(comb0,2)
CloseGadgetList()
OpenGadgetList(2)
butt2 = ButtonGadget(#PB_Any,5,5,60,28,"RUN")
CloseGadgetList()
Repeat
Select WaitWindowEvent()
Case #PB_Event_CloseWindow
Quit = 1
EndSelect
Until Quit = 1
EndIf
Egypt my love
Re: Does a statusbar segment have an own handle?
Nice code RASHAD!
Just a note, if you're using a 4K monitor with scaling set and compile with "DPI aware ON" you need to make a slight change for things to look right...
Just a note, if you're using a 4K monitor with scaling set and compile with "DPI aware ON" you need to make a slight change for things to look right...
Code: Select all
dpiaware.d=DesktopResolutionX()
CreateStatusBar(0, WindowID(0))
SendMessage_(StatusBarID(0), #SB_SETMINHEIGHT, 38*dpiaware, 0)
SendMessage_(StatusBarID(0), #WM_SIZE, 0,0)
AddStatusBarField(250*dpiaware)
AddStatusBarField(120*dpiaware)
AddStatusBarField(120*dpiaware)
Re: Does a statusbar segment have an own handle?
Hi Paul
Thanks for your contribution
Amazing
It seem with Windows 11 everything goes well with or without DPI aware
Can anyone agree if that is true or correct ?
Thanks for your contribution
Amazing
It seem with Windows 11 everything goes well with or without DPI aware
Can anyone agree if that is true or correct ?
Egypt my love
Re: Does a statusbar segment have an own handle?
Thanks RASHAD and Paul. This is very creative, but still not what I was asking for. As mentioned the statusbar elements don't have an own handle, so I have to stick with that. No problem at all.
PureBasic 6.04/XProfan X4a/Embarcadero RAD Studio 11/Perl 5.2/Python 3.10
Windows 11/Ryzen 5800X/32GB RAM/Radeon 7770 OC/3TB SSD/11TB HDD
Synology DS1821+/36GB RAM/130TB
Synology DS920+/20GB RAM/54TB
Synology DS916+ii/8GB RAM/12TB
Windows 11/Ryzen 5800X/32GB RAM/Radeon 7770 OC/3TB SSD/11TB HDD
Synology DS1821+/36GB RAM/130TB
Synology DS920+/20GB RAM/54TB
Synology DS916+ii/8GB RAM/12TB
Re: Does a statusbar segment have an own handle?
No, it the same as in Windows 10.
The SendMessage_() needs the dpi factor set.
AddStatusBarField() should actually apply dpi factor internally, but does not. PB Bug!
As for the question: statusbar elements don't have any handle.