Checkbox in datagrid = true

Creating desktop or client-server database solutions?

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
Pahbie
Posts: 4
Joined: Mon Nov 09, 2015 11:37 pm

Checkbox in datagrid = true

Post by Pahbie » Mon Nov 09, 2015 11:45 pm

Hi -
I am new to LiveCode and have gotten pretty far within the first 2 weeks of working on things.

I have created a database in the cloud with MySQL.
I have created a Datagrid on a card and have been able to populate it with data.
I have utilized DBGHelper in order to put a checkbox into a column. (I have created the column checkbox without DBGH as well).

What I am not able to do though, is reflect the data value of TRUE from the database in the checkbox.

So - I have columns: LastName, FirstName and DONE. The DONE is the Boolean value in the database or TinyBit(1) value. When I populate the datagrid from the cloud, I would like DONE to show a value as a CHECKED box in the appropriate column.

I at a loss. Thank you in advance.
Pahbie

MaxV
Posts: 1579
Joined: Tue May 28, 2013 2:20 pm
Location: Italy
Contact:

Re: Checkbox in datagrid = true

Post by MaxV » Tue Nov 10, 2015 11:11 am

The property is the hilited:

Code: Select all

set the hilited of button mycheck to true
Livecode Wiki: http://livecode.wikia.com
My blog: https://livecode-blogger.blogspot.com
To post code use this: http://tinyurl.com/ogp6d5w

Mikey
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 755
Joined: Fri Jun 27, 2008 9:00 pm

Re: Checkbox in datagrid = true

Post by Mikey » Tue Nov 10, 2015 2:45 pm

Just one other suggestion on this, that might make life easier: You can also use just a normal column, so that you don't have to use a custom layout. In that case, you just put an "X" in the column for true and either a blank or a "-" for false. Then, you can respond to the mouse or any other events and toggle the values...

Pahbie
Posts: 4
Joined: Mon Nov 09, 2015 11:37 pm

Re: Checkbox in datagrid = true

Post by Pahbie » Tue Nov 10, 2015 7:46 pm

MaxV wrote:The property is the hilited:

Code: Select all

set the hilited of button mycheck to true
Thank you for answering (both of you!)

Where would I insert this code?

Thank you so much!

Pahbie
Posts: 4
Joined: Mon Nov 09, 2015 11:37 pm

Re: Checkbox in datagrid = true

Post by Pahbie » Tue Nov 10, 2015 8:10 pm

I have figured it out thanks to the lead taken from your posts.

In the behavior of the button in the FillinData pData procedure, I inserted:
if Pdata="1" then
set the hilited of button "Done" of me to true
else

"" to false


Thank you so much for the pointer!

Klaus
Posts: 13829
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: Checkbox in datagrid = true

Post by Klaus » Wed Nov 11, 2015 12:06 am

Hi Pahbie,

1. welcome to the forum! :D

2. You can have it shorter like this:
...
set the hilited of button "Done" of me to (Pdata="1")
...
The use of parens "forces" the engine to first evaluate the expression in parens,
so this will even work if Pdata might be empty or whatever! 8)


Best

Klaus

Pahbie
Posts: 4
Joined: Mon Nov 09, 2015 11:37 pm

Re: Checkbox in datagrid = true

Post by Pahbie » Wed Nov 11, 2015 1:23 am

Thank you Klaus!
I am having a blast with this!

Klaus
Posts: 13829
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: Checkbox in datagrid = true

Post by Klaus » Thu Nov 12, 2015 2:36 pm

Pahbie wrote:Thank you Klaus!
I am having a blast with this!
I just love mister Boole! :D

Post Reply

Return to “Databases”