Checkbox in datagrid = true
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
Checkbox in datagrid = true
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
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
Re: Checkbox in datagrid = true
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
My blog: https://livecode-blogger.blogspot.com
To post code use this: http://tinyurl.com/ogp6d5w
Re: Checkbox in datagrid = true
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...
Re: Checkbox in datagrid = true
Thank you for answering (both of you!)MaxV wrote:The property is the hilited:Code: Select all
set the hilited of button mycheck to true
Where would I insert this code?
Thank you so much!
Re: Checkbox in datagrid = true
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!
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!
Re: Checkbox in datagrid = true
Hi Pahbie,
1. welcome to the forum!
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!
Best
Klaus
1. welcome to the forum!
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!
Best
Klaus
Re: Checkbox in datagrid = true
Thank you Klaus!
I am having a blast with this!
I am having a blast with this!
Re: Checkbox in datagrid = true
I just love mister Boole!Pahbie wrote:Thank you Klaus!
I am having a blast with this!