populating the data grid

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
keram
Posts: 340
Joined: Fri Nov 08, 2013 4:22 am

populating the data grid

Post by keram » Sat Dec 07, 2013 5:02 am

Hi,

I'm trying to populate a data grid form with an array stored in the field on the same card.

I modified the default:
put the rect of field "Label" of me into theFieldRect
put item 3 of pControlRect - 5 into item 3 of theFieldRect
set the rect of field "Label" of me to theFieldRect

to this:

put the rect of button "Check" of me into theFieldRect
put item 3 of pControlRect - 5 into item 3 of theFieldRect
set the rect of button "Check" of me to theFieldRect

but why did I changed/included only the Check button and not all the other labels in the Row Template?? - I don't know.
If I do include them then populating the data grid does not work.

also added these lines which I do understand why:

set the text of field "Lin" of me to pDataArray["Line"]
set the text of field "Cat" of me to pDataArray["Category"]
set the hilited of button "Check" of me to pDataArray["Selected"]


also added 2 lines for the button "Check", but what do they do?:

on ResetData
-- Sent when data is being emptied because the control is no longer being used to display data
set the text of field "Lin" of me to empty

set the text of button "Check" of me to empty
set the hilite of button "Check" of me to false
end ResetData


I would like to eliminate the "Check" word from the check button on the display, but when I delete it in the row template properties then populating does not work.
How to do it?


also added the lines below to the existing section:
on mouseDoubleUp pMouseBtnNum

taken from this webpage:
http://lessons.runrev.com/s/lessons/m/d ... -data-grid

if pMouseBtnNum is 1 then
## did they click on the checkbox?
if the short name of the target is "Check" then
## Update internal value in data grid
SetDataOfLine the dgLine of me, "checked", the hilite of the target
end if
end if

is it how it should be? Is it correct?

I'm attaching the stack with the data grid.

keram
Attachments
DatagridForm.zip
(8.66 KiB) Downloaded 167 times
Using the latest stable version of LC Community 6.7.x on Win 7 Home Premium, 64bit

Post Reply