Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.clipper.visual-objects > #4944

Re: Different colors in MulitlineEdit

From Alain Carpentier <alain.dot.carpentier@brutele.dot.be>
Newsgroups comp.lang.clipper.visual-objects
Subject Re: Different colors in MulitlineEdit
Date 2013-03-21 22:28 +0100
Organization Aioe.org NNTP Server
Message-ID <kifu19$o44$1@speranza.aioe.org> (permalink)
References <80844b9e-a232-4111-aeab-d1330d0515a4@googlegroups.com> <7f2c7f98-73fe-4102-88df-7599c70054ea@googlegroups.com>

Show all headers | View raw


An example

LOCAL r AS RTF
LOCAL c as string

r := rtf{}
c := r:Debut() +  r:Color(1)  + r:Gras + "BOLD RED"  + r:Plain() + r:Par 
+ r:Soul +  r:Color(11) + "UNDERLINED BLUE"  + r:Plain() + r:Par + r:Fin

oRichEdit:Value := c

----------------------------------------
CLASS RTF
     INSTANCE cTableFont AS STRING
     INSTANCE cTableColor AS STRING
     EXPORT dwSize as DWORD
     EXPORT dwPolice AS DWORD
     EXPORT dwColor AS DWORD

METHOD Color(nColor) CLASS RTF
     local cReturn as string

     IF IsNumeric(nColor)
         self:dwColor := nColor
     endif
     cReturn := "\cf" + NTrim(self:dwColor)
RETURN cReturn

METHOD Debut(nPolice, nSize, nColor) CLASS RTF
RETURN "{\rtf1\ansi\deff0\deftab720"+ SELF:cTableFont + CRLF + 
SELF:cTableColor +;
CRLF + 
"\deflang1036\pard\tx0\tx0\tx0\tx0\tx0\tx0\tx0\tx0\tx0\tx0\tx0\tx0\tx0\tx0\plain" 
+;
self:Police(nPolice) + self:Taille(nSize) + self:Color(nColor)	

ACCESS Fin CLASS RTF
RETURN SELF:Plain() + CRLF + "\par }"

ACCESS Gras CLASS RTF
RETURN "\b "

METHOD Init() CLASS RTF
     SELF:cTableFont := "{\fonttbl"+;
     "{\f0\fswiss MS Sans Serif;}"+;     // police 0
     "{\f1\fmodern\fprq1 Courier New;}"+;  // police 1
     "{\f2\fswiss\fprq2 Arial;}"+;       // police 2
     "}"

     SELF:cTableColor := "{\colortbl" + ;
     "\red0\green0\blue0;" +;		// cf0 Noir
     "\red128\green0\blue0;" +;      	// cf1 Rouge foncé
     "\red128\green128\blue0;" +;    	// cf2 Marron clair
     "\red0\green0\blue128;" +; 		// cf3 Bleu foncé
     "\red128\green0\blue128;" +;    	// cf4 Violet
     "\red0\green128\blue0;" +;      	// cf5 vert
     "\red128\green128\blue128;" +;  	// cf6 Gris clair
     "\red192\green192\blue192;" +;  	// cf7 Gris foncé
     "\red255\green0\blue0;" +;      	// cf8 Rouge
     "\red0\green128\blue128;" +;    	// cf9 Bleu-vert
     "\red255\green255\blue0;" +; 	// cf10 Jaune
     "\red0\green0\blue255;" +;      	// cf11 Bleu
     "\red255\green0\blue255;" +;    	// cf12 Magenta
     "\red0\green255\blue0;" +;      	// cf13 Vert
     "\red255\green255\blue255;" +;  	// cf14 Blanc
     "\red0\green255\blue255;}"   	// cf15 Cyan

    self:dwSize := 10
    self:dwPolice := 2
    self:dwColor := 0
RETURN SELF

ACCESS Ital CLASS RTF
RETURN "\i "

ACCESS Par CLASS RTF
RETURN CRLF +  "\par "

METHOD Plain(nPolice, nSize, nColor) CLASS RTF
RETURN "\plain" + self:Police(nPolice) + self:Taille(nSize) + 
self:Color(nColor) + " "

METHOD Police(nPolice) CLASS RTF
     LOCAL cReturn AS STRING

     IF IsNumeric(nPolice)
         SELF:dwPolice := nPolice
     endif		

     DO CASE
     CASE self:dwPolice = 1
         cReturn := "\f1"		
     CASE self:dwPolice = 2
         cReturn := "\f2"
     otherwise
         cReturn := "\f2"
     ENDCASE
RETURN cReturn

METHOD RC2PAR(cTexte) CLASS RTF
     local cReturn as string
     Default(@cTexte, "")
     // remplacer les retours chariots par des "\par "

     if IsString(cTexte)
         cReturn := StrTran(cTexte,retourchariot,"\par ")
     endif
RETURN cReturn

ACCESS Soul CLASS RTF
RETURN "\ul "
ACCESS Tab CLASS RTF
RETURN "\tab "

METHOD Taille(nSize) CLASS RTF
     local cReturn as string

     if IsNumeric(nSize)
         self:dwSize := nSize
     endif
     cReturn := "\fs" + NTrim(self:dwSize*2)
RETURN cReturn

Alain

Le 21/03/2013 16:11, Lu a écrit :
> I have never used a RTF control, so are there some examples where eg. the second row has another color than the first row... or something similar examples?
>
> I could not find much information in the VO help.
>
> There is only a text, and on Cellselect in bBrowser it will be changed. On a condition a text in the rtf control should be highlighted.
>
> Lu
>

Back to comp.lang.clipper.visual-objects | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Different colors in MulitlineEdit Lu <lu2k@hotmail.com> - 2013-03-21 03:22 -0700
  Re: Different colors in MulitlineEdit "Wolfgang Riedmann" <wriedmann@gmail.com> - 2013-03-21 11:43 +0100
  Re: Different colors in MulitlineEdit Lu <lu2k@hotmail.com> - 2013-03-21 04:30 -0700
    Re: Different colors in MulitlineEdit "Wolfgang Riedmann" <wriedmann@gmail.com> - 2013-03-21 14:13 +0100
  Re: Different colors in MulitlineEdit Lu <lu2k@hotmail.com> - 2013-03-21 08:11 -0700
    Re: Different colors in MulitlineEdit "Wolfgang Riedmann" <wriedmann@gmail.com> - 2013-03-21 16:54 +0100
    Re: Different colors in MulitlineEdit "Er!k \\/!$$Er" <nospam@nospam.url> - 2013-03-21 18:34 +0100
    Re: Different colors in MulitlineEdit Alain Carpentier <alain.dot.carpentier@brutele.dot.be> - 2013-03-21 22:28 +0100
  Re: Different colors in MulitlineEdit Lu <lu2k@hotmail.com> - 2013-03-22 00:57 -0700
  Re: Different colors in MulitlineEdit "Urs Eggmann" <Urs.Eggmann@shinternet.ch> - 2013-04-18 23:15 +0200

csiph-web