ScintillaGadget

Just starting out? Need help? Post your questions and find answers here.
michaeled314
Enthusiast
Enthusiast
Posts: 340
Joined: Tue Apr 24, 2007 11:14 pm

ScintillaGadget

Post by michaeled314 »

Could someone please give me a working example for ScintillaGadget function for PB 4.10 Beta 4
User avatar
Comtois
Addict
Addict
Posts: 1432
Joined: Tue Aug 19, 2003 11:36 am
Location: Doubs - France

Post by Comtois »

A small one

Code: Select all

;http://www.purebasic.fr/german/viewtopic.php?t=13234, merci ts-soft.

EnableExplicit

If InitScintilla("scintilla.dll") = #False
  MessageRequester("Erreur","Scintilla.DLL n'a pas pu être chargé",0)
  End
EndIf

Enumeration; Gadgets
  #SciID
EndEnumeration

Procedure ScintillaCallBack(EditorGadget.l, *scinotify.SCNotification)
  If *scinotify\nmhdr\code = #SCN_STYLENEEDED
    ScintillaSendMessage(EditorGadget, #SCI_LINEFROMPOSITION, ScintillaSendMessage(EditorGadget, #SCI_GETENDSTYLED))
 EndIf
EndProcedure

Procedure CreatePBSource()
  Protected WFlags.l = #PB_Window_MaximizeGadget | #PB_Window_MinimizeGadget | #PB_Window_SystemMenu | #PB_Window_SizeGadget
  Protected temp.s
  If OpenWindow(1, #PB_Ignore, 0, 640, 480, "Tests avec Scintilla", WFlags)
    CreateGadgetList(WindowID(1))
    ScintillaGadget(#SciID, 20, 20, 600, 440, @ScintillaCallBack())
   
    ScintillaSendMessage(#SciID, #SCI_STYLESETBACK, #STYLE_DEFAULT, $BEFCFD) ; Couleur de fond
    temp = "Lucida BlackLetter"
    ScintillaSendMessage(#SciID, #SCI_STYLESETFONT, #STYLE_DEFAULT, @temp) ; Police
    ScintillaSendMessage(#SciID, #SCI_STYLESETSIZE, #STYLE_DEFAULT, 24)    ; Taille police
    ScintillaSendMessage(#SciID, #SCI_STYLECLEARALL)
    ScintillaSendMessage(#SciID, #SCI_STYLESETFORE, 0, $FF0000)            ;Couleur du texte
    ScintillaSendMessage(#SciID, #SCI_SETMARGINTYPEN, 0, #SC_MARGIN_NUMBER)
    ScintillaSendMessage(#SciID, #SCI_SETMARGINWIDTHN, 0, 40) ; Largeur Marge
    ScintillaSendMessage(#SciID, #SCI_STYLESETBACK, #STYLE_LINENUMBER, #Gray) ;Couleur de la marge
    ScintillaSendMessage(#SciID, #SCI_STYLESETFORE, #STYLE_LINENUMBER, #Yellow) ;Couleur Texte de la marge
    ProcedureReturn 1
  EndIf
  ProcedureReturn 0
EndProcedure

If CreatePBSource()
  Repeat
    Select WaitWindowEvent()
      Case #PB_Event_CloseWindow : Break
    EndSelect
  ForEver
EndIf
Please correct my english
http://purebasic.developpez.com/
Post Reply