FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Button on a cell in xbrowse
Posts: 883
Joined: Tue Oct 11, 2005 11:57 AM
Button on a cell in xbrowse
Posted: Fri Dec 16, 2016 08: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, 2 * 1 TB NVME M.2, GTX 1650
Posts: 1487
Joined: Tue Jun 14, 2016 07:51 AM
Re: Button on a cell in xbrowse
Posted: Fri Dec 16, 2016 10:14 PM
This will give a buttun :

Code (fw): Select all Collapse
   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.08 with Harbour
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: Button on a cell in xbrowse
Posted: Sat Dec 17, 2016 03:29 AM
Code (fw): Select all Collapse
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
Posts: 2064
Joined: Fri Jan 06, 2006 09:28 PM
Re: Button on a cell in xbrowse
Posted: Sun Dec 18, 2016 12:33 AM

Very good for option, saludos... :shock:

Dios no está muerto...



Gracias a mi Dios ante todo!
Posts: 883
Joined: Tue Oct 11, 2005 11:57 AM
Re: Button on a cell in xbrowse
Posted: Sun Dec 18, 2016 01: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, 2 * 1 TB NVME M.2, GTX 1650

Continue the discussion