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.
Problem with buttons in FWH 8.12
Problem with buttons in FWH 8.12
Regards,
Michel D.
Genk (Belgium)
_____________________________________________________________________________________________
I use : FiveWin for (x)Harbour v. 24.09 - Harbour 3.2.0 (February 2024) - xHarbour Builder (January 2020) - Bcc773
Michel D.
Genk (Belgium)
_____________________________________________________________________________________________
I use : FiveWin for (x)Harbour v. 24.09 - Harbour 3.2.0 (February 2024) - xHarbour Builder (January 2020) - Bcc773
- Antonio Linares
- Site Admin
- Posts: 42521
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Has thanked: 31 times
- Been thanked: 75 times
- Contact:
Re: Problem with buttons in FWH 8.12
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
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
Re: Problem with buttons in FWH 8.12
Antonio,
Meanwhile I found out that the problem is caused by the function lastkey().
I usually use this in my dialog boxes :
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 :
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 :
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.
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
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
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
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.09 - Harbour 3.2.0 (February 2024) - xHarbour Builder (January 2020) - Bcc773
Michel D.
Genk (Belgium)
_____________________________________________________________________________________________
I use : FiveWin for (x)Harbour v. 24.09 - Harbour 3.2.0 (February 2024) - xHarbour Builder (January 2020) - Bcc773
- Antonio Linares
- Site Admin
- Posts: 42521
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Has thanked: 31 times
- Been thanked: 75 times
- Contact:
Re: Problem with buttons in FWH 8.12
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 ?
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 ?
Re: Problem with buttons in FWH 8.12
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.
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.09 - Harbour 3.2.0 (February 2024) - xHarbour Builder (January 2020) - Bcc773
Michel D.
Genk (Belgium)
_____________________________________________________________________________________________
I use : FiveWin for (x)Harbour v. 24.09 - Harbour 3.2.0 (February 2024) - xHarbour Builder (January 2020) - Bcc773
- Antonio Linares
- Site Admin
- Posts: 42521
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Has thanked: 31 times
- Been thanked: 75 times
- Contact:
Re: Problem with buttons in FWH 8.12
Michel,
Please run this test and press esc and check what value is shown, thanks
Please run this test and press esc and check what value is shown, thanks
Code: Select all | Expand
#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
Re: Problem with buttons in FWH 8.12
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.
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.09 - Harbour 3.2.0 (February 2024) - xHarbour Builder (January 2020) - Bcc773
Michel D.
Genk (Belgium)
_____________________________________________________________________________________________
I use : FiveWin for (x)Harbour v. 24.09 - Harbour 3.2.0 (February 2024) - xHarbour Builder (January 2020) - Bcc773
- Antonio Linares
- Site Admin
- Posts: 42521
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Has thanked: 31 times
- Been thanked: 75 times
- Contact:
Re: Problem with buttons in FWH 8.12
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
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
