Restored from previous forum. Originally posted by Fangbeast.
Is there any way to resize statut bar fields during a form resize? (So that it will look good). UpdateStatusBar() will plonk the bar down to the botom of the resized form but the field widths stay the same and it doesn't look quite right.
I've been on MSDN and seen all the avaliable Status bar variables and apparently fidl width resetting is not one of them.
Anyone know of another way?
We are Dyslexic of Borg, prepare to have your ass laminated!
Status bar field resize during form resize?
-
BackupUser
- PureBasic Guru

- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by freak.
Hope that helps...
Timo
-------------------------------
http://freak.coolfreepages.com/
Code: Select all
OpenWindow(0,0,0,200,200,#PB_Window_SystemMenu|#PB_Window_SizeGadget|#PB_Window_Screencentered, "StatusBar Test")
OldWidth = WindowWidth() ; <- needed for resizing
Dim Fields.l(3) ; <- needed for resize, must be the number of Fields -1 (since it begins at 0)
hStatus.l = CreateStatusBar(1, WindowID()) ; <- Handle needed for SendMessage
AddStatusBarField(50)
AddStatusBarField(20)
AddStatusBarField(30)
AddStatusBarField(100)
StatusBarText(1, 0, "", #PB_StatusBar_Raised)
StatusBarText(1, 1, "")
StatusBarText(1, 2, "")
StatusBarText(1, 3, "", #PB_StatusBar_Raised)
Repeat
Select WaitWindowEvent()
Case #WM_SIZE
UpdateStatusBar(1) ; <- place StatusBar in the right place
UseWindow(0) ; <- make sure we use the right Window :)
NewWidth = WindowWidth() ; <- get new width
; get sizes of all Fields
SendMessage_(hStatus, #SB_GETPARTS, 4, @Fields() ) ; <- 4 is the number of Fields in the StatusBar
; resize fields...
For i = 0 To 3 ;<- 3 is number of Fields-1, because Array goes from 0 to 3
Fields(i) = Fields(i)* NewWidth / oldWidth
Next i
; set new sizes
SendMessage_(hStatus, #SB_SETPARTS, 4, @Fields() )
OldWidth = NewWidth ; <- new Width will be old next time
Case #PB_EventCloseWindow
End
EndSelect
Hope that helps...
Timo
-------------------------------
http://freak.coolfreepages.com/
-
BackupUser
- PureBasic Guru

- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm