Seite 2 von 4

Verfasst: 19.06.2007 18:48
von ts-soft
Vermilion hat geschrieben:Bezüglich meinem Post: :oops: hab noch 4.00, ich dachte das geht auch so...
Es geht auch mit Versionen vor PB4.10, aber eben mit etwas mehr Aufwand.

Ich hatte dieses Beispiel bereits fertig (in "Lib2PBImport.exe" wird der
verwendet) und habs nur an PB4.10 angepaßt, damit man überhaupt erstmal
sieht, was damit möglich ist.

Hätteste aber evtl. auch von alleine drauf kommen können, nach der
Fehlermeldung :wink:

Verfasst: 20.06.2007 10:36
von Rings
ich habe nun mal die Konstanten soweit rausgesucht und
eingesetzt. Funktioniert leider nicht so .
Wenn ich den callback auf die SyntaxHilighting.dll rausnehme, dann
geht nix mehr. Also entweder fehlt mir da noch die richtige dll
oder ich hab nochen knick in meiner denkweise.
zumind. sollte ja die colorierung mittels vbscript gehen.

Ich habe die includes mal als macro mit eingebunden (nur damit man sie falten kann) .
Deswegen ist das file nu 155kb groß. deswegen mal kurz bei
so nem file-hoster abgelegt:
http://www.kram-hochladen.de/download.php?id=ODQzMDQ=

Verfasst: 20.06.2007 15:49
von ts-soft
Du kannst beide callbacks dafür erstmal entfernen. Aber Du solltest die
SciLexer.dll nutzen, nicht Scintilla.dll von PB!
Am besten SciTe runterladen, da ist die DLL bei.

Lexer setzen, wordliste setzen, formatierung setzen
Dann gehts, ohne jegliches Callback! Weil Du ja einen eingebauten Lexer
nutzt

Verfasst: 20.06.2007 19:06
von edel
Beispiel :

Code: Alles auswählen

;##################################################################
;#                                                                 
;#                                                                 
;#                                                                 
;##################################################################
Procedure SetStyle(id,style,fore,back,bold=-1,italic=-1,size=0,font.s="")
	
  ScintillaSendMessage(id,#SCI_STYLESETFORE, style, fore)
  ScintillaSendMessage(id,#SCI_STYLESETBACK, style, back)
  
  If italic > -1
    ScintillaSendMessage(id,#SCI_STYLESETITALIC, style, italic)
  EndIf
  
  If bold > -1
    ScintillaSendMessage(id,#SCI_STYLESETBOLD, style, bold)
  EndIf
  
  If size > 0
    ScintillaSendMessage(id,#SCI_STYLESETSIZE, style, size)
  EndIf
  
  If font
    ScintillaSendMessage(id,#SCI_STYLESETFONT, style, @font)
  EndIf
	
EndProcedure

;##################################################################
;#                                                                 
;#                                                                 
;#                                                                 
;##################################################################
ProcedureDLL ScintillaCallBack(Gadget, *scinotify.SCNotification)
  
  Protected line = ScintillaSendMessage(Gadget,#SCI_LINEFROMPOSITION,*scinotify\position)
  
  If *scinotify\margin = 1
    ScintillaSendMessage(Gadget,#SCI_TOGGLEFOLD, line, 0)
  EndIf
  
  
EndProcedure

;##################################################################
;#                                                                 
;#                                                                 
;#                                                                 
;##################################################################
Procedure NewSciGadget(id,x,y,cx,cy,cb=0)
  Protected Gadget , keyword.s
  Static Init
  
  If Not Init
    InitScintilla("scilexer")
  EndIf
  
  Gadget = ScintillaGadget(id,x,y,cx,cy,cb)
  
  If id <> #PB_Any
    Gadget = id
  EndIf 
  
  ; lexer default
  ScintillaSendMessage(Gadget,#SCI_SETLEXER,#SCLEX_VB)
  ScintillaSendMessage(Gadget,#SCI_SETSTYLEBITS, 5)
  
  SetStyle(Gadget,#STYLE_DEFAULT, #Black, #White,#PB_Default,#PB_Default,10, "courier new") 
	ScintillaSendMessage(Gadget,#SCI_STYLECLEARALL)
  
  
  ; keyyword
  
  keyword = "addressof alias and as attribute base begin binary boolean byref byte byval call case compare "
  keyword + "const currency date decimal declare defbool defbyte defint deflng defcur defsng defdbl defdec "
  keyword + "defdate defstr defobj defvar dim do double each else elseif empty end enum eqv erase error "
  keyword + "event exit explicit false for friend function get gosub goto if imp implements in input integer "
  keyword + "is len let lib like load lock long loop lset me mid midb mod new next not nothing null object "
  keyword + "on option optional or paramarray preserve print private property public raiseevent randomize "
  keyword + "redim rem resume return rset seek select set single static step stop string sub then time to "
  keyword + "true type typeof unload until variant wend while with withevents xor"
  
  
  ScintillaSendMessage(Gadget,#SCI_SETKEYWORDS,0,@keyword)
  SetStyle(Gadget,#SCE_B_KEYWORD  , #Blue   , #White,#True)  
  
  ScintillaSendMessage(Gadget,#SCI_SETKEYWORDS,1,@"option explicit")
  SetStyle(Gadget,#SCE_B_KEYWORD2 , #red    , #White,#True)  
  
  ScintillaSendMessage(Gadget,#SCI_SETKEYWORDS,2,@"blub")
  SetStyle(Gadget,#SCE_B_KEYWORD3 , $FFFFFF , $C0C0C0)
  
  SetStyle(Gadget,#SCE_B_NUMBER   , #red    , #White)  
  SetStyle(Gadget,#SCE_B_COMMENT  , $C0C0C0  , #White)
  
  
  ;line number
  ScintillaSendMessage(Gadget,#SCI_SETMARGINWIDTHN, 0, 30)
  
  ; folding
  ScintillaSendMessage(Gadget,#SCI_SETPROPERTY, @"fold", @"1") 
   
  ScintillaSendMessage(Gadget,#SCI_SETMARGINTYPEN,  1, #SC_MARGIN_SYMBOL)
  ScintillaSendMessage(Gadget,#SCI_SETMARGINMASKN,  1, #SC_MASK_FOLDERS)
  ScintillaSendMessage(Gadget,#SCI_SETMARGINWIDTHN, 1, 20)
  
  ScintillaSendMessage(Gadget,#SCI_SETMARGINSENSITIVEN, 1, 1)
  
  ScintillaSendMessage(Gadget,#SCI_MARKERDEFINE, #SC_MARKNUM_FOLDEROPEN     , #SC_MARK_MINUS) 
  ScintillaSendMessage(Gadget,#SCI_MARKERDEFINE, #SC_MARKNUM_FOLDER         , #SC_MARK_PLUS) 
  ScintillaSendMessage(Gadget,#SCI_MARKERDEFINE, #SC_MARKNUM_FOLDERSUB      , #SC_MARK_EMPTY) 
  ScintillaSendMessage(Gadget,#SCI_MARKERDEFINE, #SC_MARKNUM_FOLDERTAIL     , #SC_MARK_EMPTY) 
  ScintillaSendMessage(Gadget,#SCI_MARKERDEFINE, #SC_MARKNUM_FOLDEREND      , #SC_MARK_EMPTY) 
  ScintillaSendMessage(Gadget,#SCI_MARKERDEFINE, #SC_MARKNUM_FOLDEROPENMID  , #SC_MARK_EMPTY) 
  ScintillaSendMessage(Gadget,#SCI_MARKERDEFINE, #SC_MARKNUM_FOLDERMIDTAIL  , #SC_MARK_EMPTY)
 
EndProcedure

;##################################################################
;#                                                                 
;#                                                                 
;#                                                                 
;##################################################################
Procedure main()
  Protected hWnd
  
  hWnd = OpenWindow(0,#PB_Ignore,#PB_Ignore,640,480,"leer",#WS_OVERLAPPEDWINDOW)
  SmartWindowRefresh(0,1)
  CreateGadgetList(hWnd)
  
  NewSciGadget(0,0,0,640,480,@ScintillaCallBack())
  
  text.s = "Function test()"        + #lf$
  text.s + "  ' blub"               + #lf$
  text.s + "  Dim blub as Integer " + #lf$
  text.s + "End Function "          + #lf$
  
  SetGadgetText(0,text+#lf$+text)
  
  
  Repeat
    event = WaitWindowEvent()
    
    If event = #PB_Event_SizeWindow
      ResizeGadget(0,#PB_Ignore,#PB_Ignore,WindowWidth(0),WindowHeight(0))
    EndIf
    
  Until event = #PB_Event_CloseWindow
	
	
EndProcedure:main()

Verfasst: 20.06.2007 20:02
von ts-soft
@edel
danke für das schöne Beispiel :allright:

Hatte zwar auch eins angefangen, aber nicht so schön. Hab gerade
festegestellt das man unbedingt eine akt. SciLexer.dll nutzen muß, ältere
Versionen zeigen einfach nur den Text ohne irgendwas an :freak:
Version 1.71 ging nicht, 1.74 läuft

Verfasst: 20.06.2007 20:06
von Rings
@Edel Danke für das Beispiel. Das funktioniert hier so
wie ich es mir vorstelle.
Danke auch nochmals an TS für deine Mühe.
Ich denke damit kann ich jetzt loslegen....

Verfasst: 26.08.2007 23:56
von X0r
Wie mach ich das jetzt, wenn ich HTML, PHP und JavaScript haben möchte? PHP alleine bekomme ich nicht mal auf die Reihe. Müssen da bestimmte keywords hinzugefügt werden?

Verfasst: 28.08.2007 03:02
von X0r
:oops:

<?

?>

müssen gesetzt werden, damit die Keywords fabig dargstellt werden.
Aber was ist mit Klappen? Wie mach ichs da mit <? und ?>?
Und wie funktioniert das mit Intellisense für Variabeln?

Verfasst: 28.08.2007 11:11
von ts-soft
Lade Dir wscite und guck in die konfigurationsdateien.

Verfasst: 28.08.2007 19:34
von X0r
WSciTE? Soll das ein Hack sein?