Page 1 of 1

Checkbox Column

Posted: Mon Oct 01, 2018 4:32 pm
by 15682814
i can add a BooleanRender to a column to get checkboxes to appear but how do you actually control it's value or react to someone clicking on the data?

the data is connected to a StringsData object

examples for the grid control are very limited so far. I'm trying to migrate a datagrid control assing the TeeGrid would be faster to render but so far I've spent multiple hours and not got very far with porting the functionality I use on the datagrid at the moment

Re: Checkbox Column

Posted: Thu Oct 04, 2018 11:56 am
by Christopher
Hello,

I'm afraid this is a bug which I have added to our issue tracker with id=2109 but which we have already fixed. This fix will become available very shortly.

The issue can best be seen with reference to the example under:
https://github.com/Steema/TeeGrid-for-. ... %20Heights

and with the following modifications:

Code: Select all

			//tmp[0, 3] = "Sample";
			//tmp[0, 5] = "Hello" + Environment.NewLine + "World";
			//tmp[0, 10] = "This is a long line" + Environment.NewLine + "of text with multiple" + Environment.NewLine + "lines";

			tmp[0, 3] = "True";
			tmp[0, 5] = "True";
			tmp[0, 10] = "True";

			tmp[1, 1] = "Several lines" + Environment.NewLine + "of text";
			tmp[1, 6] = "More sample" + Environment.NewLine + "text";
			tmp[1, 10] = "Another long line" + Environment.NewLine + "of text with multiple" + Environment.NewLine + "lines";


			Steema.TeeGrid.Renders.BooleanRender bRender = new Steema.TeeGrid.Renders.BooleanRender(tTeeGrid1.Columns[0].Changed);
			bRender.Changed += BRender_Changed;
			tTeeGrid1.Columns[0].Render = bRender;

			tTeeGrid1.Columns[1].ParentFormat = false;
			tTeeGrid1.Columns[1].Format.Font.Size = 16;

			tTeeGrid1.Columns[1].TextAlignment = ColumnTextAlign.Custom;
			tTeeGrid1.Columns[1].TextAlign.Horizontal = HorizontalAlign.Right;

			CbMultiLine_CheckedChanged(cbMultiLine, EventArgs.Empty);

			//tTeeGrid1.Editing.Text.Selected = false;
		}

		private void button3_Click(object sender, EventArgs e)
		{
			MessageBox.Show(tTeeGrid1.Data.AsString(tTeeGrid1.Columns[0], 3));
		}


		private void BRender_Changed(object sender, EventArgs e)
		{
			throw new NotImplementedException();
		}
note that when tTeeGrid1.Columns[0].ReadOnly is set to true the unlying data will be changed when clicking on the checkbox - you can see this by the test in button3. What will now also work is the firing of the BRender_Changed event.