Page 1 of 1

Coloring lines instead of keywords and data types

Posted: 7 Dec 2014 12:15
by Ferenc Nagy
Hi Thomas,
My goal is coloring whole lines instead of coloring keywords and data types.
I want to do coloring the lines by defining styles like
- plain
- title
- table header
- table body
- errors
- warnings.

I have written a Define_Styles class with interface called by the message window with the parameter of the scilex control.
Its constructor starts with the definition of the default lexer style followed by the loading and applying of my defined styles.

Code: Select all

% Construct object with default settings.     new(Lexer) :-         used_lexer:=Lexer,         used_lexer:clearAll(),         used_lexer:clearDocumentStyle(),         vpi::fontGetAttrs(taskWindow::main_font,_,_Size)=Name,         used_lexer:styleSetFont(style_default,Name),         used_lexer:lexerDefault_visualProlog(),         appendStyledLine(string::format("New state = %.",tostring(last_state)),style_name_and_value),         reuseLastSettings(last_state),         appendStyledLine(string::format("Reused state = %.",tostring(last_state)),style_name_and_value),        applyAllSettings(),    

Code: Select all

% Apply a setting given by its style number to the given control.     applyNumSetting(Num)  :-         style_setting(les(Num,_Sym,rgb(FR,FG,FB),rgb(BR,BG,BB),Fo)),         composeRGB(FR,FG,FB)=F,         composeRGB(BR,BG,BB)=B,         FontCoder=fontCoder::new_by_other_font_descriptor(Fo),         Fo=fo(_FontName,_SSCode,_FontClass,IsBold,IsUnderlined,IsItalic,Size),         used_lexer:styleSetFore(Num,F),         used_lexer:styleSetBack(Num,B),         used_lexer:styleSetFont(Num,FontCoder:name()),         used_lexer:styleSetBold(Num,IsBold),         used_lexer:styleSetUnderline(Num,IsUnderlined),         used_lexer:styleSetItalic(Num,IsItalic),         used_lexer:styleSetSize(Num,Size).       % Apply all settings to the given control.     applyAllSettings() :-         _=[Num||applyNumSetting( Num)].  
As you could see from the picture linked to my previous post, the lexer was styled later than I expected.
I have 3 kinds of forms calling scilexer controls in my program
1) the main message form created in the very beginning of the TaskWindow,
2) an interactive form where I can change the styles,
3) report windows in order to display the results.
All this kinds of windows invoke the scilex system using the same interface but I see different phenomena showing delay of obeying the style definitions.
1) The main message window obeys the definition after a few lines.
2) The style changing form displays color codes the new style settings using the default setings instead of the modified settings.
3) The report windows appear as if they were style only by

Code: Select all

The construction of the above kinds of scilexer message windows is performed by the same way.
One would expect that the styling behaves equally.
In spite of the similar invocation they behave differently.
The (1) main message windows if often covered by common dialog invoked by the Task menu.
The lines of the (3) report windows are written a simple cycle displaying table headers, -bodies, and footers.

See: ... es.hu_.png
There must be an window event in the deepest SCILEXER.DLL level which allows/delays to take the defined styles in effect. What is that?

Posted: 9 Dec 2014 18:03
by Thomas Linder Puls

Posted: 10 Dec 2014 6:11
by Ferenc Nagy
Yes, it is solved.
The remained question like what is the difference of addtext and appendtext, and where is the best scintilla forum and documentation are not so important.