Datagrid Form crushes

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: Klaus, FourthWorld, heatherlaine, kevinmiller, robinmiller

Post Reply
gnor
Posts: 13
Joined: Fri May 08, 2020 10:32 pm

Datagrid Form crushes

Post by gnor » Thu May 21, 2020 3:52 pm

Hello everyone!

I'm having trouble with my datagrid form:
/The application only contains a stack with 8 cards, gets data from MySql databse. The datagrid form in row template contains 2 fields and a button/

- First problem is, when user starts to run the application and opens the card which has the datagrid form on it, then the datagrid does not builds as suppose to, looks different from the created one. After the card closes and reopens, the datagrid looks perfect.

- Second problem is: if the user select a row then the button in it gets visible, after clicking on the button, it opens an other card, - user can input data - and when it is closed then the card - with the datagrid form on it - opens back again. Now the user selects a row again /it does not matter which one /, clicks on button, other card opens , closing other card and reopening the one has datagrid form on it,then datagrid crushes, giving the "no such an object", and highlighting the line i had underlined in the code below comes from the revdatagridlibrary/behaviorsdatagridbuttonbehavior.livecodescript.
/So the first approach of the user is succesfull, the datagrid form crushes after that.../


--------pControls is "all list controls" for a form or column row controls for a table

private function _GenerateReorderedControlList pControls, pIndexes
local theControl,theControlIndexesA,theControlsWithoutAHome,theIndex,theList

set the wholeMatches to true
## Separate controls based on whether or not they have an index

repeat for each line theControl in pControls

put the dgIndex of theControl into theIndex

if theIndex is among the items of pIndexes then
put theControl into theControlIndexesA[theIndex]
else
put theControl & cr after theControlsWithoutAHome
end if
end repeat
delete the last char of theControlsWithoutAHome

## Now order everything
repeat for each item theIndex in pIndexes
if theControlIndexesA[theIndex] is not empty then
put theControlIndexesA[theIndex] & cr after theList
else
put line 1 of theControlsWithoutAHome & cr after theList
delete line 1 of theControlsWithoutAHome
end if
end repeat
put theControlsWithoutAHome after theList
if the last char of theList is cr then delete the last char of theList

return theList
end _GenerateReorderedControlList

-------------------------------------------end code snippet-------------------------

would someone tell me what is going on please?

/ that is my second approach building the same kind of card with different name and datagridform on it from scratch, the first one gave the same error.../

gnor
Posts: 13
Joined: Fri May 08, 2020 10:32 pm

Re: Datagrid Form crushes solved

Post by gnor » Tue May 26, 2020 1:20 pm

Hi guys!

I'm going to share my solution with you in order to find out what happened excatly, 'cause is still not clear for me....

The first problem still exist, but for the second i found a DIY solution. The case was shortly: i had the datagridform on card one, in row template there was 2 fields an a button. Clicking on the button, card two opens, user select some data from a list and reopens card one.At this point datagrid crushes when user wants to select a row.
So i have changed the set: i made a group of controls of card two, and copied over card one, modified the code accordingly ,like instead of "go to card" will have "show/hide group xy of card one" etc.
Since clicking on the button in the datagrid is not opening another card, my second problem disappeard. i'm sure it is not the right way, need to find out what is the excat problem
thanks

Post Reply

Return to “Getting Started with LiveCode - Experienced Developers”