Change a Grid Readonly On the fly
Moderator: Rathinagiri
Change a Grid Readonly On the fly
Hi,
How can I change the Readonly property of a grid on the fly?
I used
frmCompound.grdCompoundrm.readonly := .t.
But it doesn't work.
TIA.
With best regards.
Sudip
How can I change the Readonly property of a grid on the fly?
I used
frmCompound.grdCompoundrm.readonly := .t.
But it doesn't work.
TIA.
With best regards.
Sudip
With best regards,
Sudip
Sudip
- esgici
- Posts: 4543
- Joined: Wed Jul 30, 2008 9:17 pm
- DBs Used: DBF
- Location: iskenderun / Turkiye
- Contact:
Re: Change a Grid Readonly On the fly
Hi Sudip
Are you sure that GRID control has ReadOnly property ?
Regards
--
Esgici
Are you sure that GRID control has ReadOnly property ?
Regards
--
Esgici
Viva INTERNATIONAL HMG
Re: Change a Grid Readonly On the fly
Hi Sudip,sudip wrote:Hi,
How can I change the Readonly property of a grid on the fly?
I used
frmCompound.grdCompoundrm.readonly := .t.
But it doesn't work.
Try
_HMG_SYSDATA [ 40 ] [ GetControlIndex ( 'grdCompoundrm' , 'frmCompound' ) ] [ 1 ] := .F.
I hope that helps
Kind Regards,
Grigory Filatov
"Everything should be made as simple as possible, but no simpler." Albert Einstein
Grigory Filatov
"Everything should be made as simple as possible, but no simpler." Albert Einstein
Re: Change a Grid Readonly On the fly
Hi Esgici,
Actually I am not sure. I can't find Readonly for Grid in Help. But, my code doesn't show any error!!!
Hi Grigory,
Thank you very much. This will be very helpful to me.
Before seeing your code, I tried something with COLUMNWHEN property and it works!!!
With best regards.
Sudip
Actually I am not sure. I can't find Readonly for Grid in Help. But, my code doesn't show any error!!!
Hi Grigory,
Thank you very much. This will be very helpful to me.
Before seeing your code, I tried something with COLUMNWHEN property and it works!!!
Code: Select all
@ 96, 220 GRID grdCompoundRm ;
WIDTH 300 ;
HEIGHT 250 ;
HEADERS { 'Raw Material', 'Qty', '%' } ;
WIDTHS { 150, 75, 55 } ;
COLUMNCONTROLS { { 'COMBOBOX', aRmnm }, ;
{ 'TEXTBOX', 'NUMERIC', '9999.999' }, ;
{ 'TEXTBOX', 'NUMERIC', '999.99%' }} ;
edit ;
justify { 0, 1, 1 } ;
on lostfocus CalcTot() ;
COLUMNWHEN { { || frmCompound.cmdSave.enabled }, ;
{ || frmCompound.cmdSave.enabled }, { || .f. } }
Sudip
With best regards,
Sudip
Sudip
Re: Change a Grid Readonly On the fly
Hello Grigory,
Thank you very much for your tip!!! It works!!!
But, I have to remember the line ...
_HMG_SYSDATA [ 40 ] [ GetControlIndex ( 'grdCompoundrm' , 'frmCompound' ) ] [ 1 ] := .F.
BTW, is there any documentation for _HMG_SYSDATA?
With best regards.
Sudip
Thank you very much for your tip!!! It works!!!
But, I have to remember the line ...
_HMG_SYSDATA [ 40 ] [ GetControlIndex ( 'grdCompoundrm' , 'frmCompound' ) ] [ 1 ] := .F.
BTW, is there any documentation for _HMG_SYSDATA?
With best regards.
Sudip
With best regards,
Sudip
Sudip
Re: Change a Grid Readonly On the fly
Sudip,sudip wrote:Hello Grigory,
...
BTW, is there any documentation for _HMG_SYSDATA?
Take a look for h_init.prg at your folder hmg\SOURCE.
* _HMG_SYSDATA Reference
* _HMG_SYSDATA [ 1 ] -> Control Data
* _HMG_SYSDATA [ 2 ] -> Control Data
* _HMG_SYSDATA [ 3 ] -> Control Data
* _HMG_SYSDATA [ 4 ] -> Control Data
* _HMG_SYSDATA [ 5 ] -> Control Data
* _HMG_SYSDATA [ 6 ] -> Control Data
* _HMG_SYSDATA [ 7 ] -> Control Data
* _HMG_SYSDATA [ 8 ] -> Control Data
* _HMG_SYSDATA [ 9 ] -> Control Data
* _HMG_SYSDATA [ 10 ] -> Control Data
* _HMG_SYSDATA [ 11 ] -> Control Data
* _HMG_SYSDATA [ 12 ] -> Control Data
* _HMG_SYSDATA [ 13 ] -> Control Data
* _HMG_SYSDATA [ 14 ] -> Control Data
* _HMG_SYSDATA [ 15 ] -> Control Data
* _HMG_SYSDATA [ 16 ] -> Control Data
* _HMG_SYSDATA [ 17 ] -> Control Data
* _HMG_SYSDATA [ 18 ] -> Control Data
* _HMG_SYSDATA [ 19 ] -> Control Data
* _HMG_SYSDATA [ 20 ] -> Control Data
* _HMG_SYSDATA [ 21 ] -> Control Data
* _HMG_SYSDATA [ 22 ] -> Control Data
* _HMG_SYSDATA [ 23 ] -> Control Data
* _HMG_SYSDATA [ 24 ] -> Control Data
* _HMG_SYSDATA [ 25 ] -> Control Data
* _HMG_SYSDATA [ 26 ] -> Control Data
* _HMG_SYSDATA [ 27 ] -> Control Data
* _HMG_SYSDATA [ 28 ] -> Control Data
* _HMG_SYSDATA [ 29 ] -> Control Data
* _HMG_SYSDATA [ 30 ] -> Control Data
* _HMG_SYSDATA [ 31 ] -> Control Data
* _HMG_SYSDATA [ 32 ] -> Control Data
* _HMG_SYSDATA [ 33 ] -> Control Data
* _HMG_SYSDATA [ 34 ] -> Control Data
* _HMG_SYSDATA [ 35 ] -> Control Data
* _HMG_SYSDATA [ 36 ] -> Control Data
* _HMG_SYSDATA [ 37 ] -> Control Data
* _HMG_SYSDATA [ 38 ] -> Control Data
* _HMG_SYSDATA [ 39 ] -> Control Data
* _HMG_SYSDATA [ 40 ] -> Control Data
...
Kind Regards,
Grigory Filatov
"Everything should be made as simple as possible, but no simpler." Albert Einstein
Grigory Filatov
"Everything should be made as simple as possible, but no simpler." Albert Einstein
Re: Change a Grid Readonly On the fly
Hi Grigory,
Thank you sooooo much
Now, I have another problem. I want to autocaluclate some total amount from grid. What event shall I use?
1) On change
2) COLUMNVALID
3) LostFocus
Previously I used On Change, but I found that it works only if Row or Col value is changed.
TIA.
With best regards.
Sudip
Thank you sooooo much
Now, I have another problem. I want to autocaluclate some total amount from grid. What event shall I use?
1) On change
2) COLUMNVALID
3) LostFocus
Previously I used On Change, but I found that it works only if Row or Col value is changed.
TIA.
With best regards.
Sudip
With best regards,
Sudip
Sudip
Re: Change a Grid Readonly On the fly
Hi Sudip,sudip wrote:Hi Grigory,
Thank you sooooo much
Now, I have another problem. I want to autocaluclate some total amount from grid. What event shall I use?
1) On change
2) COLUMNVALID
3) LostFocus
Previously I used On Change, but I found that it works only if Row or Col value is changed.
I vote for 2) COLUMNVALID
Code: Select all
/*
* MiniGUI Virtual Column Grid Demo
* (c) 2006-2009 Grigory Filatov
*/
#include "minigui.ch"
PROCEDURE Main
Local aRows [20] [6]
DEFINE WINDOW Form_1 ;
AT 0,0 ;
WIDTH 640 ;
HEIGHT 420 ;
TITLE 'Virtual Column Grid Test' ;
MAIN
DEFINE MAIN MENU
DEFINE POPUP 'File'
MENUITEM 'Set Item' ACTION SetItem()
MENUITEM 'Get Item' ACTION GetItem()
SEPARATOR
MENUITEM 'Exit' ACTION ThisWindow.Release
END POPUP
END MENU
aRows [1] := {'01','Simpson','Homer',5,10,5*10}
aRows [2] := {'02','Mulder','Fox',24,32,24*32}
aRows [3] := {'03','Smart','Max',43,58,43*58}
aRows [4] := {'04','Grillo','Pepe',89,23,89*23}
aRows [5] := {'05','Kirk','James',34,73,34*73}
aRows [6] := {'06','Barriga','Carlos',39,54,39*54}
aRows [7] := {'07','Flanders','Ned',43,11,43*11}
aRows [8] := {'08','Smith','John',12,34,12*34}
aRows [9] := {'09','Pedemonti','Flavio',10,100,10*100}
aRows [10] := {'10','Gomez','Juan',58,32,58*32}
aRows [11] := {'11','Fernandez','Raul',32,43,32*43}
aRows [12] := {'12','Borges','Javier',26,30,26*30}
aRows [13] := {'13','Alvarez','Alberto',54,98,54*98}
aRows [14] := {'14','Gonzalez','Ambo',43,73,43*73}
aRows [15] := {'15','Batistuta','Gol',48,28,48*28}
aRows [16] := {'16','Vinazzi','Amigo',39,83,39*83}
aRows [17] := {'17','Pedemonti','Flavio',53,84,53*84}
aRows [18] := {'18','Samarbide','Armando',54,73,54*73}
aRows [19] := {'19','Pradon','Alejandra',12,45,12*45}
aRows [20] := {'20','Reyes','Monica',32,36,32*36}
@ 10,10 GRID Grid_1 ;
WIDTH 612 ;
HEIGHT 344 ;
HEADERS { 'Code', 'Last Name', 'First Name', 'Quantity', 'Price', 'Cost' } ;
WIDTHS {60,100,100,80,80,100} ;
ITEMS aRows ;
EDIT ;
COLUMNCONTROLS { ;
{'TEXTBOX','CHARACTER', '999' } , ;
{'TEXTBOX','CHARACTER', } , ;
{'TEXTBOX','CHARACTER', } , ;
{'TEXTBOX','NUMERIC', '9,999' } , ;
{'TEXTBOX','NUMERIC', '999.99' } , ;
{'TEXTBOX','NUMERIC', '9,999,999.99' } ;
};
COLUMNWHEN { ;
{ || Empty ( This.CellValue ) } , ;
{ || This.CellValue >= 'M' } , ;
{ || This.CellValue >= 'C' } , ;
{ || ! Empty ( This.CellValue ) }, ;
{ || ! Empty ( This.CellValue ) }, ;
{ || Empty ( This.CellValue ) } ;
} ;
COLUMNVALID { , , , ;
{ || SETVIRTUALITEM() } , ;
{ || SETVIRTUALITEM() } , ;
} ;
JUSTIFY { GRID_JTFY_RIGHT,;
GRID_JTFY_LEFT,;
GRID_JTFY_LEFT,;
GRID_JTFY_RIGHT,;
GRID_JTFY_RIGHT,;
GRID_JTFY_RIGHT }
END WINDOW
CENTER WINDOW Form_1
ACTIVATE WINDOW Form_1
Return
Function SETVIRTUALITEM()
local nVal := This.CellValue
local nCol := This.CellColIndex
local nRow := This.CellRowIndex
if nCol == 4
Form_1.Grid_1.Cell( nRow , 6 ) := nVal * Form_1.Grid_1.Cell( nRow , 5 )
elseif nCol == 5
Form_1.Grid_1.Cell( nRow , 6 ) := Form_1.Grid_1.Cell( nRow , 4 ) * nVal
endif
RETURN .T.
PROCEDURE SETITEM()
Form_1.Grid_1.Item (2) := { '02', 'Gomez', 'Juan' , Form_1.Grid_1.Cell( 1 , 4 ), Form_1.Grid_1.Cell( 1 , 5 ), Form_1.Grid_1.Cell( 1 , 4 ) * Form_1.Grid_1.Cell( 1 , 5 ) }
RETURN
PROCEDURE GETITEM()
local a
a := Form_1.Grid_1.Item (2)
aEval( a, {|x,i| msginfo ( if(valtype(x)=="C", x, str(x)), ltrim( str ( i ) ) )} )
RETURN
Kind Regards,
Grigory Filatov
"Everything should be made as simple as possible, but no simpler." Albert Einstein
Grigory Filatov
"Everything should be made as simple as possible, but no simpler." Albert Einstein
Re: Change a Grid Readonly On the fly
Hello Grigory,
Thanks a lot! Now, I understand.
With best regards.
Sudip
Thanks a lot! Now, I understand.
With best regards.
Sudip
With best regards,
Sudip
Sudip