FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin para Harbour/xHarbour Clic Derecho Xbrowse (Solucionado)
Posts: 1818
Joined: Wed Oct 26, 2005 02:49 PM

Clic Derecho Xbrowse (Solucionado)

Posted: Tue Jun 30, 2015 03: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 (fw): Select all Collapse
聽 oBrwDofa:bRClicked 聽 聽 聽 聽 聽 := { | nRow, nCol | ShowPopup( nRow, nCol , oBrwDofa }


y el menu

Code (fw): Select all Collapse
***********************************
*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?.
Saludos
LEANDRO AREVALO
Bogot谩 (Colombia)
https://hymlyma.com
https://hymplus.com/
leandroalfonso111@gmail.com
leandroalfonso111@hotmail.com

[ Turbo Incremental Link64 6.98 Embarcadero 7.70 ] [ FiveWin 25.01 ] [ xHarbour 64 bits) ]
Posts: 3358
Joined: Fri Oct 07, 2005 08:20 PM

Re: Clic Derecho Xbrowse

Posted: Tue Jun 30, 2015 04: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 (fw): Select all Collapse
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
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM

Re: Clic Derecho Xbrowse

Posted: Tue Jun 30, 2015 04: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
Posts: 1818
Joined: Wed Oct 26, 2005 02:49 PM

Re: Clic Derecho Xbrowse

Posted: Tue Jun 30, 2015 05: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 (fw): Select all Collapse
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

[ Turbo Incremental Link64 6.98 Embarcadero 7.70 ] [ FiveWin 25.01 ] [ xHarbour 64 bits) ]
Posts: 6755
Joined: Wed Feb 15, 2012 08:25 PM

Re: Clic Derecho Xbrowse

Posted: Tue Jun 30, 2015 05: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
Posts: 1818
Joined: Wed Oct 26, 2005 02:49 PM

Re: Clic Derecho Xbrowse

Posted: Tue Jun 30, 2015 06: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

[ Turbo Incremental Link64 6.98 Embarcadero 7.70 ] [ FiveWin 25.01 ] [ xHarbour 64 bits) ]

Continue the discussion