Diese Seite mit anderen teilen ...

Informationen zum Thema:
Forum:
WinDev Forum
Beiträge im Thema:
4
Erster Beitrag:
vor 8 Jahren, 8 Monaten
Letzter Beitrag:
vor 8 Jahren, 8 Monaten
Beteiligte Autoren:
Georgio, Piet van Zanten, Al

Changing color of specific text in a table

Startbeitrag von Georgio am 17.04.2009 18:32

Hi all,

I'm trying to do something a little different here. I have a routine that
looks at data in a table. If there is a string in a table cell that is upper-case,
then I want to change the text color to red.

Is there a way to do this? This is what I started to do but its returning an
error on:

TABLE_ABSTRACT.Detail[nRowNum][[nStartPos TO nEndPos]]..Color = iDarkRed

Thanks!
Georgio

>


sTblDetail = TABLE_ABSTRACT.Detail[nRowNum] // table data to color code

WHILE sLineRead EOT

n++
sLineRead = ExtractString(sTblDetail,n,CR)

// **************************************
// valid data found, perform color coding
// **************************************
IF sLineRead EOT THEN

nStartPos = Position(TABLE_ABSTRACT.Detail[nRowNum],sLineRead)
nEndPos = ((nStartPos + Length(sLineRead)) - 1)

// check if uppercase
sWorkString = Upper(sLineRead)


// *********************************
// data is uppercase, color code red
// *********************************
IF sWorkString = sLineRead THEN
TABLE_ABSTRACT.Detail[nRowNum][[nStartPos TO nEndPos]]..Color = iDarkRed
END

END


END

Antworten:

Hello Georgio

You don't mention which part of the proc is giving the error - a debug trace will show that.
If it is the colour setting causing the problem then ...
In terms of memory tables (and I assume file tables) I always use the table row display property for colour changes as this fires for each row as it is displayed. So you could test for uppercase in the table row display event rather than a separate procedure

The syntax for a row colour change is:
Tablename[Tablename]..BrushColor = IDarkRed

The syntax for a cell colour change in V12 - I am not sure if earlier versions support cell colours- is :
Tablename[Tablename][ColumnNumber]..BrushColor = IDarkred

Regards
Al

von Al - am 18.04.2009 08:14
Hi Georgio,

Looking at your code I understand that you have a multiline tablecell in which you want to color some parts red. This is not possible on normal text cells. If you change the column type to rtf you can change color using the rtfSelection function. Note that there's mention of a restriction in the Helpfile: rtfSelection can only be used on the table colum currently in edit. So I suppose you have to use returntocapture. Or wait for Windev 14.

Regards,
Piet

von Piet van Zanten - am 18.04.2009 11:30
Quote
Piet van Zanten
Hi Georgio,

Looking at your code I understand that you have a multiline tablecell in which you want to color some parts red. This is not possible on normal text cells. If you change the column type to rtf you can change color using the rtfSelection function. Note that there's mention of a restriction in the Helpfile: rtfSelection can only be used on the table colum currently in edit. So I suppose you have to use returntocapture. Or wait for Windev 14.

Regards,
Piet


Thanks Piet! I was trying to color a specific section of a table. I did go the RTF route and found I could only do the color coding in edit mode.

I guess I'll wait until WD14.

Georgio

von Georgio - am 18.04.2009 23:06
Zur Information:
MySnip.de hat keinen Einfluss auf die Inhalte der Beiträge. Bitte kontaktieren Sie den Administrator des Forums bei Problemen oder Löschforderungen über die Kontaktseite.
Falls die Kontaktaufnahme mit dem Administrator des Forums fehlschlägt, kontaktieren Sie uns bitte über die in unserem Impressum angegebenen Daten.