2 add. functions for the textarea control(win32)
BlitzMax Forums/MaxGUI Module/2 add. functions for the textarea control(win32)
| ||
| Hi, I have currently started a new IDE for BMax. The main target is the cross compatibility for all Versions. To handle the enormous speed lag in every highlighting code (mainly on windows, but also on every other OS) I've done some researching how to determine the first and last visible line of a textarea control. As I only own a windows system I wasn't able to get these functions for Linux and Mac. Maybe some of our linux and mac cracks could find them out to have some (in my opinion very important functions) cross platform functions. Here is the actual windows version:
Type TRect
Field _Left:Int
Field _Top:Int
Field _Right:Int
Field _Bottom:Int
End Type
Type TPoint
Field X:Int
Field Y:Int
End Type
Function TextAreaFirstVisibleLine(textarea:TGadget)
Local hwnd=QueryGadget(textarea,QUERY_HWND)
If hwnd Return SendMessageA(hwnd,EM_GETFIRSTVISIBLELINE,0,0)
End Function
Function GetLastVisibleLine:Int(Edit:TGadget)
Local r:TRect
Local i:Int
Local hwnd=QueryGadget(Edit,QUERY_HWND)
If hwnd
SendMessageA(hwnd,EM_GETRECT,0,Int(Byte Ptr r))
Else
Return Null
EndIf
Local pt:TPoint = New TPOINT
pt.x = Long(r._right)
pt.y = Long(r._bottom)
i = SendMessageA(hwnd,EM_CHARFROMPOS,0,Int(Byte Ptr pt))
Return i
End Function
Thx klepto2 PS: it is important that these functions are font independent. |