#Include once "window9.bi"

Sub ToolTipStatusBar(ByVal gadget As Integer, ByVal NumberField As Integer,ByVal text As String)Export
	Dim As wString Ptr rr=Cast(WString Ptr,StrPtr(text))
	SendMessage(GadgetID(gadget),1040,NumberField,Cast(LPARAM,rr))
End Sub

Function StatusBarGadget(ByVal gadget As Integer,ByVal SingleText As string,ByVal style As Long,ByVal style2 As Long) As HWND Export
	var hwndStatusbar = CreateWindowEx(style2,STATUSCLASSNAME,SingleText,WS_CHILD Or WS_VISIBLE Or style,0,0,0,0,GETGURRENTAL(),NULL,0,NULL)
	ADDIN9999 (gadget,hwndStatusbar)
	SetProp(GETGURRENTAL(),"STATUSBARWINDOW",hwndStatusbar)
	ColorAdd(hwndStatusbar,15790320,0)
	If GGF()<>0 Then
		SendMessage(hwndStatusbar ,WM_SETFONT,GGF(),0)
	EndIf
	SendMessage(hwndStatusbar,SB_SETTEXT,255, Cast(lparam,StrPtr(SingleText)))
	Return hwndStatusbar
End Function

Function SetStatusBarField(ByVal gadget As Integer,ByVal NField As Integer, ByVal Width_ As Integer, ByVal Text As String) As Integer Export
	Dim As Integer Ptr iArray = GetProp(GadgetID(gadget),"STATUSBARARRAY")
	Dim As Integer iNfields = Cast(Integer,GetProp(GadgetID(gadget),"STATUSBARNUMBERFIELDS"))

	If iArray = 0 Then
		iArray = Allocate(250)
		SetProp(GadgetID(gadget),"STATUSBARARRAY",iArray)
		SetProp(GadgetID(gadget),"STATUSBARNUMBERFIELDS",Cast(HANDLE,1))
		iNfields = 1
	Else
		iNfields+=1
		SetProp(GadgetID(gadget),"STATUSBARNUMBERFIELDS",Cast(Integer Ptr,iNfields))		
	EndIf

	*(iArray+NField) = Width_
	Function = SendMessage(GadgetID(gadget), SB_SETPARTS,Cast(WPARAM,iNfields), Cast(lparam,iArray))
	SendMessage(GadgetID(gadget), SB_SETTEXT ,NField, Cast(LPARAM,StrPtr(Text)))
End Function