DataGrid Columns: not editable property

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
townsend
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 430
Joined: Sun Feb 13, 2011 8:43 pm

DataGrid Columns: not editable property

Post by townsend » Fri Jun 17, 2011 5:52 pm

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.

bangkok
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 937
Joined: Fri Aug 15, 2008 7:15 am

Re: DataGrid Columns: not editable property

Post by bangkok » Fri Jun 17, 2011 7:57 pm

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

townsend
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 430
Joined: Sun Feb 13, 2011 8:43 pm

Re: DataGrid Columns: not editable property

Post by townsend » Sat Jun 18, 2011 9:40 pm

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?

Post Reply