Button on a cell in xbrowse

Post Reply
User avatar
Adolfo
Posts: 815
Joined: Tue Oct 11, 2005 11:57 am
Location: Chile
Contact:

Button on a cell in xbrowse

Post by Adolfo »

Hi everyone

I need to put a Button calling xAction on a cell in xBrowse


I have an array like this

1 - Normal - DoNormal()
2 - Special - DoSpecial()
3.- Green - DoGreen()

I need to put a button on 3rd column to call the action,
Number of Items vary, names of actions also, I can control it with no problem, but I need to call the action thru a Button in the xBrowse

Any help will be apreciated

From Chile
Adolfo
;-) Ji,ji,ji... buena la cosa... "all you need is code"

http://www.xdata.cl - Desarrollo Inteligente
----------
Lenovo Legion Y520, 16GB Ram, 1 TB NVME M.2, 1 TB SSD, GTX 1050
User avatar
Marc Venken
Posts: 727
Joined: Tue Jun 14, 2016 7:51 am

Re: Button on a cell in xbrowse

Post by Marc Venken »

This will give a buttun :

Code: Select all

   WITH OBJECT oData

      WITH OBJECT :oCol( 3 )
         :nEditType     := EDIT_GET_BUTTON
         :bClrSel          := { || { CLR_BLACK, CLR_HGRAY }}

         :bEditBlock    := { |r,c,oCol| yourfunction( oCol:Value ) }

      ENDWITH
      :bClrEdits        := { || { CLR_BLACK, CLR_YELLOW }}
      :bClrRowFocus     := { || { CLR_BLACK, RGB(185,220,255) } }

      :CreateFromCode()
   END

 
Marc Venken
Using: FWH 20.08 with Harbour
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Re: Button on a cell in xbrowse

Post by nageswaragunupudi »

Code: Select all

oBrw:aCols[ 3 ]:nEditType := EDIT_BUTTON
oBrw:aCols[ 3 ]:bEditBlock := { |nRow,nCol,oCol,nKey| YourAction( nRow, nCol, oCol, nKey ) }
 
nRow,nCol: row and col of the click
oCol : Column Object
nKey : Key code if the action is triggered by pressing a key

Return value of the codeblock:
a) NIL: If the codeblock returns nil, XBrowse does not take any action on its own.
b) uVal: If the codeblock returns any value other than nil, XBrowse assigns that value to the column and saves it.
If the intention of the programmer is to modify the value of the column, the correct way is the return the new value and not to modify the value by the programmer himself.



EDIT_BUTTON Vs EDIT_GET_BUTTON:

EDIT_BUTTON: Only action possible by the user is to invoke the Action by clicking the button or pressing Enter
EDIT_GET_BUTTON: User can either enter a value or click the button to invoke the action.
Regards

G. N. Rao.
Hyderabad, India
User avatar
joseluisysturiz
Posts: 2024
Joined: Fri Jan 06, 2006 9:28 pm
Location: Guatire - Caracas - Venezuela
Contact:

Re: Button on a cell in xbrowse

Post by joseluisysturiz »

Very good for option, saludos... :shock:
Dios no está muerto...

Gracias a mi Dios ante todo!
User avatar
Adolfo
Posts: 815
Joined: Tue Oct 11, 2005 11:57 am
Location: Chile
Contact:

Re: Button on a cell in xbrowse

Post by Adolfo »

Thanks..

...trying it
;-) Ji,ji,ji... buena la cosa... "all you need is code"

http://www.xdata.cl - Desarrollo Inteligente
----------
Lenovo Legion Y520, 16GB Ram, 1 TB NVME M.2, 1 TB SSD, GTX 1050
Post Reply