Aqui está un ejemplo completo:
Code: Select all
#include "fivewin.ch"
REQUEST DBFCDX
//-----------------------------------------------//
function Main() //ShowingImg()
local aStruct := { {"First", "C", 30,0},;
{"City", "C", 30,0},;
{"Married", "L", 30,0},;
{"MF", "C", 1,0} }
dbCreate(".\PEOPLE", aStruct)
USE PEOPLE NEW SHARED ALIAS CUST VIA "DBFCDX"
DbAppend()
Field->first := "Maria" ; field->City := "Managua" ; field->married := .f. ; field->mf := "F"
DbAppend()
Field->first := "Olga" ; field->City := "Leon" ; field->married := .f. ; field->mf := "F"
DbAppend()
Field->first := "Roberto" ; field->City := "Managua" ; field->married := .f. ; field->mf := "M"
DbAppend()
Field->first := "Lucia" ; field->City := "Managua" ; field->married := .f. ; field->mf := "F"
DbAppend()
Field->first := "Martha" ; field->City := "Managua" ; field->married := .t. ; field->mf := "F"
DbAppend()
Field->first := "Miriam" ; field->City := "Leon" ; field->married := .t. ; field->mf := "F"
DbAppend()
Field->first := "Nestor" ; field->City := "Leon" ; field->married := .t. ; field->mf := "M"
Sample00()
CUST->(DBCLOSEAREA())
Ferase(".\PEOPLE.DBF")
return nil
//-----------------------------------------------//
function Sample00()
local oDlg, oBrw
local CASADO := "c:\fwh1709\bitmaps\32x32\users.bmp"
local SOLTERO := "c:\fwh1709\bitmaps\32x32\user.bmp"
local SOLTERA := "c:\fwh1709\bitmaps\32x32\mujer.bmp" //agregado a la carpeta
DEFINE DIALOG oDlg SIZE 600,400 PIXEL TRUEPIXEL
@ 10,10 XBROWSE oBrw SIZE -10,-10 PIXEL OF oDlg ;
DATASOURCE "CUST" ;
COLUMNS "FIRST", "CITY", "MARRIED", "MF" ;
CELL LINES NOBORDER
WITH OBJECT oBrw
:bRClicked := {|r,c,f,o| MenuOpc(r,c,o) }
:married:SetCheck( { CASADO, if((oBrw:cAlias)->MF == "M", SOLTERO, SOLTERA) } ) // No selecciona bien el 2do elemento
:CreateFromCode()
END
ACTIVATE DIALOG oDlg CENTERED
return nil
//-----------------------------------------------//
Function MenuOpc(nRow,nCol,oBrw)
local cAlias := oBrw:cAlias
local oMenu
MENU oMenu POPUP
MENUITEM "Todos" ACTION ( (cAlias)->(dbClearFilter()), oBrw:Refresh() )
MENUITEM "Solteros" ACTION ( dbSetFilter({||(cAlias)->Married = .F.}, "(cAlias)->Married = .F."), (cAlias)->(dbgotop()) , oBrw:Refresh())
MENUITEM "Casados" ACTION ( dbSetFilter({||(cAlias)->Married = .T.}, "(cAlias)->Married = .T."), (cAlias)->(dbgotop()) , oBrw:Refresh())
MENUITEM "Masculino" ACTION ( dbSetFilter({||(cAlias)->MF = "M"}, "(cAlias)->MF = 'M'" ), (cAlias)->(dbgotop()) , oBrw:Refresh())
MENUITEM "Femenino" ACTION ( dbSetFilter({||(cAlias)->MF = "F"}, "(cAlias)->MF = 'F'" ), (cAlias)->(dbgotop()) , oBrw:Refresh())
ENDMENU
ACTIVATE POPUP oMenu AT nRow, nCol OF oBrw
Return nil
Saludos.
Francisco J. Alegría P.
Chinandega, Nicaragua.
Fwxh1204-MySql-TMySql