' Empty GUI script created on 05-21-2011 19:54:23 by (ThinAIR)
' Empty GUI script created on 05-19-2011 08:41:54 by largo_winch (ThinAIR)
Uses "ui","OS" '"console",
'#INCLUDE "%APP_INCLUDEPATH%\scintillalw.inc"
#INCLUDE "scintillalw.inc"
%SCLEX_THINBASIC = 510
%ID_Sci = 2000 : %ID_Sci2 = 2001
%ID_Button = 2002 : %ID_Button2 = 2003
%ID_TEXT = 2004 : %ID_TEXT2 = 2005
Global hDlg, hSci, hSci2 As DWord
Global path$
Global ScriptFile As String
Declare Function LoadLibrary Lib "KERNEL32.DLL" Alias "LoadLibraryA" (lpLibFileName As Asciiz) As Long
Declare Function FreeLibrary Lib "KERNEL32.DLL" Alias "FreeLibrary" (ByVal hLibModule As DWord) As Long
'-------------------------> Main Dialog -------------------------------------------->
Function TBMain() As Long
Local hLib As DWord
hLib = LoadLibrary("SCILEXER.DLL")
Dialog New Pixels, 0, "TB_Scintilla 1cc_Example",200,200,640,440, %WS_OVERLAPPEDWINDOW To hDlg
Control Add Button, hDlg, %ID_Button, "sendKeyText", 10,10,80,24
Control Add Button, hDlg, %ID_Button2, "sendKeyText2", 300,10,80,24
Control Add "Scintilla", hDlg, %ID_Sci, "", 10,50,520,280, %WS_CHILD Or %WS_VISIBLE
'Control Add "Scintilla", hDlg, %ID_Sci2, "", 310,50,320,280, %WS_CHILD Or %WS_VISIBLE
Control Handle hDlg, %ID_Sci To hSci
'Control Handle hDlg, %ID_Sci2 To hSci
Dialog Show Modal hDlg Call DlgProc
End Function
'---------------------------------> CALLBACK FUNCTIONS --------------------------->
CallBack Function DlgProc() As Long
Local txt As String, buffer As String, buffer2 As String
Local hLib As DWord, nLen As Long, nLen1 As Long, v As String, i As Long
Select Case CBMSG
Case %WM_INITDIALOG
'StartSci
Case %WM_COMMAND
If CBCTL = %ID_Button Then
StartSci()
nLen = SendMessage(hSci, %SCI_GETTEXTLENGTH, 0, 0)
MsgBox 0, "characters lenght: "+Str$(nLen) 'ok :)
'------------------------------------------------> ok
Buffer = $SPC(nLen+1)
'------------------------------------------------> ok
'not ok: I need here a NUMERIC EXPRESSION
SendMessage(hSci, %SCI_GETTEXT, Len(Buffer), StrPtr(Buffer))
'i = OS_Shell("calc.exe", 1,%OS_SHELL_SYNC) ' "thinbasic.exe"
SendMessage (hSci, %SCI_SetMarginWidthN, 0, 20)
MsgBox 0, buffer
End If
If CBCTL = %ID_Button2 Then
StartSci2()
nLen1 = SendMessage(hSci, %SCI_GETTEXTLENGTH, 0, 0)
MsgBox 0, "characters lenght: "+Str$(nLen1) 'ok :)
Buffer2 = $SPC(nLen1+1)
SendMessage(hSci, %SCI_GETTEXT, Len(Buffer2), StrPtr(Buffer2))
'i = OS_Shell("excel.exe", 1,%OS_SHELL_SYNC)
SendMessage hSci, %SCI_SetMarginWidthN, 0, 20
MsgBox 0, buffer2
End If
Case %WM_DESTROY
If hSci Then FreeLibrary hSci
If hSci2 Then FreeLibrary hSci2
End Select
End Function
Sub StartSci()
Local bufferli, strTBKeyWords As String, iResult As Long
strTBKeyWords = "case if else end select then msgbox for next thinbasic values vertex super euro fisherman earth moon sunbasic"
bufferli =" 'Enter some new values here"+$CRLF+_
""+$CRLF+_
" sin(25) + cos(24.25) + tan(22) if nothing else color "+$CRLF+_
" case 20.0 if 34.0 else 255.25 "+$CRLF+_
" end 56.30 select 40.2 then 88.24 vertex 1.0 " +$CRLF+_
" case 24.0 + ""yes!"" and end 24.45 ""gone"", " +$CRLF+_
" fisherman For Next earth moon Else nothing" +$CRLF+_
" thinbasic sunbasic solsystembasic" +$CRLF+_
"super oil petrol for 1.59 euro" + $NUL+$CRLF
SendMessage hSci, %SCI_STYLESETFORE, %SCE_B_KEYWORD, Rgb(0, 0, 255)
SendMessage hSci, %SCI_STYLESETFORE, %SCE_B_STRING, Rgb(255, 0, 255)
SendMessage hSci, %SCI_STYLESETFORE, %SCE_B_NUMBER,Rgb(192,100,0)
SendMessage hSci, %SCI_SETLEXER, %SCLEX_PowerBASIC, 0 '%SCLEX_ThinBASIC
SendMessage hSci, %SCI_SETKEYWORDS, 0, StrPtr(strTBKeyWords)
SendMessage hSci, %SCI_SetText, 0, StrPtr(bufferli)
SendMessage hSci, %SCI_SetMarginWidthN, 0, 20
End Sub
'--------------------> only for testpurpose ------------------->
Sub StartSci2()
Local bufferli2, strTBKeyWords2 As String, iResult2 As Long
strTBKeyWords2 = "flowers trees cats quarks cows nothing fisherman horses universebasic"
bufferli2 =" 'Hey monsters, please enter some new words here!"+$CRLF+_
""+$CRLF+_
" flowers mother sin(1025) + cos(424.25) + tan(822) if nothing else color "+$CRLF+_
" trees select case 20.0 if 34.0 else 255.25 "+$CRLF+_
" wend 56.30 select 40.2 then 88.24 vertex 1.0 " +$CRLF+_
" birds case 724.0 + ""yes Sir!"" and end 24.45 ""gone dark"", " +$CRLF+_
" fisherman For Next earth moon Else nothing" +$CRLF+_
" woodbasic sunbasic solsystembasic universebasic" +$CRLF+_
" end of cows and basic quarks" + $NUL+$CRLF
SendMessage hSci, %SCI_STYLESETFORE, %SCE_B_KEYWORD, Rgb(110, 0, 255)
SendMessage hSci, %SCI_STYLESETFORE, %SCE_B_STRING, Rgb(255, 0, 255)
SendMessage hSci, %SCI_STYLESETFORE, %SCE_B_NUMBER,Rgb(192,100,0)
SendMessage hSci, %SCI_SETLEXER, %SCLEX_PowerBASIC, 0 '%SCLEX_ThinBASIC
SendMessage hSci, %SCI_SETKEYWORDS, 0, StrPtr(strTBKeyWords2)
SendMessage hSci, %SCI_SetText, 0, StrPtr(bufferli2)
SendMessage hSci, %SCI_SetMarginWidthN, 0, 20
End Sub
btw: I explored there's two ways of compiling a) string buffer and a b) file for executing and loading. I am looking for new infos. I don't give up
Bookmarks