Page 1 of 2
DataGrid Stays when moving to another card
Posted: Thu Feb 11, 2016 7:42 am
by newpie
Hello, not sure if this has occurred to anyone, but when I am in the IDE of LiveCode testing going to a regular/non datagrid card from a datagrid card, the datagrid card dissapears.. When I create a standalone app it acts very strange and the datagrid stays on top of the new destination card (the way it appears to me anyway). Does anyone know how to fix this or where I should look to troubleshoot. If you need any additional information please let me know, thanks.
Re: DataGrid Stays when moving to another card
Posted: Thu Feb 11, 2016 10:47 pm
by dunbarx
Hi.
Are you saying that if you have a dataGrid on cd 1, and nothing on cd 2, that in a standalone that dataGrid appears on cd 2?
Craig Newman
Re: DataGrid Stays when moving to another card
Posted: Fri Feb 12, 2016 3:32 am
by newpie
Apologize for confusion.
I have a dataGrid on cd 1, and just a regular card with some fields and submit button on cd 2. In standalone the dataGrid appears on cd2 when I go from cd 1 --> cd 2, in livecode development tool it only shows cd 2 (as I wish).
Re: DataGrid Stays when moving to another card
Posted: Fri Feb 12, 2016 5:10 am
by dunbarx
Hmmm.
On a Mac?
I made a test stack, though I knew what to expect. No DG on cd 2.
No surprise to me. I cannot believe this is only in my world, or only in the Mac worlds.
Craig Newman
EDIT. I did indeed make a standalone.
Re: DataGrid Stays when moving to another card
Posted: Fri Feb 12, 2016 9:11 pm
by newpie
I have Windows 7 Home Premium running Livecode 7.1.0.
I will try to see what might be going, maybe just some messed up code. I will post again if I find anything. Thanks
Re: DataGrid Stays when moving to another card
Posted: Fri Feb 12, 2016 9:29 pm
by dunbarx
Hi.
I am on a Mac, OSX 10.9, LC 6.8.
Craig
Re: DataGrid Stays when moving to another card
Posted: Sun Feb 14, 2016 7:38 pm
by newpie
So I did some more testing and it seems that the new card is never being activated after all. So when I am on card "dataGridCard" and I want to go to card "newCard" I doubleclick on the icon in the row. I removed all the code just trying to get the card to open. Is there a special way to get a card to open. This works in the IDE, but not in standalone app. I did test a button on the "dataGridCard" and it works fine.
It activates this on row behavior script:
Code: Select all
on mouseDoubleUp pMouseBtnNum
if pMouseBtnNum is 1 then
if the dgProps["allow editing"] of the dgControl of me then
switch the short name of the target
case "editButton" --is the icon button name
go to card "newCard"
break
end switch
end if
pass mouseDoubleUp
end mouseDoubleUp
Thanks for any help
Re: DataGrid Stays when moving to another card
Posted: Mon Feb 15, 2016 1:57 am
by quailcreek
Just to see if you can get there, try this. It might help find the trouble.
Code: Select all
on mouseDoubleUp pMouseBtnNum
if pMouseBtnNum is 1 then
if the short name of the target is "editButton" then go to card "newCard"
end if
end mouseDoubleUp
Re: DataGrid Stays when moving to another card
Posted: Mon Feb 15, 2016 3:08 am
by newpie
Thanks for the tip, I tried what you said with little modification to make sure I was doubleclicking the correct button:
Code: Select all
on mouseDoubleUp pMouseBtnNum
if pMouseBtnNum is 1 then
answer the short name of the target
if the short name of the target is "editButton" then go to card "newCard"
end if
end mouseDoubleUp
It did pop up the name of the target, but didn't go anywhere. Once again for whatever reason it works in the LiveCode IDE, but not standalone.
Any ideas?
Re: DataGrid Stays when moving to another card
Posted: Mon Feb 15, 2016 3:38 am
by quailcreek
I looked thru the release notes for 7.1.1 and didn't see anything specific to this. You might want to load it anyway just to eliminate the possibility.
Re: DataGrid Stays when moving to another card
Posted: Mon Feb 15, 2016 3:56 am
by newpie
So just to test I made a totally new card, new datagrid, new button, field, and test button to load data in the grid. Put it in a standalone and it seems to work! lol
I guess that means all my other cards with Datagrids I have this setup on are corrupt and I have to rebuild them. I am not sure how they got corrupt.
Hopefully I can fix, thanks for your help. I will report if can't get it to work.
Re: DataGrid Stays when moving to another card
Posted: Mon Feb 15, 2016 4:08 am
by quailcreek
Did you copy/paste any code? The LC editor doesn't like curly quotes. I would try replacing the " in your code. It's not very common for things to get corrupt. I've been working with LC for a lot of years and never had a corrupt situation.
Re: DataGrid Stays when moving to another card
Posted: Tue Feb 16, 2016 3:14 am
by newpie
Hey quailcreek, your totally correct. It wasn't corrupt, unfortunately I discovered after rebuilding the whole datagrid card pieces and testing bits of coding one by one. In the end it was one word that messed me up.
One of the pieces of code I had in on the "DataGridCard" was this:
Code: Select all
on closeCard
set the dgData of group "DataGrid 1" to empty
put empty into field "addVar" --field on datagridCard
end closeCard
Apparently this piece of code prevented me from going to my "NewCard". When I take it out I can go.
So I still need that action though so I changed it to "on closeStack" instead and now everything works. Is this a bug I should report or operating as designed.
Thanks for your continued support thru this issue.
Re: DataGrid Stays when moving to another card
Posted: Tue Feb 16, 2016 4:05 am
by quailcreek
What you've run into is that the code that is executing the go to cd script is in the behavior of the DG. So the DG code is still executing when you try to empty it. I think I've gotten around this before. Let me look thru some code and I'll see when I can find.
Why specifically do yo need to empty the DG when you leave the cd? Just so I might think of a way around this.
Re: DataGrid Stays when moving to another card
Posted: Tue Feb 16, 2016 4:57 am
by newpie
Hello, maybe there is a better way but this is my thought process. I am open to suggestions for sure:
0. User enters the substack on the "DataGrid" Card
1. User Inputs a bunch of datagrid rows on this card
a. In this process they may need to(edit button earlier I was dealign with)/or forced to go to that NewCard in the same substack.
b. Currently they have the option in the upper right hand box of the card to hit X with their mouse to close the card
- When doing this it doesn't erase any of the data on the grid (without my closeCard code now)
2. When the user goes back into this card from the mainstack the data is still there which can cause issues.
Is there a way to get rid of that X at the top and I will just make an exit button on bottom to force them to push that perhaps?
I did notice now I can't get out of the card since I changed closeCard to closeStack, as I used closeStack prior to this, lol.