# WxRuby + Scintilla avec HTML + JavaScript

**URL:** <https://www.ruby-forum.com/t/wxruby-scintilla-avec-html-javascript/121618>\
**Category:** wxRuby\
**Created:** [November 29, 2007, 11:38am UTC](https://www.ruby-forum.com/t/wxruby-scintilla-avec-html-javascript/121618 "2007-11-29T11:38:07Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Bul](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/aeb1de/32.png) [@Bul](https://www.ruby-forum.com/u/Bul)\
**Post date:** [November 29, 2007, 11:38am UTC](https://www.ruby-forum.com/t/wxruby-scintilla-avec-html-javascript/121618/1 "2007-11-29T11:38:07Z")

</div>

bonjour à toutes et à tous,

d’abord désolé de ne pas parler/lire/comprendre l’américain/l’anglais,  
ce qui fait que j’ai beaucoup de mal à comprendre la doc par exemple.

j’ai un souci d’utilisation de WXRuby avec SCIntilla,  
dans le cas d’un HTML + Javascript.  
je suis parti bien entendu de l’exemple scintilla.rb fourni,  
qui fonctionne parfaitement, mais pas je ne parviens pas  
à appliquer pour le JavaScript inclus.

========== début du script ==========  
require ‘wx’  
include Wx  
class MyFrame \< Frame  
def initialize()  
super( nil, -1, ‘test’, [100,100], [500,400] )  
@sci = Wx::StyledTextCtrl.new( self )  
line\_num\_margin = @sci.text\_width( STC\_STYLE\_LINENUMBER, “\_99999” )  
@sci.set\_margin\_width( 0, line\_num\_margin )  
@sci.set\_lexer\_language( ‘hypertext’ )  
@sci.style\_clear\_all()  
@sci.style\_set\_foreground( 0, Wx::Colour.new(0,0,0) )  
@sci.style\_set\_foreground( 1, Wx::Colour.new(0,0,0xFF) )  
@sci.style\_set\_foreground( 2, Wx::Colour.new(0,0xFF,0) )  
@sci.style\_set\_foreground( 3, Wx::Colour.new(0,0xFF,0xFF) )  
@sci.style\_set\_foreground( 4, Wx::Colour.new(0xFF,0,0) )  
@sci.style\_set\_foreground( 5, Wx::Colour.new(0xFF,0,0xFF) )  
@sci.style\_set\_foreground( 6, Wx::Colour.new(0xF0,0xF0,0) )  
@sci.style\_set\_foreground( 7, Wx::Colour.new(0xA0,0xA0,0xA0) )  
@sci.set\_key\_words( 0, ‘a abbr acronym address applet area b base  
basefont bdo big blockquote body’+  
’ br button caption center cite code col colgroup dd del dfn  
dir div dl’+  
’ dt em fieldset font form frame frameset h1 h2 h3 h4 h5 h6  
head hr html’+  
’ i iframe img input ins isindex kbd label legend li link map  
menu meta’+  
’ noframes noscript object ol optgroup option p param pre q s  
samp script’+  
’ select small span strike strong style sub sup table tbody td  
textarea’+  
’ tfoot th thead title tr tt u ul var xml xmlns’ )  
@sci.set\_key\_words( 1, ‘and break case catch char ‘+  
’ const continue default delete do else’+  
’ for function if in’+  
’ new return’+  
’ switch this typeof var void ‘+  
’ while with’ )  
end  
end  
class RbApp \< App  
def on\_init  
frm = MyFrame.new()  
frm.show(TRUE)  
end  
end  
a = RbApp.new  
a.main\_loop()  
========== fin du script ==========

et si on fait un copié/collé d’une page html avec du javascript,  
celui-ci est souligné avec ~ et non coloré

```
qu'ai-je oublié ? mal compris ? mal fait ?

```

merci d’avance si vous pouvez m’aider, me dire où trouver une exemple…

Cordialement.
