Button on a cell in xbrowse

Button on a cell in xbrowse

Postby Adolfo » Fri Dec 16, 2016 8:40 pm

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
----------
Asus TUF F15, 32GB Ram, 1 TB NVME M.2, 1 TB SSD, GTX 1650
User avatar
Adolfo
 
Posts: 846
Joined: Tue Oct 11, 2005 11:57 am
Location: Chile

Re: Button on a cell in xbrowse

Postby Marc Venken » Fri Dec 16, 2016 10:14 pm

This will give a buttun :

Code: Select all  Expand view

   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 23.04 with Harbour
User avatar
Marc Venken
 
Posts: 1372
Joined: Tue Jun 14, 2016 7:51 am
Location: Belgium

Re: Button on a cell in xbrowse

Postby nageswaragunupudi » Sat Dec 17, 2016 3:29 am

Code: Select all  Expand view

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
nageswaragunupudi
 
Posts: 10335
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: Button on a cell in xbrowse

Postby joseluisysturiz » Sun Dec 18, 2016 12:33 am

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

Gracias a mi Dios ante todo!
User avatar
joseluisysturiz
 
Posts: 2064
Joined: Fri Jan 06, 2006 9:28 pm
Location: Guatire - Caracas - Venezuela

Re: Button on a cell in xbrowse

Postby Adolfo » Sun Dec 18, 2016 1:35 am

Thanks..

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

http://www.xdata.cl - Desarrollo Inteligente
----------
Asus TUF F15, 32GB Ram, 1 TB NVME M.2, 1 TB SSD, GTX 1650
User avatar
Adolfo
 
Posts: 846
Joined: Tue Oct 11, 2005 11:57 am
Location: Chile


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 132 guests