Thanks for your suggestion.
There is an example of a more advanced query dialog for any grid, as shown in the image below.
Code: Select all
/* Test Grid Query */
Procedure Main
local aGrid, nGrid
LOCAL aMinMaxInfo := {}, i, nWidth
local aHeaders := {"Sno","Words","Numeric","Factor","Value","Y","Date"}
local aWidths := {50,70,70,50,70,50,80}
local aJustify := {2,0,1,0,0,2,2}
local cWin := "FrmMain"
Set( _SET_DEBUG, .f. )
Set Century ON
Set Date British
DEFINE FONT FontBold FONTNAME _HMG_DefaultFontName SIZE _HMG_DefaultFontSize + 1 BOLD
aGrid := { { '001', 'One', 100, 4, 400,.t.,Date() },;
{ '002', 'Two', 100, 6, 600,.t.,Date()-10 },;
{ '003', 'Three', 100, 7, 700,.t.,Date()-365 },;
{ '004', 'Four', 100, 5, 500,.f.,Date()-100 },;
{ '005', 'Five', 100, 3, 300,.t.,Date()-50 },;
{ '006', 'Six', 100, 5, 500,.t.,Date()-90 },;
{ '007', 'Seven', 100, 7, 700,.f.,Date()-200 },;
{ '008', 'Eight', 100, 9, 900,.t.,Date()-150 },;
{ '009', 'Nine', 100, 5, 500,.t.,Date()-60 },;
{ '010', 'Ten', 100, 4, 400,.f.,Date()-80 },;
{ '011', 'Eleven',100, 6, 600,.t.,Date()-70 },;
{ '012', 'Twelve',100, 7, 700,.f.,Date()-30 } }
nGrid := 0
AEval(aWidths, {|e| nGrid += e})
define window &cWin at 0,0 width 640 height 480 title "F2 - Query" main
ON KEY ESCAPE OF &cWin Action thisWindow.Release
ON KEY F2 of &cWin Action GridQuery(cWin,"Grid1")
@ 10,10 Grid Grid1 of &cWin autosizewidth nGrid height 400 Headers aHeaders Widths aWidths ;
Items aGrid Value 1 justify aJustify backcolor BROWN fontcolor YELLOW nosortheaders
for i := 1 to getproperty(cWin,"Grid1","ColumnCount")
// Dynamic Header
FrmMain.Grid1.HeaderDYNAMICFONT(i) := {|| 'FontBold' }
FrmMain.Grid1.HeaderDYNAMICBACKCOLOR(i) := {|| BROWN }
FrmMain.Grid1.HeaderDYNAMICFORECOLOR(i) := {|| YELLOW }
nWidth := FrmMain.Grid1.COLUMNWIDTH(i)
AAdd( aMinMaxInfo, { nWidth, nWidth } )
next
FrmMain.Grid1.COLUMNWIDTHLIMITS := aMinMaxInfo
end window
DoMethod(cWin,"Activate")
return
Thank you for your attention.