Page 1 of 4

CheckBox in a Grid Problem

Posted: Tue Aug 09, 2022 8:42 pm
by Red2
I really want a CheckBox to be the Display Control in Column #1 of a Grid.

I ran "C:\HMG.3.4.4\Samples\Controls\Grid\Grid_CheckBoxes\Demo.prg"
Here Column #1's display gives what I want:
GridCheckbox.PNG
GridCheckbox.PNG (5.28 KiB) Viewed 4061 times
However this does not show in my Grid. My Column #1's has no CheckBox:[/i]
No_Checkbox.PNG
No_Checkbox.PNG (2.1 KiB) Viewed 4061 times
Important:
My Grid's Column Controls Array: {{"CHECKBOX"},{'TEXTBOX'}, {'TEXTBOX'},.....}
My Column #1's control source is a .DBF field of type LOGICAL.
My .FRM code is created using the HMG IDE.

NOTE: I have read the following relevant forum post:
https://www.hmgforum.com/viewtopic.php? ... led#p62213
salamandra » Tue Jun 02, 2020 5:16 am
mol wrote: Mon Jun 01, 2020 11:47 pm
I want to redefine piece of code and use Grid with CheckBoxItems.
I'm using IDE to design form. But, I can't see possibility for grid with CheckBoxItems. Am I wrong?

No, you can´t, but you can enable checkboxes at window loading time

Thus: My code contains this (from salamandra):

Code: Select all

....
LOAD window DataBrowse
// https://www.hmgforum.com/viewtopic.php?f=5&t=6467&p=62213&hilit=CheckBoxEnabled#p62213
//                                              /* Enable checkboxes here */
DataBrowse.BrowseStates.CheckBoxEnabled := .T.	/* Form_1.Grid_1.CheckBoxEnabled := .T. */
....
QUESTION: Can anyone please help me with I do not understand about a CheckBox in a Grid?
Thank you!
Red2

Re: CheckBox in a Grid Problem

Posted: Wed Aug 10, 2022 8:26 am
by dragancesu
Look \SAMPLES\Controls\Grid\GRID_36\demo.prg

it doesn't seem to work as we would expect

Re: CheckBox in a Grid Problem

Posted: Wed Aug 10, 2022 1:47 pm
by Red2
Thank you dragancesu, I appreciate your kind response.

As you note ...\SAMPLES\Controls\Grid\GRID_36\Demo.PRG (using demo.hbp via the IDE)
displays differently than ... \SAMPLES\Controls\Grid\Grid_CheckBox\Demo.PRG.

I have looked at both Demo.PRG program samples (and others) but still do not
understand what might allow a simple CheckBox in my Grid.

Any help would be appreciated. Thank you,
Red2

Re: CheckBox in a Grid Problem

Posted: Wed Aug 10, 2022 3:48 pm
by serge_girard
Hi red2

I use this grid with simple checkbox:

Code: Select all

DEFINE GRID Grid_Agenda 
   ROW 10
   COL 10
   WIDTH  1565
   HEIGHT 650
   HEADERS {"Weg", "Nr", 'Dag'   } 
   WIDTHS  {50,     30,   90 }
   CELLNAVIGATION TRUE
   COLUMNWHEN     {  {|| TRUE },  { || FALSE }, {|| FALSE }} 
   JUSTIFY {GRID_JTFY_LEFT, GRID_JTFY_LEFT, GRID_JTFY_LEFT } 
   COLUMNCONTROLS {   { 'CHECKBOX', 'Yes' , 'No' }, ; // DELETION
                      { 'TEXTBOX',  'CHARACTER'}, ;	
                      { 'TEXTBOX',  'CHARACTER'} }		
   ALLOWEDIT      TRUE
   ITEMS aGrid_Agenda

END GRID    
Grid filled up after screen is activated!
Maybe this can help, succes, Serge

Re: CheckBox in a Grid Problem

Posted: Wed Aug 10, 2022 3:59 pm
by Red2
Hi Serge,

Thank you. I'll have a look at your example code.
I really appreciate all of your kind guidance!

Red2

Re: CheckBox in a Grid Problem

Posted: Wed Aug 10, 2022 9:11 pm
by Red2
Hi Serge,

I compared your sample code to mine (an IDE created .FRM) and found nothing significant to change.
Unfortunately Column #1's cell still does not display a CheckBox.

My Grid's Control Source is a .DBF table, not an Array.
I wonder if the kind of a Grid's Control Source somehow changes the column's Display.
Does your Grid's Control Source display via an Array or a .DBF?

Question: Can you rule in or rule out whether the kind of Control Source prevents the display of my CheckBox control?

Again, thank you for your valuable guidance.
Red2

Re: CheckBox in a Grid Problem

Posted: Wed Aug 10, 2022 10:44 pm
by AUGE_OHR
hi Red,,

have you use

Code: Select all

   SET BROWSESYNC ON                                                  // sync BROWSE with DBF

Re: CheckBox in a Grid Problem

Posted: Thu Aug 11, 2022 7:01 am
by serge_girard
Red,

In my ARRAY example first column (which is the checkbox) is in my ARRAY .T. or .F.

Code: Select all

ADD ITEM	 {.F., ALLTRIM(STR(nNR,4,0)), dag1}
This has to match in your DBF. If first DBF field is CHAR then no checkbox will be in the grid.
I think this the cause.

Serge

Re: CheckBox in a Grid Problem

Posted: Thu Aug 11, 2022 12:39 pm
by Red2
Hi All, Thank you for your help. I really appreciate all the kind help here.

Jimmy: I cannot find BROWSESYNC in a Grid control. The control in this case is a Grid.
My purpose in choosing a Grid control over a Browse control is to allow a CheckBox in Column #1.

Serge: The first Column's control source is a .DBF field of type LOGICAL. We can rule this out.

QUESTION: What else am I missing here?

Thanks again,
Red2

Re: CheckBox in a Grid Problem

Posted: Thu Aug 11, 2022 1:13 pm
by mol
Try to change ColumnControls[1] to NIL
don't set it as {"CHECKBOX"}