Page 1 of 1
Button on a cell in xbrowse
Posted: Fri Dec 16, 2016 8:40 pm
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
Re: Button on a cell in xbrowse
Posted: Fri Dec 16, 2016 10:14 pm
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
Re: Button on a cell in xbrowse
Posted: Sat Dec 17, 2016 3:29 am
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.
Re: Button on a cell in xbrowse
Posted: Sun Dec 18, 2016 12:33 am
by joseluisysturiz
Very good for option, saludos...
Re: Button on a cell in xbrowse
Posted: Sun Dec 18, 2016 1:35 am
by Adolfo
Thanks..
...trying it