Rich - alterando cores durante edicao |
Top Previous Next |
|
No evento OnChange eu acrescentei as seguintes linhas de código:
// Procura a posição Inicial!! SelAtual := SJG.SelStart; PosIni := SelAtual; if PosIni > 0 then if (Pos(SJG.Text[PosIni],FimPalavra) <> 0) then Dec(PosIni); while (PosIni > 0) and (Pos(SJG.Text[PosIni],FimPalavra) = 0) do Dec(PosIni); Inc(PosIni); // Procura a posição Final PosFim := SelAtual; while (PosFim < Length(SJG.Text)) and (Pos(SJG.Text[PosFim],FimPalavra) = 0) do Inc(PosFim); if PosFim > 0 then if (Pos(SJG.Text[PosFim],FimPalavra) <> 0) then Dec(PosFim); // Identifica a palavra Palavra := UpperCase(Copy(SJG.Text,PosIni,PosFim-PosIni+1)); // Label1.Caption := IntToStr(Length(Palavra)) + ' ' + Palavra; // Seleciona a palavra SJG.SelStart := PosIni-1; SJG.SelLength := PosFim-PosIni+1; // Define atributos básicos SJG.SelAttributes.Style := []; SJG.SelAttributes.Color := clBlack;
// Aqui faça a sua rotina para verificar o comando e mude os valores definidos em SelAttributes...
João Gilberto Magalhães http://www.cpunet.com.br/jg |