Problem with buttons in FWH 8.12

Problem with buttons in FWH 8.12

Postby driessen » Mon Jan 12, 2009 9:38 am

Hello,

A costumer of mine just gave me a phonecall with a very strange problem he discovered after having updated this weekend.

The update I made available was build with FWH 8.12.

Sometimes (not always), some buttons refuse every action. After having restarted the application the work for some time but after a while the refuse any action again.

In FWH 8.11 I never noticed this problem.

What's wrong ?

Thanks.
Regards,

Michel D.
Genk (Belgium)
_____________________________________________________________________________________________
I use : FiveWin for (x)Harbour v. 24.07 - Harbour 3.2.0 (February 2024) - xHarbour Builder (January 2020) - Bcc773
User avatar
driessen
 
Posts: 1422
Joined: Mon Oct 10, 2005 11:26 am
Location: Genk, Belgium

Re: Problem with buttons in FWH 8.12

Postby Antonio Linares » Mon Jan 12, 2009 12:57 pm

Michel,

Are they standard pushbuttons ? or ButtonBmp ? or BtnBmp ?

Are they placed on dialogboxes ?

We have not modified anything in the buttons for 8.12. Its strange...

Could you provide some screenshots ? Or an example ? thanks
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42080
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Problem with buttons in FWH 8.12

Postby driessen » Tue Jan 13, 2009 12:18 am

Antonio,

Meanwhile I found out that the problem is caused by the function lastkey().

I usually use this in my dialog boxes :
Code: Select all  Expand view
REDEFINE BUTTON ID 901 OF oDlg ACTION (cRet:=.T.,oDlg:End()
REDEFINE BUTTON ID 902 OF oDlg ACTION (cRet:=.F.,oDlg:END()
// These buttons define the OK and CANCEL
ACTIVATE DIALOG oDlg CENTERED

IF GETKEYSTATUS() ; cRet := .F. ; ENDIF


GETKEYSTATUS() checks if Escape has been pressed. The results is the same as the CANCEL button.

So the problem comes from the GETKEYSTATUS() function.

This is the function I use :
Code: Select all  Expand view
FUNCTION GetKeyStatus

   LOCAL StatRet := .F.

   SYSREFRESH()

   IF LastKey() = VK_ESCAPE
      StatRet := .T.
   ENDIF

   SYSREFRESH()

RETURN(StatRet)


But it looks like the LastKey()-function is maintaining VK_ESCAPE, although other keys on my keyboard have been pressed on.

I changed this function to :
Code: Select all  Expand view
FUNCTION GetKeyStatus(StRet)

    LOCAL kRet := .F.

    DEFAULT(StRet,.F.)

    IF GetAsyncKey(VK_ESCAPE)
       IF StRet .OR. LastKey() = VK_ESCAPE
          kRet := .T.
       ENDIF
    ENDIF

    SYSREFRESH()

RETURN(kRet)


This function mostly runs fine, except that I have to push VK_ESCAPE twice or tree times sometimes before any reaction is seen.

Any idea ?

Thanks.
Regards,

Michel D.
Genk (Belgium)
_____________________________________________________________________________________________
I use : FiveWin for (x)Harbour v. 24.07 - Harbour 3.2.0 (February 2024) - xHarbour Builder (January 2020) - Bcc773
User avatar
driessen
 
Posts: 1422
Joined: Mon Oct 10, 2005 11:26 am
Location: Genk, Belgium

Re: Problem with buttons in FWH 8.12

Postby Antonio Linares » Tue Jan 13, 2009 12:25 am

Michel,

Maybe you are linking LastKey() from Harbour/xHarbour instead of FWH LastKey().

Have you lately changed your libraries linking order ?

Are you using Harbour or xHarbour ? Are you using a more recent version ?
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42080
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Problem with buttons in FWH 8.12

Postby driessen » Tue Jan 13, 2009 12:51 am

Antonio,

No, I didn't change my libraries linking order.

I'm using xHabour Builder (version Sept. 08) Professional.

How do I know which version of LastKey() I'm using ?

Thanks.
Regards,

Michel D.
Genk (Belgium)
_____________________________________________________________________________________________
I use : FiveWin for (x)Harbour v. 24.07 - Harbour 3.2.0 (February 2024) - xHarbour Builder (January 2020) - Bcc773
User avatar
driessen
 
Posts: 1422
Joined: Mon Oct 10, 2005 11:26 am
Location: Genk, Belgium

Re: Problem with buttons in FWH 8.12

Postby Antonio Linares » Tue Jan 13, 2009 1:04 am

Michel,

Please run this test and press esc and check what value is shown, thanks
Code: Select all  Expand view
#include "FiveWin.ch"

function Main()

   local oDlg, cTest := Space( 20 )

   DEFINE DIALOG oDlg

   @ 1, 2 GET cTest SIZE 80, 10

   @ 2, 3 BUTTON "Test" ACTION oDlg:End() DEFAULT

   ACTIVATE DIALOG oDlg CENTERED
   
   MsgInfo( LastKey() )

return nil
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42080
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Problem with buttons in FWH 8.12

Postby driessen » Tue Jan 13, 2009 1:15 pm

Antonio,

I got (to my opinion) a strange result :

If I push the Escape-key, I got "27" which is the ASCII-value of the Escape-key. So far, so good.

If I click with the mouse on the TEST-button, I got "0"

If I push on the Enter-key, I also got "0".

But if I put a name in the GET, like "TEST", shouldn't lastkey() return "84" since it's the ASCII-value of "T" after having clicked with the mouse on the TEST-button ? And in case I push the Enter-key, shouldn't lastkey() return "13" ?

Looks strange to me.

But thanks anyway.

I always thought that lastkey() contains the last key which was pushed on my keyboard.
Regards,

Michel D.
Genk (Belgium)
_____________________________________________________________________________________________
I use : FiveWin for (x)Harbour v. 24.07 - Harbour 3.2.0 (February 2024) - xHarbour Builder (January 2020) - Bcc773
User avatar
driessen
 
Posts: 1422
Joined: Mon Oct 10, 2005 11:26 am
Location: Genk, Belgium

Re: Problem with buttons in FWH 8.12

Postby Antonio Linares » Tue Jan 13, 2009 9:15 pm

Michel,

I have been reviewing FWH LastKey(). First thing I missed to comment is that FWH LastKey() gets translated to _LastKey() as LastKey() is a compiler reserved word.

So if you call _LastKey() then you are totally sure that you are using FWH _LastKey() instead of Harbour/xHarbour LastKey().

From FWH function _LastKey() you get the latest value that we receive from a WM_CHAR message.

Also, when a WM_GETDLGCODE message arrives, there is an undocumented parameter, which it is the lastkey value. This value is provided by the Windows API, and FiveWin provides it here: METHOD GetDlgCode( nLastKey ).

nLastKey is stored in ::oWnd:nLastKey. Hope this helps :-)
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42080
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 74 guests