Page 1 of 1

DataGrid - one row on top of another

Posted: Sat Sep 07, 2013 11:07 pm
by quailcreek
As you might expect. I'm at eh last 10% of the project an I've run into a nasty snag.

Here’s the scenario:
I have 2 stacks. Main and MeasurerLib.
Main has an on PreOpenStack script that populates a datagrid on card 2 of the MeasurerLib stack.

Card 1 of the main stack has a button that opens the MeasurerLib stack to card 1 as modal.

The MeasurerLib stack has 2 cards.
Card 1 has a set of fields that the users can populate. It also has 2 buttons. A Save button that populates the datagrid on card 2 with the information from the fields and an edit button that navigates to card 2 where the datagrid lives. There is a cancel button on card 2 that navigated back to card 1.

The on PreOpenStack script works fine. The datagrid on card 2 of the MeasurerLib stack gets populated.

The problem is that if I navigate to card 1 of the MeasurerLib stack from the button on card 1 of the main stack and fill in the fields and click the save button. The row of the datagrid that was populated from the stack script isn’t recognized. The new text is simply populated right over top of the existing text. So there are 2 lines of text I the same row.

However, if I first navigate to card 2 of the MeasurerLib stack where the datagrid is and back to card 1 before filling in the fields and clicking the save button viola, everything works as predicted.

Long story short, what command is sent to the datagrid when I navigate to the card it’s on that make the row recognized??????
I've tried this on card 1 of the MearurerLib stack but it blows away the headers. Grrrrrrr

on PreOpenCard
dispatch "resetList" to group "ListOfMeasurers" of card "DataGrid Holder" of this stack
end PreOpenCard

Thanks a lot for any help.

Re: DataGrid - one row on top of another

Posted: Sat Sep 07, 2013 11:42 pm
by Klaus
Can you please post a screenshot and (some) of your scripts?

Re: DataGrid - one row on top of another

Posted: Sun Sep 08, 2013 3:03 am
by quailcreek
This is the datagrid with the text on text. Card2 of the MeasurerLib stack.
DataGrid text in text.tiff
Card1 of the MeasurerLib stack.
MeasurerLib Card1.tiff

on preOpenStack -- main stack script
put StackPath (filename of this stack) & "Measurer_Trax.ini" into tPath_Trax
IF there is a file tPath_Trax then -- copy the measurer data and delete the ini file
put getIniVar("Measurer", "First" ,tPath_Trax) into tMeasurerFirst
put getIniVar("Measurer", "Middle" ,tPath_Trax) into tMeasurerMiddle
put getIniVar("Measurer", "Last" ,tPath_Trax) into tMeasurerLast
put getIniVar("Measurer", "Offical" ,tPath_Trax) into tMeasurerOffical
put getIniVar("Measurer", "Master" ,tPath_Trax) into tMeasurerMaster
put getIniVar("Measurer", "Email" ,tPath_Trax) into tMeasurerEmail

## build the array
put tMeasurerFirst into tData[1] ["First"]
put tMeasurerLast into tData[1] ["Last"]
put tMeasurerMiddle into tData[1] ["Middle"]
put tMeasurerEmail into tData[1] ["Email"]
put tMeasurerOffical into tData[1] ["Official"]
put tMeasurerMaster into tData[1] ["Master"]

## setting the uDefaultMeasurer in the MesurerLib stack
put StackPath (filename of this stack) & "MeasurerLib.rev" into tPath_MLib
set the uDefaultMeasurer ["uFirstMeasurer"] of stack tPath_MLib to tMeasurerFirst
set the uDefaultMeasurer ["uMiddleMeasurer"] of stack tPath_MLib to tMeasurerMiddle
set the uDefaultMeasurer ["uLastMeasurer"] of stack tPath_MLib to tMeasurerLast
set the uDefaultMeasurer ["uOfficialMeasurer"] of stack tPath_MLib to tMeasurerOffical
set the uDefaultMeasurer ["uMasterMeasurer"] of stack tPath_MLib to tMeasurerMaster
set the uDefaultMeasurer ["ueMailMeasurer"] of stack tPath_MLib to tMeasurerEmail

## populate the datagrid. This is only done once
set the dgData of group "ListOfMeasurers" of card "DataGrid Holder" of stack tPath_MLib to tData

save stack tPath_MLib
delete file tPath_Trax
close stack tPath_MLib
end if

pass preOpenStack
end preOpenStack
######################
on mouseUp -- save button script
lock screen
## populate the array from the fields
put fld "Measurer First" into tData ["First"]
put fld "Measurer Last" into tData ["Last"]
put fld "Measurer Middle" into tData ["Middle"]
put fld "Measurer Email" into tData ["Email"]
put fld "Measurer Official" into tData ["Official"]
put fld "Measurer Master" into tData ["Master"]

## Gather the new information
put fld "Measurer First" into tFirst
put fld "Measurer Middle" into tMiddle
put fld "Measurer Last" into tLast
put fld "Measurer Email" into tEmail
put fld "Measurer Official" into tOfficial
put fld "Measurer Master" into tMaster

switch -- uEditOrNot of this stack
case the uEditOrNot of this stack = "Edit" ## editing an existing measurer
## Check to see if the edited measurer is the current measurer
if the uDefaultMeasurer ["uFirstMeasurer"] of this stack = tFirst and the uDefaultMeasurer ["uMiddleMeasurer"] of this stack = tMiddle and \
the uDefaultMeasurer ["uLastMeasurer"] of this stack = tLast then

set the dgDataOfIndex[the dgHilitedIndex of group "ListOfMeasurers" of card "DataGrid Holder"] of group "ListOfMeasurers" of card "DataGrid Holder" to tData

## populate the datagrid on the main stack with the new data
put the dgText of group "ListOfMeasurers" of card "DataGrid Holder" of this stack into xData
set the dgText of group "ListOfMeasurers" of card "Measurer Information" of stack "Measurer Data" to xData

## we'll assume this is going to be a new measurer
set the uEditOrNot of this stack to "New"

else -- if it doen't match

set the dgDataOfIndex[the dgHilitedIndex of group "ListOfMeasurers" of card "DataGrid Holder"] of group "ListOfMeasurers" of card "DataGrid Holder" to tData

## populate the datagrid on the main stack with the new data
put the dgText of group "ListOfMeasurers" of card "DataGrid Holder" of this stack into xData
set the dgText of group "ListOfMeasurers" of card "Measurer Information" of stack "Measurer Data" to xData

## repopulate the fields of the main stack
put tFirst into fld "First" of card "Measurer Information" of stack "Measurer Data"
put tMiddle into fld "Middle" of card "Measurer Information" of stack "Measurer Data"
put tLast into fld "Last" of card "Measurer Information" of stack "Measurer Data"
put tMaster into fld "Master" of card "Measurer Information" of stack "Measurer Data"
put tOfficial into fld "Official" of card "Measurer Information" of stack "Measurer Data"
put tEmail into fld "Email" of card "Measurer Information" of stack "Measurer Data"

## we'll assume this is going to be a new measurer
set the uEditOrNot of this stack to "New"

end if
break

case the uEditOrNot of this stack = "New"
## populate the datagrid on the main stack with just the new entry
dispatch "addData" to group "ListOfMeasurers" of card "Measurer Information" of stack "Measurer Data" with tData,1
set the dgProp["sort by column"] of group "ListOfMeasurers" of card "Measurer Information" of stack "Measurer Data" to "Last"

## populate the datagrid on this stack with just the new entry
put the dgNumberOfLines of group "ListOfMeasurers" of card "DataGrid Holder" of this stack + 1 into pLineNum
dispatch "addData" to group "ListOfMeasurers" of card "DataGrid Holder" of this stack with tData,pLineNum
set the dgProp["sort by column"] of group "ListOfMeasurers" of card "DataGrid Holder" of this stack to "Last"
break

end switch

## put empty into all the fields
put ("Measurer First" & cr & "Measurer Middle" & cr & "Measurer Last" & cr & "Measurer Official" & cr & "Measurer Master"& cr & "Measurer Email") into tListOfFields
repeat for each line i in tListOfFields
put empty into field i of this card
end repeat

set the disabled of me to true
set the disabled of button "Delete" to true
save this stack
unlock screen
end mouseUp

Re: DataGrid - one row on top of another

Posted: Sun Sep 08, 2013 12:50 pm
by Klaus
Hmmm, nothing obvious, need to gues...

How "long" are your rows that you display in the datagrid?

I remember that I had a "too long" (to display) line (> 32k or 64k?, not sure anymore)
which cause the SAME inconvenience as you are currently experiencing.

Re: DataGrid - one row on top of another

Posted: Sun Sep 08, 2013 3:11 pm
by quailcreek
The rows only have six columns with not a lot of data. I appreciate you looking at this Klaus. I'm going to be working on another project involving 7 stacks each with at least 2 datagrids that will be populated in a similar fashion. If I run into the same problem I don't know what I'm going to do. This is a persistent and reproducable problem. I hope the guys at RunRev are loking at this. hanks again Klaus.

Re: DataGrid - one row on top of another

Posted: Sun Sep 08, 2013 3:29 pm
by Klaus
Hmm, I see... What line exactly from your longish script above causes the double lines of text on top of another?

Re: DataGrid - one row on top of another

Posted: Sun Sep 08, 2013 4:50 pm
by quailcreek
Hi Klaus,
The stack script works fine. It's the save script. If I just fill in the fields and click save, without first navigating to the card where the datagrid lives, I get the double text.

Thanks,
Tom

Re: DataGrid - one row on top of another

Posted: Sun Sep 08, 2013 9:52 pm
by Klaus
Hi Tom,
quailcreek wrote:If I just fill in the fields and click save, without first navigating to the card where the datagrid lives, I get the double text.
does it work if you do first navigate to that card and then update the datagrid on that card?
If yes, the this may be a bug?


Best

Klaus

Re: DataGrid - one row on top of another

Posted: Mon Sep 09, 2013 12:15 am
by quailcreek
Yes, if I navigate to the card where the DG lives then back to the first card where the fields and the save button are, it works. But I have to do that every time I want to edit the DG.

Thanks,
Tom

Re: DataGrid - one row on top of another

Posted: Mon Sep 09, 2013 12:27 pm
by Klaus
Hi Tom,

sounds like a bug to me, I'd write to: support@runrev.com


Best

Klaus