Grid NoHeaders and NoColumnReSizing

Topic Specific Tutorials and Tips.

Moderator: Rathinagiri

Post Reply
User avatar
Pablo César
Posts: 4059
Joined: Wed Sep 08, 2010 1:18 pm
Location: Curitiba - Brasil
Has thanked: 100 times
Been thanked: 178 times

Grid NoHeaders and NoColumnReSizing

Post by Pablo César » Thu Nov 10, 2016 10:45 pm

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.
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein

User avatar
Pablo César
Posts: 4059
Joined: Wed Sep 08, 2010 1:18 pm
Location: Curitiba - Brasil
Has thanked: 100 times
Been thanked: 178 times

Post by Pablo César » Thu Nov 10, 2016 11:12 pm

Now I remember there is a dependency for calendars using grid and this will be useful in this:

viewtopic.php?p=31544#p31544
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein

User avatar
Steed
Posts: 315
Joined: Sat Dec 12, 2009 3:40 pm
Been thanked: 2 times

Post by Steed » Fri Nov 11, 2016 1:50 am

Thanks

User avatar
mustafa
Posts: 607
Joined: Fri Mar 20, 2009 11:38 am
Location: Alicante - Spain
Been thanked: 47 times

Post by mustafa » Fri Nov 11, 2016 12:25 pm

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

Post Reply