Little problem in TButton?

Little problem in TButton?

Postby Enrico Maria Giordano » Sun Feb 05, 2006 3:59 pm

This is the sample. As you can notice, clicking on the button has no effect:

Code: Select all  Expand view
#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:

Code: Select all  Expand view
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
User avatar
Enrico Maria Giordano
 
Posts: 8715
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Postby Antonio Linares » 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
User avatar
Antonio Linares
Site Admin
 
Posts: 42099
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby Enrico Maria Giordano » Tue Feb 07, 2006 11:37 am

Yes, but the ACTION clause is not fired. Try this and you will not hear the beep:

Code: Select all  Expand view
#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
User avatar
Enrico Maria Giordano
 
Posts: 8715
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: MSN [Bot] and 52 guests