Datagrid Problem

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: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
phaworth
Posts: 592
Joined: Thu Jun 11, 2009 9:51 pm

Datagrid Problem

Post by phaworth » Tue May 11, 2010 11:50 pm

I have a general purpose function in my app that laods data into any datagrid based on various custom properties of the datagrid. 95% of the time it gets called from outside the datagrid itslelf and works just fine. The other 5% of the time it gets called from a script in the datagrid group and the datagrid gets corrupted (missing data, data displayed in wrong columns, etc). If I click the Refresh Datagrid button in it's property inspector, all looks OK again

I think I'm running into the issue about trying to redraw a datagrid from a handler within a datagrid, but not sure. If that is the issue, I'm unsure as to how to get round it. The handler in question is in a front script and loads data into the datagrid by setting the dgText property. I tried the send in zero seconds trick but that didn't fix the problem.

Any ideas?

Pete
PS Forgot to mention that the code is invoked from a popup menu associated with the datagrid when the user clicks the right mouse button and the code for that is in the rwo template behavior scrit I've associated with the datagrid.

trevordevore
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 1005
Joined: Sat Apr 08, 2006 3:06 pm
Contact:

Re: Datagrid Problem

Post by trevordevore » Wed May 12, 2010 2:19 pm

Where did you add the send in 0 seconds? Was it in the menuPick handler of the popup menu?
Trevor DeVore
ScreenSteps - https://www.screensteps.com

LiveCode Repos - https://github.com/search?q=user%3Atrevordevore+topic:livecode
LiveCode Builder Repos - https://github.com/search?q=user%3Atrevordevore+topic:livecode-builder

phaworth
Posts: 592
Joined: Thu Jun 11, 2009 9:51 pm

Re: Datagrid Problem

Post by phaworth » Wed May 12, 2010 5:48 pm

I put the send in the handler that is in the datagrid group script and it was a send to the card that contains the front script handler.

In case it helps, here's the roadmap of the various code elements.

User right clicks - code to trap this and display the popup menu is in the custom behavior script for the datagrid.
User selects an option from the popup menu - code in the popup menu script issues a call command for a handler in the datagrid group to process the the selected option.
The handler in the datagrid calls the front script handler.

I also tried moving the code that is in the datagrid group script into the popup menu script but got the same result.

Thanks,
Pete

trevordevore
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 1005
Joined: Sat Apr 08, 2006 3:06 pm
Contact:

Re: Datagrid Problem

Post by trevordevore » Wed May 12, 2010 9:25 pm

Try adding the send to the code in in the popup menu that is triggered when the user makes a selection.
Trevor DeVore
ScreenSteps - https://www.screensteps.com

LiveCode Repos - https://github.com/search?q=user%3Atrevordevore+topic:livecode
LiveCode Builder Repos - https://github.com/search?q=user%3Atrevordevore+topic:livecode-builder

phaworth
Posts: 592
Joined: Thu Jun 11, 2009 9:51 pm

Re: Datagrid Problem

Post by phaworth » Wed May 12, 2010 10:41 pm

Thanks Trevor, that fixed it
Pete

Post Reply