CheckBox in a Grid Problem

General Help regarding HMG, Compilation, Linking, Samples

Moderator: Rathinagiri

Red2
Posts: 282
Joined: Sat May 18, 2019 2:11 pm
DBs Used: Visual FoxPro, FoxPro
Location: United States of America

CheckBox in a Grid Problem

Post 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 4066 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 4066 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
User avatar
dragancesu
Posts: 931
Joined: Mon Jun 24, 2013 11:53 am
DBs Used: DBF, MySQL, Oracle
Location: Subotica, Serbia

Re: CheckBox in a Grid Problem

Post by dragancesu »

Look \SAMPLES\Controls\Grid\GRID_36\demo.prg

it doesn't seem to work as we would expect
Red2
Posts: 282
Joined: Sat May 18, 2019 2:11 pm
DBs Used: Visual FoxPro, FoxPro
Location: United States of America

Re: CheckBox in a Grid Problem

Post 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
User avatar
serge_girard
Posts: 3420
Joined: Sun Nov 25, 2012 2:44 pm
DBs Used: 1 MySQL - MariaDB
2 DBF
Location: Belgium
Contact:

Re: CheckBox in a Grid Problem

Post 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
There's nothing you can do that can't be done...
Red2
Posts: 282
Joined: Sat May 18, 2019 2:11 pm
DBs Used: Visual FoxPro, FoxPro
Location: United States of America

Re: CheckBox in a Grid Problem

Post by Red2 »

Hi Serge,

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

Red2
Red2
Posts: 282
Joined: Sat May 18, 2019 2:11 pm
DBs Used: Visual FoxPro, FoxPro
Location: United States of America

Re: CheckBox in a Grid Problem

Post 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
User avatar
AUGE_OHR
Posts: 2117
Joined: Sun Aug 25, 2019 3:12 pm
DBs Used: DBF, PostgreSQL, MySQL, SQLite
Location: Hamburg, Germany

Re: CheckBox in a Grid Problem

Post by AUGE_OHR »

hi Red,,

have you use

Code: Select all

   SET BROWSESYNC ON                                                  // sync BROWSE with DBF
have fun
Jimmy
User avatar
serge_girard
Posts: 3420
Joined: Sun Nov 25, 2012 2:44 pm
DBs Used: 1 MySQL - MariaDB
2 DBF
Location: Belgium
Contact:

Re: CheckBox in a Grid Problem

Post 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
There's nothing you can do that can't be done...
Red2
Posts: 282
Joined: Sat May 18, 2019 2:11 pm
DBs Used: Visual FoxPro, FoxPro
Location: United States of America

Re: CheckBox in a Grid Problem

Post 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
User avatar
mol
Posts: 3825
Joined: Thu Sep 11, 2008 5:31 am
Location: Myszków, Poland
Contact:

Re: CheckBox in a Grid Problem

Post by mol »

Try to change ColumnControls[1] to NIL
don't set it as {"CHECKBOX"}
Post Reply