Why runtime checkbox grid configuration doesn't work ?

Posted on 2011-11-01
Last Modified: 2012-05-12
Hi Experts

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

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.Check1.Visible = .T.
	.Column1.CurrentControl = 'Check1'
	.Column1.Text1.Visible = .F.
	.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.

Open in new window

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

Any possible reason ?

Thanks in advance !
Question by:Eduardo Fuerte
    LVL 29

    Accepted Solution

    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.

    Author Closing Comment

    by:Eduardo Fuerte
    LVL 41

    Expert Comment

    Just FYI, numeric columns are also allowed for checkboxes.

    Author Comment

    by:Eduardo Fuerte
    Thank you, Pcelba !
    LVL 29

    Expert Comment

    by:Olaf Doschke
    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.

    Featured Post

    Maximize Your Threat Intelligence Reporting

    Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

    Join & Write a Comment

    Microsoft Visual FoxPro (short VFP) is a programming language with it’s own IDE and database, ranking somewhat between Access and VB.NET + SQL Server (Express). Product Description: (http://msd…
    Outlook Free & Paid Tools
    Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…
    Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

    728 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now