Page 1 of 1

Grid NoHeaders and NoColumnReSizing

Posted: Thu Nov 10, 2016 10:45 pm
by Pablo César
In another forum at PCToledo, they asked if there is conditions to remove header at runtime dynamically.

I found the way with this:

Code: Select all

#include <hmg.ch>

Function Main
DEFINE WINDOW Main AT 183 , 340 WIDTH 550 HEIGHT 350 TITLE "Remove Grid Headers / NoColumnReSizing" MAIN

    DEFINE GRID Grid_1
        ROW    70
        COL    190
        WIDTH  120
        HEIGHT 120
        ITEMS { {"111","222"} }
        VALUE 1
        WIDTHS {60, 80 }
        HEADERS {'AAA',"BBB"}
        FONTNAME "Arial"
        FONTSIZE 9
        TOOLTIP ""
        SHOWHEADERS .T.
        CELLNAVIGATION .F.
    END GRID
	
	DEFINE BUTTON Button_1
        ROW    250
        COL    100
        WIDTH  120
        HEIGHT 28
        ACTION HMG_ChangeWindowStyle ( GetControlHandle("Grid_1","Main"), LVS_NOCOLUMNHEADER, NIL, .F. )
        CAPTION "Remove Headers"
        FONTNAME "Arial"
        FONTSIZE 9
    END BUTTON
	
	DEFINE BUTTON Button_2
        ROW    250
        COL    280
        WIDTH  120
        HEIGHT 28
        ACTION HMG_ChangeWindowStyle ( GetControlHandle("Grid_1","Main"), LVS_REPORT, NIL, .T. )
        CAPTION "Fixed width Columns"
        FONTNAME "Arial"
        FONTSIZE 9
    END BUTTON

END WINDOW
Main.Center

// HMG_ChangeWindowStyle ( GetControlHandle("Grid_1","Main"), LVS_NOCOLUMNHEADER, NIL, .F. )

Main.Activate
Return Nil
The most interesting that I also found a way to let width columns fixed with no resizing.

I hope it could be useful for you.

Grid NoHeaders and NoColumnReSizing

Posted: Thu Nov 10, 2016 11:12 pm
by Pablo César
Now I remember there is a dependency for calendars using grid and this will be useful in this:

viewtopic.php?p=31544#p31544

Re: Grid NoHeaders and NoColumnReSizing

Posted: Fri Nov 11, 2016 1:50 am
by Steed
Thanks

Re: Grid NoHeaders and NoColumnReSizing

Posted: Fri Nov 11, 2016 12:25 pm
by mustafa
Hola Pablo César
Muy buena solución:

Hace meses planteamos este proble en el Foro
que al no tener "nFreeze" como tiene TSbrowse

Mi pregunta es no Eliminar encabezados
e impidiento mover columnas

Mira el Post que montamos
varios compañeros aportando soluciones
con "SHOWHEADERS .F."

viewtopic.php?f=5&t=4610&hilit=mustafa

Pero no logramos Impedir Mover columnas sin Eliminar encabezado

Saludos

*--------------------------------------------- Google ----------------------------------------*

Hi Pablo César
Very good solution:

Months ago we raised this problem in the Forum
That when not having "nFreeze" as it has TSbrowse

My question is no delete headers
And impingement to move columns

Look at the Post we assemble
Several partners providing solutions
With "SHOWHEADERS .F."

viewtopic.php?f=5&t=4610&hilit=mustafa.

But we could not prevent moving columns without removing header

regards

Mustafa