Page 1 of 1

DataGrid Columns: not editable property

Posted: Fri Jun 17, 2011 5:52 pm
by townsend
I've looked everywhere for this.
How do I designate a single column of my DataGrid to be non-editable.
That is-- I don't want the user to be able to double click to edit.

Re: DataGrid Columns: not editable property

Posted: Fri Jun 17, 2011 7:57 pm
by bangkok
In the "Default column" script (see lesson http://tinyurl.com/3rnhpxv) change the mousedoubleup handler by adding 1 line :

Code: Select all

on mouseDoubleUp pMouseBtnNum
   if pMouseBtnNum is 1 then
-- add the following line   
 if the   dgcolumn of me = "Col 1" then  exit to top -- put the name of the column you don't want to be edited
      if the dgProps["allow editing"] of the dgControl of me then
         
         -- Edit field contents if the user double-clicks
         EditValue
         exit mouseDoubleUp
      end if
   end if
   pass mouseDoubleUp
end mouseDoubleUp

Re: DataGrid Columns: not editable property

Posted: Sat Jun 18, 2011 9:40 pm
by townsend
I've been struggling with extended DataGrid behaviors and properties for a couple of days now. It's been very confusing. Having to create a "default column" button, and then link the button to the DataGrid via a Message Box command, just to prevent editing in one column-- seemed a long way to go. Everything else about LiveCode has been so logical and well placed. This just didn't make sense.

Anyway-- I started using the DataGrid Helper plugin-- and Wow! This should be built into the LiveCode IDE. It's simple-- and intuitive. So-- I'm very pleased with this find. It's just what I needed.

I just double click on any DataGrid and there are TONS of properties and behaviors for me to select from! That's how it should be! Anyone who is working with DataGrids needs check this out. Why work harder than you have to?