CheckBox in Grid when displaying a .DBF?

General Help regarding HMG, Compilation, Linking, Samples

Moderator: Rathinagiri

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

CheckBox in Grid when displaying a .DBF?

Post by Red2 »

Spanish Translation:

Le agradecería mucho su ayuda. Necesito un ejemplo Demo.PRG debajo de la carpeta "C: \HMG.3.4.4\Samples\Controls\Grid\" que mostrará un control CheckBox en una cuadrícula cuando se use un .DBF. Eso me pareció una tarea sencilla.

El problema:
Un CheckBox se muestra allí solo cuando se usa un Array (como propiedad Item). ¡No cuando se muestra un .DBF (como propiedad RowSource)!

Mi prueba:
Todos los archivos Sample Demo.PRG en las carpetas debajo de "C:\HMG.3.4.4\Samples\Controls\Grid\" que usan un RowSource (.DBF) no muestran un CheckBox. (Al menos para mi). Allí, la columna CheckBox solo muestra un ".T" lógico. o ".F.", no un CheckBox.

Qué carpetas de ejemplo:
Las carpetas de muestra "...Samples\Controls\Grids\" que usan RowSource(.DBF) son:
“\Grid_13\” más cada carpeta desde “\Grid_25\” a “\Grid_38\”.

He pasado horas trabajando con el ejemplo en la carpeta "...\Grid\CheckBoxes\". Su matriz (como elemento) muestra un CheckBox pero no he podido hacer que aparezca un CheckBox cuando cambio a un .DBF (RowSource).

¿Que me estoy perdiendo aqui? Gracias por su amable ayuda.

--------------------------------
English:


I would greatly appreciate your assistance. I need an example Demo.PRG underneath folder “C:\HMG.3.4.4\Samples\Controls\Grid\” that will display a CheckBox control in a Grid when using a .DBF. That appeared to me a simple task.

The Problem:
A CheckBox is displayed there only when an Array (as property Item) is used. Not when displaying a .DBF (as property RowSource)!

My Testing:
All of the Sample Demo.PRG files in the folders underneath “C:\HMG.3.4.4\Samples\Controls\Grid\” that use a (.DBF) RowSource fail to show a CheckBox. (At least for me). There, the CheckBox column only displays a logical “.T.” or “.F.”, not a CheckBox.

Which Example Folders:
The “...Samples\Controls\Grids\” sample folders I have checked that use a RowSource (.DBF) are:
“\Grid_13\” plus each folder from “\Grid_25\” to “\Grid_38\”.

I have spent hours working with the example in folder “...\Grid\CheckBoxes\”. Its Array (as Item) shows a CheckBox but I have not been able to make a CheckBox appear when I change to a .DBF (RowSource).

What am I missing here? Thank you for your kind help.
User avatar
Claudio Ricardo
Posts: 367
Joined: Tue Oct 27, 2020 3:38 am
DBs Used: DBF, MySQL, MariaDB
Location: Bs. As. - Argentina

Re: CheckBox in Grid when displaying a .DBF?

Post by Claudio Ricardo »

Hola...
Creo, no estoy seguro pero puedes probar:
Pasar la DBF a un array y cargar el array en el grid con AddItem
Si me dices los campos (estructura) de la db .dbf te puedo escribir la rutina.
Corrige al sabio y lo harás más sabio, Corrige al necio y lo harás tu enemigo.
WhatsApp / Telegram: +54 911-63016162
Red2
Posts: 273
Joined: Sat May 18, 2019 2:11 pm
DBs Used: Visual FoxPro, FoxPro
Location: United States of America

Re: CheckBox in Grid when displaying a .DBF?

Post by Red2 »

Google Spanish Translation:
Hola Claudio,
Gracias por tu tan amable y pronta respuesta.

Estoy de acuerdo contigo. SI utilizo una matriz, como en el programa "C:\HMG.3.4.4\Samples\Controls\Grid\Grid_CheckBoxes\Demo.PRG", se muestra una casilla de verificación en su cuadrícula. Este no es mi problema.

Necesito que aparezca un CheckBox en una cuadrícula que muestre un .DBF. Una "solución alternativa" aquí pierde mi necesidad.

¿Puedo señalarle un ejemplo .PRG donde un .DBF es la fuente de datos de Grid y el control CheckBox de Grid NO se muestra? Consulte: "... Samples\ Controls\Grids\Grid_36\Demo.PRG".

¿Cuál es el propósito o la intención de tales ejemplos ??? Vengo de un entorno de VFP y, desafortunadamente, estoy confundido aquí en HMG.

¡Gracias de nuevo!

====================
English:

Hi Claudio,
Thank you for your very kind and prompt response.

I agree with you. IF I use an Array, such as in the program “C:\HMG.3.4.4\Samples\Controls\Grid\Grid_CheckBoxes\Demo.PRG”, a CheckBox is displayed in its Grid. This is not my issue.

I need a CheckBox to appear in a Grid that displays a .DBF. A “workaround” here misses my need.

May I point you to a sample .PRG where a .DBF is the Grid’s data source and the Grid’s CheckBox control FAILS to display. Please see: “...Samples\Controls\Grids\Grid_36\Demo.PRG”.

What is the purpose or intend of such examples??? I come from a VFP background and, unfortunately, am confused here in HMG.

Thanks again!
User avatar
AUGE_OHR
Posts: 2062
Joined: Sun Aug 25, 2019 3:12 pm
DBs Used: DBF, PostgreSQL, MySQL, SQLite
Location: Hamburg, Germany

Re: CheckBox in Grid when displaying a .DBF?

Post by AUGE_OHR »

hi

Checkbox in a GRID use LVS_EX_CHECKBOXES
https://docs.microsoft.com/en-us/window ... iew-styles

Checkbox in a GRID are NOT real, they are Image in Imagelist
you need as much Image as you have Items in GRID

---

under HMG a GRID can have COLUMNCONTROLS depend on Type of Column.
so you add a Logic Field in your DBF and display it on 1st Column
have fun
Jimmy
Red2
Posts: 273
Joined: Sat May 18, 2019 2:11 pm
DBs Used: Visual FoxPro, FoxPro
Location: United States of America

Re: CheckBox in Grid when displaying a .DBF?

Post by Red2 »

Google Translation
Hola Claudio y Jimmy,
Gracias por su amable asistencia. He realizado una investigación adicional.

Respecto a estas condiciones:
  • Un .DBF (fuente de datos) usando la propiedad Grid ROWSOURCE
    Una cuadrícula definida con la sintaxis "DEFINE GRID ... END GRID"
    Un campo lógico se asigna a la celda de una cuadrícula para mostrar un "CheckBox".
El código HMG falla invariablemente de la siguiente manera.

Problemas encontrados:
1) Una celda de campo lógico se muestra simplemente como ".T./.F".
2) El "CheckBox" de la celda está "oculto" (invisible) a menos que se haga doble clic o se presione Intro.
3) Este CheckBox visible temporalmente muestra el cambio.
4) El evento crítico de Grid "OnCheckBoxClicked" (o "ON CheckBoxClicked") nunca se activa.
5) Finalmente, el "cambio de CheckBox" nunca se guarda en el .DBF.

¡Una fuente de datos de Array (propiedad ITEM), por otro lado, no presenta ningún problema!

Referencias:
Solo hay un archivo HMG que contiene la propiedad Grid "ON CHECKBOXCLICKED" (un espacio después de ON):
"C:\HMG.3.4.4\Samples\Controls\Grid\Grid_CheckBoxes\Demo.PRG"

Solo hay dos archivos de idioma HMG que contienen "ONCHECKBOXCLICKED" (sin espacio).
Quizás alguien más avanzado pueda determinar por qué existe este problema.
Ver directorio "C:\HMG.3.4.4\Source\"
  • h_windows.prg
    h_grid.prg
PREGUNTA: ¿Hay usuarios más avanzados de HMG/Harbour al tanto de
alguna solución o workaroud?
¿Puede explicar lo que está pasando?

Gracias a todos por su amable ayuda. Realmente aprecio tu consejo.

Saludos, Red2

=======================================
Hi Claudio and Jimmy,

Thank you for your kind assistance. I have done additional investigating.

Regarding these conditions:
A .DBF (data source) using Grid property ROWSOURCE
A Grid defined using "DEFINE GRID ... END GRID" syntax
A Logical field is mapped to a Grid's cell to display a CheckBox.
HMG code invariably fails as follows.

Problems Encountered:
1) A Logical field cell is merely displayed as ".T./.F."
2) The cell's CheckBox is "hidden" (invisible) unless it is Double-Clicked or Enter is prressed.
3) This temporarily visible CheckBox shows the change.
4) The critical Grid event "OnCheckBoxClicked" (or "ON CheckBoxClicked") never fires.
5) Finally, the "CheckBox change" is never saved to the .DBF.

A data source of Array (property ITEM), on the other hand, presents no problem!

References:
There is only one HMG file containing Grid property "ON CHECKBOXCLICKED" (a space after ON):
"C:\HMG.3.4.4\Samples\Controls\Grid\Grid_CheckBoxes\Demo.PRG"

There are only two HMG language files containing "ONCHECKBOXCLICKED" (no space).
Perhaps someone more advanced might be able to determine why this problem exists.
See directory "C:\HMG.3.4.4\Source\"
  • h_windows.prg
    h_grid.prg
QUESTION: Are any more advanced HMG/Harbour users aware of either:
some fix or workaroud?
can explain what's happening?

Thanks to all for your kind assistance. I really appreciate your advice.

Regards, Red2
User avatar
SALINETAS24
Posts: 667
Joined: Tue Feb 27, 2018 3:06 am
DBs Used: DBF
Contact:

Re: CheckBox in Grid when displaying a .DBF?

Post by SALINETAS24 »

Red2 wrote: Mon Jan 18, 2021 3:53 pm Spanish Translation:

Le agradecería mucho su ayuda. Necesito un ejemplo Demo.PRG debajo de la carpeta "C: \HMG.3.4.4\Samples\Controls\Grid\" que mostrará un control CheckBox en una cuadrícula cuando se use un .DBF. Eso me pareció una tarea sencilla.

..... / ....
Hola Red...,

Creo entender que lo que quieres es que se visualice el dibujo del cuadrado en lugar del "YES" o "NO". Es tarea complicada y para hacerlo tendrías que usar las imágenes.., un rollo.
Yo tengo una solución más domestica, pero que da el pego visualmente.

A ver si es esto lo que buscas...,un saludo virtual y una cervecita fresquita.
Attachments
GRID_26.rar
(1.22 MiB) Downloaded 114 times
Como dijo el gran pensador Hommer Simpson..., - En este mundo solo hay 3 tipos de personas, los que saben contar y los que no. :shock:
Red2
Posts: 273
Joined: Sat May 18, 2019 2:11 pm
DBs Used: Visual FoxPro, FoxPro
Location: United States of America

Re: CheckBox in Grid when displaying a .DBF?

Post by Red2 »

Google Translation:
Hola Salinetas24,
Muchas gracias por sugerir la posible solución.

Un primer vistazo rápido sugiere que podría ser suficiente si no hay una solución real disponible.
Tendré que esperar hasta el lunes o martes para hacer una evaluación adicional.

¡Gracias de nuevo!

=================================
Hi Salinetas24,
Thank you so very much for suggesting the potential workaround.

A quick first glance suggests that it might suffice if there is no fix available.
I'll have to wait until Monday or Tuesday to make a further assessment.

Thanks again!
User avatar
AUGE_OHR
Posts: 2062
Joined: Sun Aug 25, 2019 3:12 pm
DBs Used: DBF, PostgreSQL, MySQL, SQLite
Location: Hamburg, Germany

Re: CheckBox in Grid when displaying a .DBF?

Post by AUGE_OHR »

hi,
5) Finally, the "CheckBox change" is never saved to the .DBF.
GRID does NOT Sync DBF when moving in GRID :!:
RECNO() must NOT = {nValue} ... DBF can have Index ...

GRID have a Method "Save" and this Property

Code: Select all

      - This.AppendBuffer
      - This.EditBuffer
      - This.MarkBuffer
Salinetas24 have add Menu Item

Code: Select all

ITEM 'Save Pending Changes (Alt+S)'    ACTION Form_1.Grid_1.Save
when using "EDIT" it does "override" OnDblClick which i prefer to use with my own Net_Lock().

---

for "EDIT" DBF i use BROWSE and

Code: Select all

   SET BROWSESYNC ON
when navigate in BROWSE it will SKIP so it is much slower on PgDn / PgUp

BROWSE does NOT have many Property of GRID
have fun
Jimmy
Post Reply