Text areas and text fields stuff

BlitzMax Forums/MaxGUI Module/Text areas and text fields stuff

JoshK(Posted 2008) [#1]
Text fields look nicer because they have a thin border, instead of that ugly Windows 95-looking sunken border.

Text areas can have their color set, and be read-only.

Is there any chance a flag could be added like TEXTFIELD_READONLY?


jsp(Posted 2008) [#2]
While waiting for the READONLY flag you could may use a disabled TextField.
The only disadvantage is that that the foreground color defaults to gray, but beside that it may work for you.
Also there is a Label with simple and sunken border which is only 1 pixel and does perhaps what you are looking for.
I have attached a quick example:





SebHoll(Posted 2008) [#3]
How about using SetGadgetFilter():

Import MaxGui.Drivers

Strict 

Global window:TGadget = CreateWindow("My Window",30,20,320,200)
Global textfield:TGadget =CreateTextField(4,4,120,22,window)

SetGadgetText( textfield,"A textfield gadget" )

' Make read-only
SetGadgetFilter( textfield, ReadOnlyCallback )

While WaitEvent()
	Print CurrentEvent.ToString()
	Select EventID()
	Case EVENT_GADGETACTION
		Select EventSource()
			Case textfield
				Print "textfield updated"
		End Select
	Case EVENT_WINDOWCLOSE
		End
	End Select
Wend

Function ReadOnlyCallback(event:TEvent,context:Object)
	Return 0	' Never allow edit.
EndFunction