| @rs22 
 maybe it helps you ... a example for highlighting and folding ... really basic.
 
 
 
SuperStrict
Framework wx.wxApp
Import wx.wxScintilla
Import wx.wxFrame
import brl.retro
import brl.map
' the map is not important and currently not used
global bm:TMap = createmap()
New TEd.Run()
Type TEd Extends wxApp
	Field frame:TEdFrame
	Method OnInit:Int()
		' Create application frame
		frame = TEdFrame(New TEdFrame.Create(,,"MaxEd", 0, 0, 800, 600))
		
		' open application frame
		frame.Layout()
		frame.Show(True)
		SetTopWindow(frame)
	
		Return True
	End Method
End Type
Type TEdFrame Extends wxFrame
	Field mEdit:Edit
	
	Method OnInit()
		mEdit = Edit(New Edit.Create(Self, -1))
		mEdit.SetFocus()
	End Method
End Type
Type Edit Extends wxScintilla
	' "keys" holds the BlitzMax command list
	global keys:String = CreateCMDList()
	
	' the callback functions needs access to wxScintilla, a global object makes the job
	global ed:Edit
	
	Method OnInit()		
		self.ed = self
		
		ConnectAny(wxEVT_CHAR, OnKeyDown)
		ConnectAny(wxEVT_SCI_MARGINCLICK, onMarginClick)
		
		SetLexerLanguage("blitzmax")
		SetKeyWords(0, keys.toLower())
		
		Local FONT:wxFont = New wxFont.CreateWithAttribs(10, wxTELETYPE, wxNORMAL, wxNORMAL) 
		Local kw:wxFont = New wxFont.CreateWithAttribs(10, wxTELETYPE, wxNORMAL, wxBOLD) 
		StyleSetFontFont(wxSCI_STYLE_DEFAULT, FONT) 
		StyleSetFontFont(wxSCI_B_KEYWORD, kw) 
		
		StyleSetForeGround(wxSCI_B_KEYWORD, New wxColour.CreateNamedColour("RGB(90, 190, 255)"))
		StyleSetForeGround(wxSCI_B_COMMENT, New wxColour.CreateNamedColour("GREY"))
		StyleSetForeGround(wxSCI_B_STRING, New wxColour.CreateNamedColour("GREEN"))
		 
		SetTabWidth(2) 
		
		' Linenumber Margin	
		setmargintype(0, wxSCI_MARGIN_NUMBER)
		SetMarginWidth(0, TextWidth(wxSCI_STYLE_LINENUMBER, "_999999"))
		
		' Folding Margin
		setproperty("fold", 1)
		setproperty("fold.comment", 1)
		setmargintype(1, wxSCI_MARGIN_SYMBOL)
		setmarginwidth(1, 0)
		setmarginmask(1, wxSCI_MASK_FOLDERS)
		SetMarginWidth(1, 20)
		SetMarginSensitive(1, 1)
		
		MarkerDefine(wxSCI_MARKNUM_FOLDER, wxSCI_MARK_BOXPLUS)
		MarkerSetBackground(wxSCI_MARKNUM_FOLDER, New wxColour.CreateNamedColour("BLACK"))
		MarkerSetForeground(wxSCI_MARKNUM_FOLDER, New wxColour.CreateNamedColour("WHITE"))
		MarkerDefine(wxSCI_MARKNUM_FOLDEROPEN, wxSCI_MARK_BOXMINUS)
		MarkerSetBackground(wxSCI_MARKNUM_FOLDEROPEN, New wxColour.CreateNamedColour("BLACK"))
		MarkerSetForeground(wxSCI_MARKNUM_FOLDEROPEN, New wxColour.CreateNamedColour("WHITE"))
		
		MarkerDefine(wxSCI_MARKNUM_FOLDERSUB, wxSCI_MARK_EMPTY)
		MarkerDefine(wxSCI_MARKNUM_FOLDEREND, wxSCI_MARK_SHORTARROW)
		MarkerDefine(wxSCI_MARKNUM_FOLDEROPENMID, wxSCI_MARK_ARROWDOWN)
		MarkerDefine(wxSCI_MARKNUM_FOLDERMIDTAIL, wxSCI_MARK_EMPTY)
		MarkerDefine(wxSCI_MARKNUM_FOLDERTAIL, wxSCI_MARK_EMPTY)
					
		UsePopUp(1)
		SetLayoutCache(wxSCI_CACHE_PAGE)
		SetBufferedDraw(1)
	End Method
	
	Function OnKeyDown(event:wxEvent)
		event.Skip()
	End Function
	
	function onMarginClick(event:wxEvent)
		local p:Int = wxScintillaEvent(event).getPosition()
		Edit.ed.togglefold(Edit.ed.linefromposition(p))
		
		event.Skip()
	end function
end type
function CreateCMDList:String()
	local stream:TStream = readfile("commands.txt")
	local cmdlist:String = stream.readline()
	stream.close()
	
	rem
	' create commands.txt from BMax
	local cmd:String			= "/home/bruzard/BlitzMax/docs/html/Modules/commands.txt"
	local cmdlist:String	= ""
	local commands:TList = new TList
	
	local stream:TStream	= readfile(cmd)
	if stream <> null
		while not stream.eof()
			local in:String = stream.readline().trim()
			' Klammer finden
			local f:int = 0
			f = in.Find("(")		; if f > 0 then in = in[..f]
			f = in.Find(":")		; if f > 0 then in = in[..f]
			f = in.Find("$")		; if f > 0 then in = in[..f]
			f = in.Find(" ")		; if f > 0 then in = in[..f]
			f = in.Find("|")		; if f > 0 then in = in[..f]
			
			local found:byte = false
			if commands <> null
				for local a:String = eachin commands
					if a = in
						found = true
						exit
					endif
				next
			endif
			
			if found = false
				commands.addlast(in)
				cmdlist:+ in.toLower() + " "
				mapinsert(bm, in.toLower(), in)
			endif
		wend
		stream.close()
		
		stream = writefile("commands.txt")
		if stream
			for local a:String = eachin commands
				stream.writestring(a + " ")
			next
			
			stream.close()
		endif
	else
		debuglog "cannot read " + cmd
	endif
	endrem
	
	return cmdlist
end function
 
 |