Menu

#124 bug on browse?

v1.0_(example)
open
nobody
None
1
2023-08-21
2023-08-18
No

On a test, ENTER after open browse exits browse.
If uses up/down, ENTER do not exits.
Seems that focus is not on browse, but on previous textbox, and the CLIPPER clause causes exit browse.

FUNCTION gui_Browse( xDlg, xControl, nRow, nCol, nWidth, nHeight, oTbrowse, cField, xValue )

LOCAL aItem

@ nCol, nRow BROWSE xControl DATABASE SIZE nWidth, nHeight STYLE WS_BORDER + WS_VSCROLL + WS_HSCROLL

FOR EACH aItem IN oTBrowse
ADD COLUMN aItem[2] TO xControl HEADER aItem[1] LENGTH Len( Eval( aItem[2] ) ) JUSTIFY LINE DT_LEFT
NEXT

xControl:bOther := { |xControl, msg, wParam, lParam| fKeyDown( xControl, msg, wParam, lParam, cField, @xValue ) }

(xDlg)

RETURN Nil

STATIC FUNCTION fKeyDown( xControl, msg, wParam, lParam, cField, xValue )

LOCAL nKEY

hwg_MsgInfo( "fkeydown" )
IF msg == WM_KEYDOWN
nKey := hwg_PtrToUlong( wParam ) //wParam
IF nKey = VK_RETURN
hwg_MsgInfo( "RETURN" )
IF ! Empty( cField )
xValue := FieldGet( FieldNum( cField, xValue ) )
ENDIF
hwg_EndDialog()
ENDIF
ENDIF
(xControl)
(lParam)

RETURN .T.

On that routine, I can see "fkeydown" 4 times before browse becames visible.
But ENTER on browse closes the browse, and do not execute routine to ENTER.
IF press up/down before ENTER ok.
Can try a workaround using setfocus()

Discussion

  • Alexander S.Kresin

    On a test, ENTER after open browse exits browse.

    Which test?
    Could you provide a code sample, which I could reproduce?

    Regards, Alexander.

     
  • José M. C. Quintas

    My mistake.
    There exists 1 button, browse dialog opens with focus on button, not on browse.

     

Log in to post a comment.