Diese Seite mit anderen teilen ...

Informationen zum Thema:
Forum:
WinDev Forum
Beiträge im Thema:
11
Erster Beitrag:
vor 8 Jahren, 5 Monaten
Letzter Beitrag:
vor 8 Jahren, 5 Monaten
Beteiligte Autoren:
Piet van Zanten, Patrick Thijs, Xavier, Fabrice Harari.pcs.crosspost, Alexandre Leclerc, DW

how detect if someone is scrolling in a table-control

Startbeitrag von Patrick Thijs am 09.07.2009 11:27

Hello,

I'm searching for a way to detect if a user is scrolling in a table.
I need to know this because I have a routine that changes the color of a row based on the content of a certain column. This routine only needs to work when the table is filled (it is linked to a query), but NOT when a user scrolls in the table.
I'm using the Row_Display procedure of the tablecontrol to color the rows.
Perhaps there's a better way to do this ? But keep in mind that I'm working with quite large tables (> 50000 records) and "coloring" the rows must be done very fast

best regards,

Patrick

Antworten:

Hi Patrick,

I think the row display code should work even if you are scrolling and it should work only on rows that are currently displayed, so no extra overhead.
Can you give the code you use in the row display section?

regards,
Piet

von Piet van Zanten - am 09.07.2009 12:16
Hello Piet,

I just want it NOT to update when I'm scrolling, the normal update seems to work fine.
But if it's updating only the visible records in a table, then I have a problem...

The code for the row display section is very simple
SWITCH tblTracks.Status
CASE 1 // on disk
tblTracks[tblTracks]..Color = iWhite

CASE 2 // on site
tblTracks[tblTracks]..Color = RGB(153,153,255)

CASE 3 // requested
tblTracks[tblTracks]..Color = RGB(255,128,0)

CASE 4 // new
tblTracks[tblTracks]..Color = RGB(255,255,0)

CASE 5 // favorite
tblTracks[tblTracks]..Color = iLightGreen
END
CASE 1 // on disk
tblTracks[tblTracks]..Color = iWhite

CASE 2 // on site
tblTracks[tblTracks]..Color = RGB(153,153,255)

CASE 3 // requested
tblTracks[tblTracks]..Color = RGB(255,128,0)

CASE 4 // new
tblTracks[tblTracks]..Color = RGB(255,255,0)

CASE 5 // favorite
tblTracks[tblTracks]..Color = iLightGreen
END

von Patrick Thijs - am 09.07.2009 12:23
Hello Piet,

I just want it NOT to update when I'm scrolling, the normal update seems to work fine.
But if it's updating only the visible records in a table, then I have a problem...

The code for the row display section is very simple

SWITCH tblTracks.Status
CASE 1 // on disk
tblTracks[tblTracks]..Color = iWhite

CASE 2 // on site
tblTracks[tblTracks]..Color = RGB(153,153,255)

CASE 3 // requested
tblTracks[tblTracks]..Color = RGB(255,128,0)

CASE 4 // new
tblTracks[tblTracks]..Color = RGB(255,255,0)

CASE 5 // favorite
tblTracks[tblTracks]..Color = iLightGreen
END

von Patrick Thijs - am 09.07.2009 12:23
Hi Patrick,

I think you have the best approach. There is indeed no overhead with this method, even if scrolling is a bit slower. The only other alternative you have is to parse the 50K+ rows immediately after the query has loaded the data in the table. But this would cause a slow initial display.

Best regards.

von Alexandre Leclerc - am 09.07.2009 12:39
Hi Patrick,

Sorry if I misunderstand your question, but as I see it, coloring the rows is only relevant for the displayed ones. It's not necessary to color ALL the rows.
The row display code does exactly that: the code is only executed if a row is displayed.
So if a user scrolls the table and new rows become visible they are colored as needed.
Note that you have to leave out the subscript in your code.

Regards,
Piet


von Piet van Zanten - am 09.07.2009 14:10
Hi Patrick,

I think I'm mistaking here, because I can't think of a way to know the subscript of the row being displayed. You need the subscript to color a row.

Reagrds,
Piet

von Piet van Zanten - am 09.07.2009 14:21
Discard my previous post.
Just found a table in which I use this technique and it works fine
Row Display of table
IF col_Check[Table] THEN
Table[Table]..BrushColor=iLightRed
END

Regards,
Piet

von Piet van Zanten - am 09.07.2009 14:39
I agree with Piet,

But make sure you check the currentSubscript is greater then 0 or you will get an error if the table is empty.

//Set the color of the font for each row of the table
nRow is int = CurrentSubscript()

IF nRow > 0 THEN
IF NOT Table.COL_Comp_Status[nRow] THEN //
Table[nRow]..Color = DarkGray // Inactive calls
Table[nRow]..FontItalic = True
ELSE
Table[nRow]..Color = Default // All others
Table[nRow]..FontItalic = False
END
END

Dennis

von DW - am 09.07.2009 19:32
Hi Dennis

if the code is the Row Display area, then there IS a row, and the
subscript cannot be 0

Best regards

--
Fabrice Harari
International WinDev, WebDev and WinDev mobile Consulting

More information on http://www.fabriceharari.com


Dennis W wrote:
> I agree with Piet,
> But make sure you check the currentSubscript is greater then 0 or you will get an error if the table is empty.
> //Set the color of the font for each row of the table
> nRow is int = CurrentSubscript()
> IF nRow > 0 THEN
> IF NOT Table.COL_Comp_Status[nRow] THEN //
> Table[nRow]..Color = DarkGray // Inactive calls
> Table[nRow]..FontItalic = True
> ELSE
> Table[nRow]..Color = Default // All others
> Table[nRow]..FontItalic = False
> END
> END
> Dennis
>
Message forwarded from pcsoft.us.windev

von Fabrice Harari.pcs.crosspost - am 10.07.2009 11:34
Hi Patrick,

what do you think of this?


wiEvent = Event(lpTest,Table_Klant..Name,1750)

PROCEDURE lpTest()
Trace(_EVE.nom,_EVE.wMessage,_EVE.wParam,_EVE.lParam)


with _EVE.lParam = the index of the first visible row in the table during scrolling.

Kind regards
Xavier
----------------------------
Xavier Schauwvlieghe
Micronaos bvba
WinDev/WebDev/Mobile consultant

von Xavier - am 10.07.2009 13:03
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.