Colors of scilex control disappear

Discussions related to Visual Prolog
User avatar
Ferenc Nagy
VIP Member
Posts: 215
Joined: 24 Apr 2007 12:26

Colors of scilex control disappear

Unread post by Ferenc Nagy »

Respected Extraordinary Scilex Experts:
I displayed six forms containing only a scilex control from the OnOKClick procedure of an other form within a foreach block. I saw yellow blinking then black on white text written in proportional font instead of monospace one. I put sleep(2000) calls at several lines. This way I could the tables in the forms as I had dreamed them for a while but when the program reached the end foreach and it finished the OnOKClick procedure the scilex texts have lost their color and got back the default Tahoma font so the columns of the table looked like oxen piss.

Can you recommend a forum dealing with scilex?
TIA, Regards,
Frank Nagy
User avatar
Ferenc Nagy
VIP Member
Posts: 215
Joined: 24 Apr 2007 12:26

I have the modified the scilex predicates. Now the background colors are saved.

Unread post by Ferenc Nagy »

Hi,
I have found why the copy of scilex controls lost some information.
The following code fragment contains the corrected getHTML and WriteHTML predicates and clauses.

Code: Select all

predicates     % 2014.11.21. Modified by Ferenc Nagy     % Write HTML with background colors and ornamentation.     writeHTML : (outputStream S, sciLexer_native::sci_style Style, integer From, integer Next, integer To).       getHTML : (integer From, integer To) -> string HTML.   constants   font_format="<span style=\"font-family:'%';font-size:%pt%".   color_format='%:#%02x%02x%02x%'.   clauses     getHTML(From, To) = S:getString():-         From<To,         S = outputStream_string::new(),         writeHTML(S, noStyle, From, From, To),         !.     getHTML(_,_) = "".     constants     noStyle = 255.   facts - ornamentation     unclosed_span: boolean := false.     font_is_Bold:vpiDomains::fs := 0.     font_is_Underline:vpiDomains::fs := 0.     font_is_Italic:vpiDomains::fs := 0.   clauses     writeHTML(S, StylePre, Start, From, To) :-         From < To,         Char = tryGetCharAt(From),         !,         if Style = tryGetStyleAt(From) then else Style = noStyle end if,         if StylePre <> Style then            if Start<From then               if noStyle <> StylePre then                 if unclosed_span=true then                     S:write("</span>"),                     unclosed_span:=false                 end if,                 if font_is_Italic=vpiDomains::fs_Italic then                     S:write("</i>"),                     font_is_Italic:=0                 end if,                 if font_is_Underline=vpiDomains::fs_UnderLine then                     S:write("</u>"),                     font_is_Underline:=0                 end if,                 if font_is_Bold=vpiDomains::fs_Bold then                     S:write("</b>"),                     font_is_Bold:=0                 end if               end if             end if,                 if noStyle <> Style then                 if styleGetBold(Style)=true then                     Bold = fs_Bold,                     S:write("<b>")                 else                     Bold = 0                 end if,                 font_is_Bold:=Bold,                 if styleGetUnderline(Style)=true then                     Underline = fs_Underline,                     S:write("<u>")                 else                     Underline = 0                 end if,                 font_is_Underline:=Underline,                 if styleGetItalic(Style)=true then                     Italic = fs_Italic,                     S:write("<i>")                 else                     Italic = 0                 end if,                 font_is_Italic:=Italic,      % Ferenc Nagy 2014.11.21. Write HTML with background and ornamentation.                 FColor = styleGetFore(Style),                 FB = FColor mod 0x100,                 FG = FColor div 0x100 mod 0x100,                 FR = FColor div 0x10000 mod 0x100,                 BColor = styleGetBack(Style),                 BB = BColor mod 0x100,                 BG = BColor div 0x100 mod 0x100,                 BR = BColor div 0x10000 mod 0x100,                 unclosed_span:=true,                 S:writef(font_format,                     styleGetFont(Style), styleGetSize(Style),";"),                 S:writef(color_format,'color', FB, FG, FR,";"),                 S:writef(color_format,'background-color', BG, BB, BR,'">')        % !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!             end if         end if,         if Encoded = mustEncode(Char) then             S:write(Encoded)         else             S:write(Char)         end if,         if Next = tryPositionAfter(From) then             writeHTML(S, Style, Start, Next, To)         end if.       writeHTML(S, _Style, _Start, _From, _To) :-         if unclosed_span=true then             S:write("</span>"),             unclosed_span:=false         end if,         if font_is_Italic=vpiDomains::fs_Italic then             S:write("</i>"),             font_is_Italic:=0         end if,         if font_is_Underline=vpiDomains::fs_UnderLine then             S:write("</u>"),             font_is_Underline:=0         end if,         if font_is_Bold=vpiDomains::fs_Bold then             S:write("</b>"),             font_is_Bold:=0         end if.      
The attached archive contains
Source files;
Screenshots of selected lines,
saved as Word and HTML.
TIA, Regards,
Frank Nagy
User avatar
Ferenc Nagy
VIP Member
Posts: 215
Joined: 24 Apr 2007 12:26

I have the modified the scilex predicates. Now the background colors are saved.

Unread post by Ferenc Nagy »

Hi,
I have found why the copy of scilex controls lost some information.
The following code fragment contains the corrected getHTML and WriteHTML predicates and clauses.

Code: Select all

predicates     % 2014.11.21. Modified by Ferenc Nagy     % Write HTML with background colors and ornamentation.     writeHTML : (outputStream S, sciLexer_native::sci_style Style, integer From, integer Next, integer To).       getHTML : (integer From, integer To) -> string HTML.   constants   font_format="<span style=\"font-family:'%';font-size:%pt%".   color_format='%:#%02x%02x%02x%'.   clauses     getHTML(From, To) = S:getString():-         From<To,         S = outputStream_string::new(),         writeHTML(S, noStyle, From, From, To),         !.     getHTML(_,_) = "".     constants     noStyle = 255.   facts - ornamentation     unclosed_span: boolean := false.     font_is_Bold:vpiDomains::fs := 0.     font_is_Underline:vpiDomains::fs := 0.     font_is_Italic:vpiDomains::fs := 0.   clauses     writeHTML(S, StylePre, Start, From, To) :-         From < To,         Char = tryGetCharAt(From),         !,         if Style = tryGetStyleAt(From) then else Style = noStyle end if,         if StylePre <> Style then            if Start<From then               if noStyle <> StylePre then                 if unclosed_span=true then                     S:write("</span>"),                     unclosed_span:=false                 end if,                 if font_is_Italic=vpiDomains::fs_Italic then                     S:write("</i>"),                     font_is_Italic:=0                 end if,                 if font_is_Underline=vpiDomains::fs_UnderLine then                     S:write("</u>"),                     font_is_Underline:=0                 end if,                 if font_is_Bold=vpiDomains::fs_Bold then                     S:write("</b>"),                     font_is_Bold:=0                 end if               end if             end if,                 if noStyle <> Style then                 if styleGetBold(Style)=true then                     Bold = fs_Bold,                     S:write("<b>")                 else                     Bold = 0                 end if,                 font_is_Bold:=Bold,                 if styleGetUnderline(Style)=true then                     Underline = fs_Underline,                     S:write("<u>")                 else                     Underline = 0                 end if,                 font_is_Underline:=Underline,                 if styleGetItalic(Style)=true then                     Italic = fs_Italic,                     S:write("<i>")                 else                     Italic = 0                 end if,                 font_is_Italic:=Italic,      % Ferenc Nagy 2014.11.21. Write HTML with background and ornamentation.                 FColor = styleGetFore(Style),                 FB = FColor mod 0x100,                 FG = FColor div 0x100 mod 0x100,                 FR = FColor div 0x10000 mod 0x100,                 BColor = styleGetBack(Style),                 BB = BColor mod 0x100,                 BG = BColor div 0x100 mod 0x100,                 BR = BColor div 0x10000 mod 0x100,                 unclosed_span:=true,                 S:writef(font_format,                     styleGetFont(Style), styleGetSize(Style),";"),                 S:writef(color_format,'color', FB, FG, FR,";"),                 S:writef(color_format,'background-color', BG, BB, BR,'">')        % !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!             end if         end if,         if Encoded = mustEncode(Char) then             S:write(Encoded)         else             S:write(Char)         end if,         if Next = tryPositionAfter(From) then             writeHTML(S, Style, Start, Next, To)         end if.       writeHTML(S, _Style, _Start, _From, _To) :-         if unclosed_span=true then             S:write("</span>"),             unclosed_span:=false         end if,         if font_is_Italic=vpiDomains::fs_Italic then             S:write("</i>"),             font_is_Italic:=0         end if,         if font_is_Underline=vpiDomains::fs_UnderLine then             S:write("</u>"),             font_is_Underline:=0         end if,         if font_is_Bold=vpiDomains::fs_Bold then             S:write("</b>"),             font_is_Bold:=0         end if.      
The attached archive contains
Source files;
and difference files.
Attachments
sciLexer.i
(1.22 KiB) Downloaded 335 times
i-diff.html
(12.58 KiB) Downloaded 403 times
TIA, Regards,
Frank Nagy
Post Reply