Page 1 of 1

xBrowse EDIT_GET_BUTTON

Posted: Tue Nov 20, 2012 7:06 pm
by ralph
Dear Antonio / Mr. Rao.

the clause EDIT_GET_BUTTON has little documentation and i need your help (Fwh 1202)

This is my code to define a column:

Code: Select all

    REDEFINE XBROWSE oBrwDeta ID 301 OF oFld:aDialogs[2] ALIAS "TMPD"
 ....

    nx := len(oBrwDeta:aCols)
    oBrwDeta:aCols[ nx ]:nEditType   := EDIT_GET_BUTTON
    oBrwDeta:aCols[ nx ]:bEditBlock  := { | r,c,o | o:value := PickPrd(o:value) }
    oBrwDeta:aCols[ nx ]:bOnPostEdit := { | oCol, xVal, nKey | If( RecCount() == 0, ;
                                        ( tmpd->(DbAppend()), oBrw:Refresh() ),), If( nKey == VK_RETURN, TMPD->CODPRD := xVal,),;
                                        oBrwDeta:RefreshCurrent()}

 
The question is: Is there a way to assign a firekey to call my function in :bEditBlock ?
example:

Code: Select all

    oBrwDeta:aCols[ nx ]:bToolTip     := {|| oBrwDeta:aCols[ nx ]:cToolTip := "Press F2 to call list" }
 
When you are doing an invoice with many items, the user is more alike to use the keyboard instead of clicking in the small button with the mouse.

I would apreciate much if you send a small sample

Thanks for your reply

Ralph

Re: xBrowse EDIT_GET_BUTTON

Posted: Tue Nov 20, 2012 7:35 pm
by ralph
One more thing (i think it is a bug):

When the user enter the data directly with the keyboard in the editable column, the :bOnPostEdit is evaluated.
But, when clicking the small button and : bEditBlock is evaluated returning a value, the :bOnPostEdit is NOT evaluated.

Thank for you answer.

Ralph

Re: xBrowse EDIT_GET_BUTTON

Posted: Mon Nov 26, 2012 1:17 pm
by nageswaragunupudi
bEditBlock should return the new value, if the value is changed or NIL if the value is not to be changed.

This line:
oBrwDeta:aCols[ nx ]:bEditBlock := { | r,c,o | o:value := PickPrd(o:value) }

should be re-written as :
oBrwDeta:aCols[ nx ]:bEditBlock := { | r,c,o | PickPrd(o:value) }

PickPrd(...) function should return the new value if edited or NIL if no change is required.

Let me assure you that there is no bug and this works correctly.

Re: xBrowse EDIT_GET_BUTTON

Posted: Mon Nov 26, 2012 9:23 pm
by reinaldocrespo
Ralph;

As for the F2 to open a list, you could try to implement in :bKeyDown, as in:

Code: Select all

WITH OBJECT ::oBrw

      :bKeyDown := {|nKey| isControl := GetKeyState( VK_CONTROL ),;
                  IF( nKey == VK_F2, EVAL( bOpen ),;
...
 

Reinaldo.