FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour xBrowse EDIT_GET_BUTTON
Posts: 92
Joined: Fri Nov 18, 2005 11:15 PM
xBrowse EDIT_GET_BUTTON
Posted: Tue Nov 20, 2012 07:06 PM
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 (fw): Select all Collapse
    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 (fw): Select all Collapse
    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
Ralph del Castillo

Lima PERU

Fwh 24.07, xHb123_10193, MySQL 8.x, BCC 7.3
Posts: 92
Joined: Fri Nov 18, 2005 11:15 PM
Re: xBrowse EDIT_GET_BUTTON
Posted: Tue Nov 20, 2012 07:35 PM

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

Ralph del Castillo

Lima PERU

Fwh 24.07, xHb123_10193, MySQL 8.x, BCC 7.3
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: xBrowse EDIT_GET_BUTTON
Posted: Mon Nov 26, 2012 01:17 PM

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.

Regards



G. N. Rao.

Hyderabad, India
Posts: 990
Joined: Thu Nov 17, 2005 05:49 PM
Re: xBrowse EDIT_GET_BUTTON
Posted: Mon Nov 26, 2012 09:23 PM
Ralph;

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

Code (fw): Select all Collapse
WITH OBJECT ::oBrw

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



Reinaldo.

Continue the discussion