You have given me a idea to create a function which I can send parameters to. This way I can set widths to one column with 500 and rest to 0.
When finished my edit I send original widths to restore the grid.
Quite busy right now, I will post when done.
Change grid field widths in while in grid.
Moderator: Rathinagiri
Re: Change grid field widths in while in grid.
All The Best,
Franco
Canada
Franco
Canada
Re: Change grid field widths in while in grid.
This is exactly what I needed to modify field longer then grid cell width and works great and can use from any
function or procedure in any part of main program.
Many thanks.
Franco
function or procedure in any part of main program.
Code: Select all
// In Grid
// GRID_1 is grid name, FORM_1 is form name, 6 is number of columns in grid,
// the next 6 are the widths you want columns to be.
ON KEY F2 ACTION CHGRID('GRID_1','FORM_1',6,100,100,340,0,0,0)
// or
ON KEY RETURN ACTION CHGRID('GRID_1','FORM_1',6, 0,600,140,0,0,0)
// or reset to original
ACTION CHGRID('GRID_1','FORM_1',6,140,140,140,100,100,100)
Function chgrid
local hgrid := ' ', jmax:=0, j1:=1, nwidth := 0, wi := ' '
parameters Gr,Fo,col,wi1,wi2,wi3,wi4,wi5,wi6
jmax := col
hGrid := GetControlHandle(Gr, Fo )
for j1:= 1 to jmax
wi := 'wi'+alltrim(str(j1))
nwidth := &wi
LISTVIEW_SETCOLUMNWIDTH(hgrid,j1-1,nwidth)
next
return
Franco
All The Best,
Franco
Canada
Franco
Canada
Re: Change grid field widths in while in grid.
Thanks to Red2 and Auge_Ohr
Here is finished less colours and so on.
This works so great I had to share with you.
I used 3.44/samples/controls/grid_38 for testing. Just add ONHEADCLICK and Private variable and function ChGrid
Here is finished less colours and so on.
This works so great I had to share with you.
I used 3.44/samples/controls/grid_38 for testing. Just add ONHEADCLICK and Private variable and function ChGrid
Code: Select all
Function
PRIVATE GrChg := .F.
DEFINE WINDOW Form_1 ;
DEFINE GRID Grid_1
ONHEADCLICK { { || NIL },;
{|| IF(GrChg = .F. ,; CHGRID('GRID_1','FORM_1',6,80,350,80,80,80,80),CHGRID('GRID_1','FORM_1',6,140,140,140,100,100,100))},;
{|| IF(GrChg = .F. , CHGRID('GRID_1','FORM_1',6,80,80,350,80,80,80), CHGRID('GRID_1','FORM_1',6,140,140,140,100,100,100))},;
{|| IF(GrChg = .F. , CHGRID('GRID_1','FORM_1',6,80,80,80,350,80,80), CHGRID('GRID_1','FORM_1',6,140,140,140,100,100,100))},;
{|| IF(GrChg = .F. , CHGRID('GRID_1','FORM_1',6,80,80,80,80,350,80), CHGRID('GRID_1','FORM_1',6,140,140,140,100,100,100))},;
{|| IF(GrChg = .F. , CHGRID('GRID_1','FORM_1',6,80,80,80,80,80,350), CHGRID('GRID_1','FORM_1',6,140,140,140,100,100,100))}}
END GRID
END WINDOW
ACTIVATE WINDOW Form_1
Function ChGrid
local hgrid := '', jmax:=0, j1:=1, nwidth := 0, wi := ''
parameters Gr,Fo,col,wi1,wi2,wi3,wi4,wi5,wi6
jmax := col
hGrid := GetControlHandle(Gr, Fo )
for j1:= 1 to jmax
wi := 'wi'+alltrim(str(j1))
nwidth := &wi
LISTVIEW_SETCOLUMNWIDTH(hgrid,j1-1,nwidth)
next
if GrChg = .F.
GrChg := .T.
else
GrChg := .F.
endif
return
All The Best,
Franco
Canada
Franco
Canada
Re: Change grid field widths in while in grid.
Good evening, can we put colored text in MsgYesNo, thank you
L'Algerie vous salut
Y.TABET
Y.TABET
Re: Change grid field widths in while in grid.
Hi Tonton2, I am not sure without going into hmg which most do not recommend.
I have a program in all my main programs called cProc.prg. In here I put my special functions.
I made a Function called mymsgbox(). I use it for msgbox() so I Can control how it works.
You could make your own mymsgyesno() function and control anything you want.
Thanks for the thought. I think I will make one that works as I want.
I have a program in all my main programs called cProc.prg. In here I put my special functions.
I made a Function called mymsgbox(). I use it for msgbox() so I Can control how it works.
You could make your own mymsgyesno() function and control anything you want.
Thanks for the thought. I think I will make one that works as I want.
All The Best,
Franco
Canada
Franco
Canada
Re: Change grid field widths in while in grid.
Merci beaucoup , Thank'sfranco wrote: ↑Wed Feb 12, 2025 4:43 pm Hi Tonton2, I am not sure without going into hmg which most do not recommend.
I have a program in all my main programs called cProc.prg. In here I put my special functions.
I made a Function called mymsgbox(). I use it for msgbox() so I Can control how it works.
You could make your own mymsgyesno() function and control anything you want.
Thanks for the thought. I think I will make one that works as I want.
L'Algerie vous salut
Y.TABET
Y.TABET