TDialog ON CLICK bug

Post Reply
User avatar
Enrico Maria Giordano
Posts: 7355
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia
Contact:

TDialog ON CLICK bug

Post by Enrico Maria Giordano »

This is the sample (click has no effect):

Code: Select all

#include "Fivewin.ch"


FUNCTION MAIN()

    LOCAL oDlg

    DEFINE DIALOG oDlg

    ACTIVATE DIALOG oDlg;
             ON CLICK MSGINFO( "Test" );
             CENTER

    RETURN NIL
And this is a possible solution:

Code: Select all

METHOD HandleEvent( nMsg, nWParam, nLParam ) CLASS TDialog

   do case
      case nMsg == WM_INITDIALOG
           return ::Initiate( nWParam, nLParam )

      case nMsg == WM_PAINT
           return ::Display()

      case nMsg == WM_PRINTCLIENT
           return ::PrintClient( nWParam )

      case nMsg == WM_LBUTTONDOWN
           if ::lHelpIcon
              ::Help()
           endif        

           return Super:HandleEvent( nMsg, nWParam, nLParam ) // EMG
           
      otherwise
           return Super:HandleEvent( nMsg, nWParam, nLParam )
   endcase

return nil
EMG
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post by Antonio Linares »

Enrico,

many thanks for your fix. This code looks like a better one:

Code: Select all

      case nMsg == WM_LBUTTONDOWN
           if ::lHelpIcon
              ::Help()
           else        
              return Super:HandleEvent( nMsg, nWParam, nLParam )
           endif   
Anyhow if you test it with the dialog.prg that we have sent you (not modified yet) you will see we help a help msg that should not happen.
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Enrico Maria Giordano
Posts: 7355
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia
Contact:

Post by Enrico Maria Giordano »

Antonio Linares wrote:Enrico,

many thanks for your fix. This code looks like a better one:

Code: Select all

      case nMsg == WM_LBUTTONDOWN
           if ::lHelpIcon
              ::Help()
           else        
              return Super:HandleEvent( nMsg, nWParam, nLParam )
           endif   
Yes, definitely.
Antonio Linares wrote:Anyhow if you test it with the dialog.prg that we have sent you (not modified yet) you will see we help a help msg that should not happen.
Yes, confirmed. It shoud not happen.

EMG
Post Reply