Clic Derecho Xbrowse (Solucionado)

Clic Derecho Xbrowse (Solucionado)

Postby leandro » Tue Jun 30, 2015 3:52 pm

Compañeros del foro buen día

Lo que pasa es que tengo varias columnas definidas en un xbrowse. Y necesito que al hacer clic derecho me muestre un menu popup. Actualmente lo estoy haciendo de la siguiente manera:

Code: Select all  Expand view

  oBrwDofa:bRClicked           := { | nRow, nCol | ShowPopup( nRow, nCol , oBrwDofa }
 


y el menu

Code: Select all  Expand view
***********************************
*MENU POP-UP CON TODAS LAS OPCIONES
***********************************
function ShowPopup( nRow, nCol, oBrw )
local oPopup, oFont

MENU oPopup POPUP 2007
  MENUITEM "Agregar Lote" RESOURCE "#8073" ACTION oLamcla:autoriza(72)
  MENUITEM "Modificar Lote" RESOURCE "#8082" ACTION oLamcla:autoriza(73)
  MENUITEM "Borrar Lote" RESOURCE "#8074" ACTION oLamcla:autoriza(74)
  SEPARATOR
  MENUITEM "Fotografia Lote" RESOURCE "#8081" ACTION oLamcla:autoriza(76)
  if alltrim(oRsDocfac:Fields( "estdcpt" ):Value)="L"
    MENUITEM "Vender Lote" RESOURCE "#8084" ACTION oLamcla:autoriza(79)
  else
    MENUITEM "Vender Lote" DISABLED RESOURCE "#8084"
  endif
  MENUITEM "Consulta Pagos" ACTION oLamcla:autoriza(77)
  MENUITEM "Linderos Lote" RESOURCE "#8098" ACTION oLamcla:autoriza(105)
  SEPARATOR
  if alltrim(oRsDocfac:Fields( "estdcpt" ):Value)="G"
    MENUITEM "Gestion Acuerdos de Pago" RESOURCE "#8097" ACTION oLamcla:autoriza(87)
  else
    MENUITEM "Gestion Acuerdos de Pago" RESOURCE "#8097" DISABLED
  endif
  SEPARATOR
  MENUITEM "Contrato C-Vta Entregado" RESOURCE "#8084" ACTION oLamcla:autoriza(108)
  SEPARATOR
  MENUITEM "Cerrar Ventana" RESOURCE "#8076" ACTION oWHiCt:End()
ENDMENU
ACTIVATE POPUP oPopup OF oBrw AT nRow, nCol
return nil
 


Hasta ahí todo bien ahora el tema se complica, por que necesito saber sobre que columna se hace el clic. Dependiendo de la columna se deben mostrar opciones diferentes.

Alguien sabe como hacer esto?.
Last edited by leandro on Tue Jun 30, 2015 7:45 pm, edited 1 time in total.
Saludos
LEANDRO AREVALO
Bogotá (Colombia)
https://hymlyma.com
https://hymplus.com/
leandroalfonso111@gmail.com
leandroalfonso111@hotmail.com

[ Embarcadero C++ 7.60 for Win32 ] [ FiveWin 23.07 ] [ xHarbour 1.3.0 Intl. (SimpLex) (Build 20230914) ]
User avatar
leandro
 
Posts: 1481
Joined: Wed Oct 26, 2005 2:49 pm
Location: Colombia

Re: Clic Derecho Xbrowse

Postby Armando » Tue Jun 30, 2015 4:03 pm

Leandro:

Y la variable nCol de tu código no te da el número de columna sobre la que se da el clic?
Code: Select all  Expand view

oBrwDofa:bRClicked           := { | nRow, nCol | ShowPopup( nRow, nCol , oBrwDofa }
 


En la función ShowPopup()

MsgInfo(nCol)

Saludos
SOI, s.a. de c.v.
estbucarm@gmail.com
http://www.soisa.mex.tl/
http://sqlcmd.blogspot.com/
Tel. (722) 174 44 45
Carpe diem quam minimum credula postero
User avatar
Armando
 
Posts: 3061
Joined: Fri Oct 07, 2005 8:20 pm
Location: Toluca, México

Re: Clic Derecho Xbrowse

Postby nageswaragunupudi » Tue Jun 30, 2015 4:43 pm

Please do not use bRClicked at all.

Recommended:
This is how XBrowse implements popups.

oBrw:bPopUp := { |oCol| MyPopUp( oCol ) } // applies to the entire browse

oCol:bPopup := { |oCol| MyPopUp( oCol ) } // Popup is shown when right clicked on this column only.

Sample popup function:

function MyPopUp( oCol )

local oBrw := oCol:oBrw
local oPop

MENU oPop POPUP 2007
... menuitems depending on the column
ENDMENU

// do not activate popup here.
// return oPop object.
// xbrowse automatically activates the popup at the correct position.

return oPop

Please see \fwh\samples\testxbr3.prg for sample usage.
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10248
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: Clic Derecho Xbrowse

Postby leandro » Tue Jun 30, 2015 5:49 pm

Armando wrote:Leandro:

Y la variable nCol de tu código no te da el número de columna sobre la que se da el clic?
Code: Select all  Expand view

oBrwDofa:bRClicked           := { | nRow, nCol | ShowPopup( nRow, nCol , oBrwDofa }
 


En la función ShowPopup()

MsgInfo(nCol)

Saludos


Gracias por Responder Armando... Pense exactamente lo mismo que tu. Pero lo que retorna es la posición (y) del cursor.

Mr. Rao.. Muchas gracias por responder. Voy a realizar pruebas y comento.
Saludos
LEANDRO AREVALO
Bogotá (Colombia)
https://hymlyma.com
https://hymplus.com/
leandroalfonso111@gmail.com
leandroalfonso111@hotmail.com

[ Embarcadero C++ 7.60 for Win32 ] [ FiveWin 23.07 ] [ xHarbour 1.3.0 Intl. (SimpLex) (Build 20230914) ]
User avatar
leandro
 
Posts: 1481
Joined: Wed Oct 26, 2005 2:49 pm
Location: Colombia

Re: Clic Derecho Xbrowse

Postby cnavarro » Tue Jun 30, 2015 5:54 pm

Aunque, evidentemente la indicacion correcta es la que indica Mr. Rao, creo que el metodo ::nAtCol( nPix ) devolvia la columna en la que te encuentras
Cristobal Navarro
Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo
El secreto de la felicidad no está en hacer lo que te gusta, sino en que te guste lo que haces
User avatar
cnavarro
 
Posts: 6500
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

Re: Clic Derecho Xbrowse

Postby leandro » Tue Jun 30, 2015 6:46 pm

Excelente Mr.Rao Era lo que necesitaba. Muchas Gracias :D

Cristobal... Voy a realizar pruebas con tu informacion.
Saludos
LEANDRO AREVALO
Bogotá (Colombia)
https://hymlyma.com
https://hymplus.com/
leandroalfonso111@gmail.com
leandroalfonso111@hotmail.com

[ Embarcadero C++ 7.60 for Win32 ] [ FiveWin 23.07 ] [ xHarbour 1.3.0 Intl. (SimpLex) (Build 20230914) ]
User avatar
leandro
 
Posts: 1481
Joined: Wed Oct 26, 2005 2:49 pm
Location: Colombia


Return to FiveWin para Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot], nageswaragunupudi and 70 guests