Multi status fields

BlitzMax Forums/MaxGUI Module/Multi status fields

Zeke(Posted 2010) [#1]
Hi, this is my test to get more than one statusfield. i dont know it this is possible in linux or maxos but in windows this works.



and i know this is not working.. because if you move window then statusbar disappear


Zeke(Posted 2010) [#2]
this is not complete code.. just for testing.. and if you move window then statusbar disappear. but i want this to be added maxgui.. this just need some addstatusfield methods and redraw functions..


FBEpyon(Posted 2010) [#3]
Hello Zeke,

So I seem to have gotten a Win32 only version of the MaxGUI module to allow for status bar splitting... There is a few more things I need to fix, but all in all it works great.

I need to put in the Docs for the new addition to the module, and then I will release my own Win32 only MaxGUI module to the public.

here is a screen:



Also you can resize it with no problem, because its within the main TWindowGadget under the windows section of the module, so all the part controls are working fine... also I'm working on a MDI client window next if you are in interested in that as well.

Last edited 2010


Zeke(Posted 2011) [#4]
maxgui.mod/maxgui.bmx: (added)
Rem
	bbdoc: Add status field
endrem
Function AddStatusField(window:TGadget,txt:String , width:Int)
	window.AddStatusField(txt,width)
End Function


maxgui.mod/gadget.bmx: (modified)
(TGadget type)
' window commands
	Method GetStatusText$(index:Int=0)
	End Method
	Method SetStatusText(text$,index:Int=0)
	End Method
'statusbar
	Method AddStatusField(txt:String , width:Int)
	End Method


win32maxguiex.mod/winimports.bmx: (added)
'Status
Const SB_SETTEXTW:Int = $40B
Const SB_GETTEXTW:Int = $40D
Const SB_GETTEXTLENGTHW:Int = $40C
Const SB_SETPARTS:Int = $404
Const SB_GETPARTS:Int = $406


win32maxguiex.mod/win32maxguiex.bmx: (added+modified)

(type TWindowsWindow extends TWindowGadget)
'added
Field _status_widths:Int[]
Field _statustext:String[]

Method GetStatusText:String(index:Int = 0)
	If _status
		If index < 0 Or index >= _statustext.Length Then Return
		Return _statustext[index]
	EndIf
EndMethod

Method SetStatusText(Text:String, index:Int = 0)
	If _status
		If _status_widths.Length = 0 Then Self.AddStatusField(Text, -1)
		If index < 0 Or index >= _statustext.Length Then Return
		_statustext[index] = Text
		If (Style & WINDOW_RESIZABLE) Then Text:+"      "	'Cludge for size handle obfuscation
		Local tmpWString:Short Ptr = Text.ToWString()
		SendMessageW _status, SB_SETTEXTW, index, Int(tmpWString)
		MemFree tmpWString
	EndIf
EndMethod

Method AddStatusField(txt:String, _width:Int)
	If Not _status Return

	Local totalwidth:Int = _status_widths[_status_widths.Length - 1] 'take total width
	
	_status_widths = _status_widths[.._status_widths.length + 1] 'add field
	_statustext = _statustext[.._statustext.length + 1] 'increase text storage
	
	If _width >= 0 Then _width = _width + totalwidth
	
	_status_widths[_status_widths.Length - 1] = _width
	
	SendMessageW(_status, SB_SETPARTS, _status_widths.Length, Int(Int Ptr Varptr _status_widths[0]))
	
	Self.SetStatusText(txt, _status_widths.Length - 1)
End Method

Method ResizeStatus()
	For Local i:Int = 0 Until _status_widths.Length
		SendMessageW(_status, SB_SETPARTS, _status_widths.Length, Int(Int Ptr Varptr _status_widths[0]))
	Next
End Method


also edit wndproc method:

Case WM_SIZE
	
	If (hwnd = _hwnd) And (wp <> SIZE_MINIMIZED) Then
	
		If _status Then
			ResizeStatus
			SendMessageW _status, WM_SIZE, 0, 0
		EndIf


Last edited 2011

Last edited 2011