DataGrid LayoutControl message being sent many, many times

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: Klaus, FourthWorld, heatherlaine, kevinmiller

Post Reply
dpatterson
Posts: 24
Joined: Wed Jan 18, 2017 5:38 pm

DataGrid LayoutControl message being sent many, many times

Post by dpatterson » Wed Jan 25, 2017 8:47 pm

In working with the DataGrid and trying to understand the various messages, I observed what seems to me to be very odd behavior and I'm hoping someone can explain it to me.

I added some logging to the LayoutControl message handler so that I could observe the order and content of the messages. Specifically, it logs the dgIndex, dgColumn, and the rect.

Code: Select all

logDebug( "index: '" & the dgIndex of me \
         & "', column: '" & the dgColumn of me \
         & "',"  && "rect:" && pControlRect )
The logDebug() function writes the passed string to a scrolling field and appends a cr so that I can collect and scroll through lots of messages while developing and debugging.

The first oddity that I noticed is that dgIndex is always empty (see the log output below).

Next was the number of times that the message is sent. My grid has five visible columns and is populated with three records. I was expecting to see the LayoutMessasge sent 15 times. Instead it is sent to the same column 15 times for each record, each time with a different rect. :?

Here is the log output:

Code: Select all

[11:12:04 AM] index: '', column: 'name', rect: 6,42,241,63
[11:12:04 AM] index: '', column: 'name', rect: 6,63,241,84
[11:12:04 AM] index: '', column: 'name', rect: 6,84,241,105
[11:12:04 AM] index: '', column: 'name', rect: 6,105,241,126
[11:12:04 AM] index: '', column: 'name', rect: 6,126,241,147
[11:12:04 AM] index: '', column: 'name', rect: 6,147,241,168
[11:12:04 AM] index: '', column: 'name', rect: 6,168,241,189
[11:12:04 AM] index: '', column: 'name', rect: 6,189,241,210
[11:12:04 AM] index: '', column: 'name', rect: 6,210,241,231
[11:12:04 AM] index: '', column: 'name', rect: 6,231,241,252
[11:12:04 AM] index: '', column: 'name', rect: 6,252,241,273
[11:12:04 AM] index: '', column: 'name', rect: 6,273,241,294
[11:12:04 AM] index: '', column: 'name', rect: 6,294,241,315
[11:12:04 AM] index: '', column: 'name', rect: 6,315,241,336
[11:12:04 AM] index: '', column: 'name', rect: 6,336,241,357
[11:12:04 AM] index: '', column: 'acceptsPartials', rect: 241,42,302,63
[11:12:04 AM] index: '', column: 'acceptsPartials', rect: 241,63,302,84
[11:12:04 AM] index: '', column: 'acceptsPartials', rect: 241,84,302,105
[11:12:04 AM] index: '', column: 'acceptsPartials', rect: 241,105,302,126
[11:12:04 AM] index: '', column: 'acceptsPartials', rect: 241,126,302,147
[11:12:04 AM] index: '', column: 'acceptsPartials', rect: 241,147,302,168
[11:12:04 AM] index: '', column: 'acceptsPartials', rect: 241,168,302,189
[11:12:04 AM] index: '', column: 'acceptsPartials', rect: 241,189,302,210
[11:12:04 AM] index: '', column: 'acceptsPartials', rect: 241,210,302,231
[11:12:04 AM] index: '', column: 'acceptsPartials', rect: 241,231,302,252
[11:12:04 AM] index: '', column: 'acceptsPartials', rect: 241,252,302,273
[11:12:04 AM] index: '', column: 'acceptsPartials', rect: 241,273,302,294
[11:12:04 AM] index: '', column: 'acceptsPartials', rect: 241,294,302,315
[11:12:04 AM] index: '', column: 'acceptsPartials', rect: 241,315,302,336
[11:12:04 AM] index: '', column: 'acceptsPartials', rect: 241,336,302,357
[11:12:04 AM] index: '', column: 'dateCreated', rect: 302,42,392,63
[11:12:04 AM] index: '', column: 'dateCreated', rect: 302,63,392,84
[11:12:04 AM] index: '', column: 'dateCreated', rect: 302,84,392,105
[11:12:04 AM] index: '', column: 'dateCreated', rect: 302,105,392,126
[11:12:04 AM] index: '', column: 'dateCreated', rect: 302,126,392,147
[11:12:04 AM] index: '', column: 'dateCreated', rect: 302,147,392,168
[11:12:04 AM] index: '', column: 'dateCreated', rect: 302,168,392,189
[11:12:04 AM] index: '', column: 'dateCreated', rect: 302,189,392,210
[11:12:04 AM] index: '', column: 'dateCreated', rect: 302,210,392,231
[11:12:04 AM] index: '', column: 'dateCreated', rect: 302,231,392,252
[11:12:05 AM] index: '', column: 'dateCreated', rect: 302,252,392,273
[11:12:05 AM] index: '', column: 'dateCreated', rect: 302,273,392,294
[11:12:05 AM] index: '', column: 'dateCreated', rect: 302,294,392,315
[11:12:05 AM] index: '', column: 'dateCreated', rect: 302,315,392,336
[11:12:05 AM] index: '', column: 'dateCreated', rect: 302,336,392,357
[11:12:05 AM] index: '', column: 'dateModified', rect: 392,42,482,63
[11:12:05 AM] index: '', column: 'dateModified', rect: 392,63,482,84
[11:12:05 AM] index: '', column: 'dateModified', rect: 392,84,482,105
[11:12:05 AM] index: '', column: 'dateModified', rect: 392,105,482,126
[11:12:05 AM] index: '', column: 'dateModified', rect: 392,126,482,147
[11:12:05 AM] index: '', column: 'dateModified', rect: 392,147,482,168
[11:12:05 AM] index: '', column: 'dateModified', rect: 392,168,482,189
[11:12:05 AM] index: '', column: 'dateModified', rect: 392,189,482,210
[11:12:05 AM] index: '', column: 'dateModified', rect: 392,210,482,231
[11:12:05 AM] index: '', column: 'dateModified', rect: 392,231,482,252
[11:12:05 AM] index: '', column: 'dateModified', rect: 392,252,482,273
[11:12:05 AM] index: '', column: 'dateModified', rect: 392,273,482,294
[11:12:05 AM] index: '', column: 'dateModified', rect: 392,294,482,315
[11:12:05 AM] index: '', column: 'dateModified', rect: 392,315,482,336
[11:12:05 AM] index: '', column: 'dateModified', rect: 392,336,482,357
[11:12:05 AM] index: '', column: 'notes', rect: 482,42,749,63
[11:12:05 AM] index: '', column: 'notes', rect: 482,63,749,84
[11:12:05 AM] index: '', column: 'notes', rect: 482,84,749,105
[11:12:05 AM] index: '', column: 'notes', rect: 482,105,749,126
[11:12:05 AM] index: '', column: 'notes', rect: 482,126,749,147
[11:12:05 AM] index: '', column: 'notes', rect: 482,147,749,168
[11:12:05 AM] index: '', column: 'notes', rect: 482,168,749,189
[11:12:05 AM] index: '', column: 'notes', rect: 482,189,749,210
[11:12:05 AM] index: '', column: 'notes', rect: 482,210,749,231
[11:12:05 AM] index: '', column: 'notes', rect: 482,231,749,252
[11:12:05 AM] index: '', column: 'notes', rect: 482,252,749,273
[11:12:05 AM] index: '', column: 'notes', rect: 482,273,749,294
[11:12:05 AM] index: '', column: 'notes', rect: 482,294,749,315
[11:12:05 AM] index: '', column: 'notes', rect: 482,315,749,336
[11:12:05 AM] index: '', column: 'notes', rect: 482,336,749,357
Aha :!: I just realized what is happening. the DataGrid is sending the LayoutControl message for every visible row, even if there is no data in it.

dgIndex being empty is still an issue, though.

I'll post this anyway just in case some other newcomer like myself runs into this.

Thanks,
Dave

makeshyft
Posts: 187
Joined: Mon Apr 15, 2013 4:41 am
Contact:

Re: DataGrid LayoutControl message being sent many, many tim

Post by makeshyft » Fri Feb 24, 2017 11:12 pm

thanks for this, I wanted to just double check that this is the correct behavior.
Tom @
http://www.makeshyft.com
---------------------------------
Changing the Future, Today!

Post Reply

Return to “Getting Started with LiveCode - Complete Beginners”