Page 1 of 1

Datagrid SetDataOfLine problem

Posted: Sun Apr 25, 2010 11:40 pm
by phaworth
I am using the following code in a script in a datagrid group to put a new value into a column in the datagrid:

Code: Select all

put "SetDataOfLine" && the dgHilitedLine of me & comma & quote & "DBD_Act" & quote & comma & quote & myDate & quote into myMessage
send myMessage to me in zero seconds
put "RefreshLine" && the dgHilitedLine of me into myMessage
send myMessage to me in zero seconds
I looked at the contents of myMessage right before the first send and they were:

SetDataOfLine 10,"DBD_Act","2010-04-25"

Right after the first send, I used the message box to display the dgText of the group and the line that was just updated was all blank (there were values in all the columns prior to the SetDataOfLine.

There are 6 columns in the datagrid and the one I am updating is the last column.

What am I doing wrong?

Thanks,
Pete

Re: Datagrid SetDataOfLine problem

Posted: Mon Apr 26, 2010 7:15 pm
by trevordevore
Does your code work if you take out the send?

Code: Select all

SetDataOfLine dgHilitedLine of me, "DBD_Act", myDate
RefreshLine the dgHilitedLine of me

Re: Datagrid SetDataOfLine problem

Posted: Mon Apr 26, 2010 7:38 pm
by phaworth
Yes, thank you Trevor.

This leaves me confused as to when the send in zero seconds is necessary and when the datagrid commands can be used directly. I had thought that I needed the send because the code is in a script in the datagrid group?

Thanks,
Pete

Re: Datagrid SetDataOfLine problem

Posted: Mon Apr 26, 2010 7:49 pm
by trevordevore
In the current version of Rev you can't call RefreshList without using send in time and you can't delete the last line of the data grid without using send in time. The latter limitation has been removed in the forthcoming Rev 4.5.

As to why your code doesn't work with send? I'm not sure. But while on the subject of send I will point out that it is good practice to stick parameters into variables and then use the variable names in the send string. Otherwise you can end up with unexpected behavior depending on the values of the parameters (commas in the parameters will split a single parameter into multiple parameters using the technique you are using). See this lesson for additional information send and params: How to send messages to an object using the send command

Re: Datagrid SetDataOfLine problem

Posted: Mon Apr 26, 2010 8:34 pm
by phaworth
Thanks for the tip on using send.
Pete