Code: Select all
/*
* HMG HeaderImages Property Test
* (c) 2008 Roberto Lopez
*/
#include "hmg.ch"
Function Main
Local arows:=LoadItems(), lShowAll:=.F.
DEFINE WINDOW Form_1 ;
AT 0,0 ;
WIDTH 550 ;
HEIGHT 400 ;
TITLE 'Hello World!' ;
MAIN
DEFINE MAIN MENU
DEFINE POPUP 'Records'
MENUITEM 'Show all records' ACTION (lShowAll:=.T., Form_1.Grid_1.ITEMCOUNT:=QueryTest(aRows, lShowAll), Form_1.Grid_1.Refresh)
MENUITEM 'Hide some records' ACTION (lShowAll:=.F., Form_1.Grid_1.ITEMCOUNT:=QueryTest(aRows, lShowAll), Form_1.Grid_1.Refresh)
END POPUP
END MENU
@ 10,10 GRID Grid_1 ;
WIDTH 500 ;
HEIGHT 330 ;
HEADERS {'Last Name','First Name','Phone'} ;
WIDTHS {140,140,140};
VIRTUAL ;
ITEMCOUNT QueryTest(aRows, lShowAll) ;
ON QUERYDATA QueryTest(aRows, lShowAll, .T.)
END WINDOW
Form_1.Center
Form_1.Activate
Return
Function LoadItems()
Local aRows [20] [4]
//.t.=visible, .f.=hide
aRows [1] := {'Simpson','Homer','555-5555',.t.}
aRows [2] := {'Mulder','Fox','324-6432',.t.}
aRows [3] := {'Smart','Max','432-5892',.t.}
aRows [4] := {'Grillo','Pepe','894-2332',.f.}
aRows [5] := {'Kirk','James','346-9873',.t.}
aRows [6] := {'Barriga','Carlos','394-9654',.t.}
aRows [7] := {'Flanders','Ned','435-3211',.f.}
aRows [8] := {'Smith','John','123-1234',.f.}
aRows [9] := {'Pedemonti','Flavio','000-0000',.t.}
aRows [10] := {'Gomez','Juan','583-4832',.t.}
aRows [11] := {'Fernandez','Raul','321-4332',.f.}
aRows [12] := {'Borges','Javier','326-9430',.f.}
aRows [13] := {'Alvarez','Alberto','543-7898',.f.}
aRows [14] := {'Gonzalez','Ambo','437-8473',.t.}
aRows [15] := {'Batistuta','Gol','485-2843',.t.}
aRows [16] := {'Vinazzi','Amigo','394-5983',.t.}
aRows [17] := {'Pedemonti','Flavio','534-7984',.t.}
aRows [18] := {'Samarbide','Armando','854-7873',.t.}
aRows [19] := {'Pradon','Alejandra','???-????',.f.}
aRows [20] := {'Reyes','Monica','432-5836',.f.}
Return aRows
Procedure QueryTest(aRows, lShowAll, lQuery)
Local i, a:=0
Default lQuery:=.F.
FOR EACH i IN aRows
IF i[4] .OR. lShowAll
a++
IF lQuery .AND. a==This.QueryRowIndex
This.QueryData := i [ This.QueryColIndex ]
Return a
ENDIF
ENDIF
NEXT
Return a