Special behavior in DataGrid Columns
Posted: Wed Feb 17, 2010 8:14 pm
I am using a datagrid with 8 columns and want the user to be able to modify five of those columns. I have created a 'My Default Column Behavior' button which is giving me most of what I want but not everything. At this point I have modified the command EditValue and the MouseDoubleUp script as shown below:
There are two behaviors that I would still like to accomplish. The first is that when a user double clicks on one of the cells that can be edited, I would like to have the text in that cell be selected rather than having the cursor at the end of the text. If it were selected the user would not have to back space it out or double click again to type over it.
The other behavior I would like to have is that when a user modifies one of the columns 'Shares To Sell', 'Price/Share' or 'Commission' then the Amount would automatically be calculated (provided all the necessary values were present). This is all compounded by the fact that I am working in a window that is modal so tracing and message watching is not very easy to do.
Does anyone have any suggestions for getting these behaviors working?
Thanks in advance,
Larry
Code: Select all
-- Data grid will call this if a user action asks to edit cell content.
command EditValue
put the dgColumn of me into tCol
if offset(tCol,"Shares To Sell,Price/Share,Commission,Amount,Sell Date") > 0 then
EditFieldText the long id of me, the dgIndex of me, the dgColumn of me
end if
end EditValue
on mouseDoubleUp pMouseBtnNum
if pMouseBtnNum is 1 then
put the dgColumn of me into tCol
if offset(tCol,"Shares To Sell,Price/Share,Commission,Amount,Sell Date") > 0 then
if the dgProps["allow editing"] of the dgControl of me \
and the dgColumnIsEditable[the dgColumn of me] of the dgControl of me then
-- Edit field contents if the user double-clicks
EditCellOfIndex the dgColumn of me, the dgIndex of me
exit mouseDoubleUp
end if
end if
end if
pass mouseDoubleUp
end mouseDoubleUp
The other behavior I would like to have is that when a user modifies one of the columns 'Shares To Sell', 'Price/Share' or 'Commission' then the Amount would automatically be calculated (provided all the necessary values were present). This is all compounded by the fact that I am working in a window that is modal so tracing and message watching is not very easy to do.
Does anyone have any suggestions for getting these behaviors working?
Thanks in advance,
Larry