[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 732
  • Last Modified:

Why runtime checkbox grid configuration doesn't work ?

Hi Experts

I'm facing a problem while trying to configure a grid control from inside code

Form
Here is the Init's code from form1
 
With thisform.pageframe1.page1.grid1
	.ColumnCount = 12
	.Panel = 1
	.LockColumns = 2


	.Column1.Width = 35
	.Column1.Name = "Column1"
	.Column1.Header1.Caption = "Conciliar"
	.Column1.AddObject('Check1','clscheck')	
	.Column1.Check1.Visible = .T.
	.Column1.CurrentControl = 'Check1'
	.Column1.Text1.Visible = .F.
	.Column1.RemoveObject('Text1')
	.Column1.Sparse = .F.
	.Column1.Enabled = .T.

	.Column2.Width = 120
	.Column2.Name = "Column2"
	.Column2.Header1.Caption = "CR"
	.Column2.Enabled = .F.

	.Column3.Width = 120
	.Column3.Name = "Column3"
	.Column3.Header1.Caption = "Dsp"
*--.Column3.Text1.INPUTMASK = "(###)###-####"
	.Column3.Enabled = .F.

	.Column4.Width = 120
	.Column4.Name = "Column4"
	.Column4.Header1.Caption = "Cx"
	.Column4.Enabled = .F.

	.Column5.Width = 80
	.Column5.Name = "Column5"
	.Column5.Header1.Caption = "Dcn"
	.Column5.Enabled = .F.

	.Column6.Width = 70
	.Column6.Name = "Column6"
	.Column6.Header1.Caption = "Dia"
	.Column6.Enabled = .F.

	.Column7.Width = 70
	.Column7.Name = "Column7"
	.Column7.Header1.Caption = "Dt.Lan"
	.Column7.Enabled = .F.

	.Column8.Width = 90
	.Column8.Name = "Column8"
	.Column8.Header1.Caption = "Valor"
	.Column8.Enabled = .F.

	.Column9.Width = 60
	.Column9.Name = "Column9"
	.Column9.Header1.Caption = "Qtd"
	.Column9.Enabled = .F.

	.Column10.Width = 170
	.Column10.Name = "Column10"
	.Column10.Header1.Caption = "Observação"
	.Column10.Enabled = .F.

	.Column11.Width = 120
	.Column11.Name = "Column11"
	.Column11.Header1.Caption = "Saldo"
	.Column11.Enabled = .F.

	.Column12.Width = 120
	.Column12.Name = "Column12"
	.Column12.Header1.Caption = "Empresa"
	.Column12.Enabled = .F.


	*--.SetAll('DynamicBackColor', 'IIF(selecter, RGB(0,219,219), RGB(255,255,255))', 'COLUMN')
	.Visible = .T.
Endwith

Open in new window


 Debugger
The error when it runs doesn´t make sense for me
 Classes.PRG
The class is defined at another place - CLASSES.PRG
Set Procedure To CLASSES Additive  && at main.prg

Any possible reason ?

Thanks in advance !
img-ee-011111.JPG
0
Eduardo Fuerte
Asked:
Eduardo Fuerte
  • 2
  • 2
1 Solution
 
Olaf DoschkeSoftware DeveloperCommented:
You can only have boolean fields as control source for checkboxes. Your code does not tell what is bound to the column1, but the error says it's the wrong data type.

Bye, Olaf.
0
 
Eduardo FuerteAuthor Commented:
Perfect.
0
 
pcelbaCommented:
Just FYI, numeric columns are also allowed for checkboxes.
0
 
Eduardo FuerteAuthor Commented:
Thank you, Pcelba !
0
 
Olaf DoschkeSoftware DeveloperCommented:
While that's true you better go for boolean. Allowed numeric values are 0 for .F., 1 for .T. and 2 for .NULL.; if you bind a numeric field and it has a different value you get problems again.

Bye, Olaf.
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now