FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin para Harbour/xHarbour Imagen en Columna de Xbrowse superpone acciones
Posts: 309
Joined: Wed Mar 28, 2018 04:38 PM
Imagen en Columna de Xbrowse superpone acciones
Posted: Wed Jan 12, 2022 04:13 PM
Hola.

Intento incluir 2 im谩genes en una columna del xBrowse para realizar acciones de disminuci贸n o aumento del valor de la columna. Funciona todo bien, pero cuando hago doble click sobre la imagen de la izquierda ( menos ) ejecuta la funci贸n de la imagen de la derecha ( m谩s ). En la captura animada no aparece la imagen pero la acci贸n s铆 que se realiza.
Hay alguna forma de interceptar ese doble click en la imagen de la izquierda ( menos ) para que no haga ninguna funcionalidad?

Lo he probado con el siguiente c贸digo:
Code (fw): Select all Collapse
#include "fivewin.ch"

function TestMain()

聽 聽local oWnd, oBar, oBrw

聽 聽DEFINE WINDOW oWnd 

聽 聽@ 0,0 XBROWSE oBrw OF oWnd;
聽 聽 聽 COLUMNS 1;
聽 聽 聽 HEADERS "numero";
聽 聽 聽 ARRAY {1,2,3,4} 

聽 聽WITH OBJECT oBrw
聽 聽 聽 :CreateFromCode()

聽 聽 聽 WITH OBJECT :aCols[1]
聽 聽 聽 聽 聽 聽 :nDataStrAlign := AL_CENTER
聽 聽 聽 聽 聽 聽 :AddBitmap( { FW_BmpPlus(), FW_BmpMinus() } )

聽 聽 聽 聽 聽 聽 :nEditType 聽 聽 := EDIT_BUTTON
聽 聽 聽 聽 聽 聽 :bEditBlock 聽 聽:= { |r,c,oCol| oCol:VarPut( oCol:Value + 1 ) }
聽 聽 聽 聽 聽 聽 :nBtnBmp 聽 聽 聽 := 1
聽 聽 聽 聽 聽 聽 :lBtnTransparent 聽:= .t.

聽 聽 聽 聽 聽 聽 :bBmpData 聽 聽 聽:= { |v,lSel| If( lSel, 2, 0 ) }
聽 聽 聽 聽 聽 聽 :bBmpAction 聽 聽:= { |oCol| oCol:VarPut( oCol:Value - 1 ) 聽}
聽 聽 聽 聽 END

聽 聽END

聽 聽ACTIVATE WINDOW oWnd

return nil


El resultado es el siguiente, las pulsaciones iniciales funcionan bien, pero las 煤ltimas pulsaciones que hago en el bot贸n menos son con doble click


gracias y salud!
--------

驴 Y porque no ?

驴 And why not ?
Posts: 6755
Joined: Wed Feb 15, 2012 08:25 PM
Re: Imagen en Columna de Xbrowse superpone acciones
Posted: Wed Jan 12, 2022 04:38 PM
Victor

Code (fw): Select all Collapse
         WITH OBJECT :oCol( 5 )
            :nDataStrAlign  := AL_CENTER
            :nWidth         := 100
            :AddBitmap( { "PLUS1", "MIN1" } )
            // Right Button
            :nEditType       := EDIT_BUTTON
            :bEditBlock      := { | r, c, oCol | if( Valtype( oCol ) = "O", oCol:Value + 1, ) }
            :nBtnBmp         := 1
            :lBtnTransparent := .t.
            // Left Button
            :bBmpData        := { | v, lSel | 2 } //if( lSel, 2, 0 ) }
            :bBmpAction      := { | oCol | if( Valtype( oCol ) = "O", oCol:VarPut( if( oCol:Value > 1, oCol:Value - 1, oCol:Value ) ), ) }
    END
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: 309
Joined: Wed Mar 28, 2018 04:38 PM
Re: Imagen en Columna de Xbrowse superpone acciones
Posted: Thu Jan 13, 2022 08:48 AM

Gracias por la r谩pida respuesta Cristobal.

He probado tu c贸digo y el comportamiento es el mismo, cuando pulsas doble click en el bot贸n de "menos" hace las 2 acciones, primero eval煤a el bEditBlock y luego el bBmpAction

--------

驴 Y porque no ?

驴 And why not ?
Posts: 6755
Joined: Wed Feb 15, 2012 08:25 PM
Re: Imagen en Columna de Xbrowse superpone acciones
Posted: Thu Jan 13, 2022 12:36 PM
Victor, parece ser que no hab铆a entendido tu pregunta, prueba a帽adiendo esto en la definici贸n de la columna
Code (fw): Select all Collapse
聽 聽 聽 聽 聽 聽 :bLDClickData 聽 聽:= { | nR, nC, nK, oCol | .T. }
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: 309
Joined: Wed Mar 28, 2018 04:38 PM
Re: Imagen en Columna de Xbrowse superpone acciones
Posted: Thu Jan 13, 2022 01:37 PM
Esa era la clave Cristobal!

ahora funciona perfecto, el blDClickData intercepta el dobleclick para que no haga nada.

Dejo el c贸digo que funciona por si a alguien m谩s le sirve.

Code (fw): Select all Collapse
#include "fivewin.ch"

function TestMain()

聽 聽local oWnd, oBar, oBrw

聽 聽DEFINE WINDOW oWnd

聽 聽@ 0,0 XBROWSE oBrw OF oWnd;
聽 聽 聽 COLUMNS 1;
聽 聽 聽 HEADERS "numero";
聽 聽 聽 ARRAY {1,2,3,4}

聽 聽WITH OBJECT oBrw
聽 聽 聽 :CreateFromCode()

聽 聽 聽 WITH OBJECT :aCols[1]
聽 聽 聽 聽 聽:nDataStrAlign 聽:= AL_CENTER
聽 聽 聽 聽 聽:nWidth 聽 聽 聽 聽 := 100
聽 聽 聽 聽 聽:AddBitmap( { FW_BmpPlus(), FW_BmpMinus() } )
聽 聽 聽 聽 聽// Right Button
聽 聽 聽 聽 聽:nEditType 聽 聽 聽 := EDIT_BUTTON
聽 聽 聽 聽 聽:bEditBlock 聽 聽 聽:= { | r, c, oCol | if( Valtype( oCol ) = "O", oCol:Value + 1, ) }
聽 聽 聽 聽 聽:nBtnBmp 聽 聽 聽 聽 := 1
聽 聽 聽 聽 聽:lBtnTransparent := .t.
聽 聽 聽 聽 聽// Left Button
聽 聽 聽 聽 聽:bBmpData 聽 聽 聽 聽:= { | v, lSel | 2 } //if( lSel, 2, 0 ) }
聽 聽 聽 聽 聽:bBmpAction 聽 聽 聽:= { | oCol | if( Valtype( oCol ) = "O", oCol:VarPut( if( oCol:Value > 1, oCol:Value - 1, oCol:Value ) ), ) }
聽 聽 聽 聽 聽:bLDClickData 聽 聽:= { | nR, nC, nK, oCol | .T. }
聽 聽 聽 END

聽 聽END

聽 聽ACTIVATE WINDOW oWnd

return nil


Gracias y salud!
--------

驴 Y porque no ?

驴 And why not ?

Continue the discussion