class Iup::Scintilla

A powerful text element. The API documentation can only hint at the use of this control. For more information see Tecgraf’s documentation on IupScintilla and the Scintilla website.

Example

The following example sets up a Scintilla text widget handling some cpp code. Notice the setup of the keywords and styling settings. Also, the text widget must be placed into a dialog and mapped before its other attributes are set and the dialog shown.

text = Iup::Scintilla.new 

dlg = Iup::Dialog.new(text) do |d|
  d.title = 'Scintilla example'
  d.size = '300x200'
end.map

text.expand = 'YES'
text.lexerlanguage = 'cpp'
text.keywords(0, "void struct union enum char short int long double float
  signed unsigned const static extern auto register volatile bool class
  private protected public friend inline template virtual asm explicit
  typename mutable if else switch case default break goto return for while
  do continue typedef sizeof NULL new delete throw try catch namespace
  operator this const_cast static_cast dynamic_cast reinterpret_cast true
  false using typeid and and_eq bitand bitor compl not not_eq or or_eq xor
  xor_eq")
text.stylefont(32, 'Consolas')
text.stylefontsize(32, 11)
text.styleclearall = 'Yes'
text.stylefgcolor(1, '0 128 0') # 1 - C Comment
text.stylefgcolor(2, '0 128 0') # 2 - C++ Comment line
text.stylefgcolor(4, '128 0 0') # 4 - Number
text.stylefgcolor(5, '0 0 255') # 5 - Keyword
text.stylefgcolor(6, '160 20 20') # 6 - String
text.stylefgcolor(7, '128 0 0') # 7 - Character
text.stylefgcolor(9, '0 0 255') # 9 - Preprocessor block
text.stylefgcolor(10, '255 0 255') # 10 - Operator
text.stylebold(10, 'YES')
text.stylehotspot(6, 'YES')
text.marginwidth(0, 50)
text.property('fold', 1)
text.property('fold.compact', 0)
text.property('fold.comment', 1)
text.property('fold.preprocessor', 1)
text.marginwidth(1, 20)
text.margintype(1, 'SYMBOL')
text.marginmaskfolders(1, 'Yes')

text.markerdefine('folder', 'plus')
text.markerdefine('folderopen', 'minus')
text.markerdefine('folderend', 'empty')
text.markerdefine('foldermidtail', 'empty')
text.markerdefine('folderopenmid', 'empty')
text.markerdefine('foldersub', 'empty')
text.markerdefine('foldertail', 'empty')

text.foldflags = 'lineafter_contracted'

text.marginsensitive(1, 'YES')

dlg.show