Gridscreen: really weird values for Row and Col

I’m getting whacky values for row and col

col &h12 Integer val:13094412
row &h12 Integer val:65535

when the screen is first loaded. I zero out the row and col variables before I get the values from the screen, and then do a screen.setfocusedlistitem(row,col), and then when I get the values from the message port they are off in the ozone.

	if type(msg) = "roGridScreenEvent" then 
		if msg.isScreenClosed() then
			?"some mofo closed the damn screen!!!"
			return -1 
		else if msg.isListItemFocused() then
			row=msg.GetIndex()		
			?"row=";row
			col=msg.GetData()
			?"col=";col

I’ve seen this as well. I print out WTF! on the debug console when it occurs. :mrgreen: I just do a sanity check on the values before using them.

-JT

ok, I guess that is all I can do.

  • Joel

If I recall correctly, I think I’ve only ever seen that when setting focus on a row that doesn’t have any items in it (or to an index higher than the content list count). Is that where you’re seeing it, or does it happen randomly during execution?

As I recall, it would occur randomly when I first display the grid. I don’t believe it ever occurred after the initial display. I save and restore a grid object as necessary and set the focused item to either 0,0 or whatever the focused item was the last time I displayed the grid. The bogus isListItemFocused was always followed by a good one that matched the call to SetFocusedListItem, so I don’t believe I was trying to set the focused item to something bogus. It’s been a while, so I may not be remembering everything. Once I put in the sanity check, I pretty much forgot about it. Since it was random and not really reproducible, I just let it go.

-JT

“renojim” wrote:
As I recall, it would occur randomly when I first display the grid. I don’t believe it ever occurred after the initial display. I save and restore a grid object as necessary and set the focused item to either 0,0 or whatever the focused item was the last time I displayed the grid. The bogus isListItemFocused was always followed by a good one that matched the call to SetFocusedListItem, so I don’t believe I was trying to set the focused item to something bogus. It’s been a while, so I may not be remembering everything. Once I put in the sanity check, I pretty much forgot about it. Since it was random and not really reproducible, I just let it go.

-JT
Same here. I ignore it if the index isn’t valid, so I forget the exact situation, too, but the more I think about it, the more I seem to recall it being related to an initial focus event being raised after SetupLists, but before SetContentList… or something like that. Maybe related to scrolling the grid via the remote before all of the content has loaded…? I’m too lazy to test it out now.. :face_with_tongue:

Yeah, it happens on the first is focused event when the grid screen is loaded. The isfocused event fires off on load and has weird numbers. I just put “if row < 100 and col < 500 then” so it just ignores the weird numbers, the next event that fires has the correct numbers.

  • Joel

Sounds like it’s not initializing the value and just grabbing the numbers from ram.

I’m having trouble replicating this… Do you have a small code snippet that exhibits this behavior?

–Kevin

I’m sending you a PM now.

  • Joel