FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Little problem in TButton?
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Little problem in TButton?
Posted: Sun Feb 05, 2006 03:59 PM
This is the sample. As you can notice, clicking on the button has no effect:

#include "Fivewin.ch"


FUNCTION MAIN()

    LOCAL oDlg

    LOCAL oGet, oBtn

    LOCAL cVar := SPACE( 30 )

    DEFINE DIALOG oDlg

    @ 1, 1 GET oGet VAR cVar

    @ 3, 1 BUTTON oBtn PROMPT "Close" ACTION oDlg:End()

    oBtn:bLButtonUp = { || oGet:SetFocus() }

    ACTIVATE DIALOG oDlg;
             CENTER

    RETURN NIL


This is a possible solution: add the following method to TButton:

METHOD LButtonUp( nRow, nCol, nKeyFlags ) CLASS TButton

   if ::bLButtonUp != nil .and. !IsOverWnd( ::hWnd, nRow, nCol )
      return Eval( ::bLButtonUp, nRow, nCol, nKeyFlags )
   endif

return nil


What do you think?

EMG
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Little problem in TButton?
Posted: Tue Feb 07, 2006 11:11 AM

Enrico,

> As you can notice, clicking on the button has no effect:

Here it works ok. The focus is given to the GET.

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Little problem in TButton?
Posted: Tue Feb 07, 2006 11:37 AM
Yes, but the ACTION clause is not fired. Try this and you will not hear the beep:

#include "Fivewin.ch"


FUNCTION MAIN()

    LOCAL oDlg

    LOCAL oGet, oBtn

    LOCAL cVar := SPACE( 30 )

    DEFINE DIALOG oDlg

    @ 1, 1 GET oGet VAR cVar

    @ 3, 1 BUTTON oBtn PROMPT "Close" ACTION MSGBEEP()

    oBtn:bLButtonUp = { || oGet:SetFocus() }

    ACTIVATE DIALOG oDlg;
             CENTER

    RETURN NIL


EMG

Continue the discussion