1. Gordon Weil
  2. PowerBuilder
  3. Thursday, 13 June 2024 20:05 PM UTC

A new datawindow in our PB2022 application (22.2.0.3289) has a button on it. I have never used a datawindow button before. For several of my users clicking the same button on the same row twice in a row crashes the program. The crash usually occurs in PBDWE.DLL but sometimes it occurs elsewhere. I cannot locate the line where the crash happens but it happens before the first line in the buttonclicked event.

Anyone else have problems with clicking a button on a datawindow?

Chris Pollach @Appeon Accepted Answer Pending Moderation
  1. Friday, 14 June 2024 16:47 PM UTC
  2. PowerBuilder
  3. # 1

Hi Gordon;

   As with all buttons (real control or DWO based), this can happen when the user double clicks "slowly" causing then in essence two single click events to occur on the CB. This situation should never happen IF PB developers always followed this discipline: 

  1. Disable the CB
  2. Perform the related CB processing code
  3. Then Re-enable the CB after all CB processing has completed

  For the DWO, the Disabling / Enabling code would be ...  <DW Control Name>.Modify ("<Buttonname>.Enabled=<Yes or No>")

HTH

Regards .. Chris

Comment
There are no comments made yet.
Chris Pollach @Appeon Accepted Answer Pending Moderation
  1. Friday, 14 June 2024 16:44 PM UTC
  2. PowerBuilder
  3. # 2

Hi Gordon;

   As with all buttons (real control or DWO based), this can happen when the user double clicks "slowly" causing then in essence two single click events to occur on the CB. This should never happen PB developers always followed this discipline: 

  1. Disable the CB
  2. Perform the related CB processing code
  3. Then Re-enable the CB after all CB processing has completed

  For the DWO, the Disabling / Enabling code would be ...  <DW Control Name>.Modify ("<Buttonname>.Enabled=<Yes or No>")

HTH

Regards .. Chris

 

Comment
There are no comments made yet.
Gordon Weil Accepted Answer Pending Moderation
  1. Thursday, 13 June 2024 22:02 PM UTC
  2. PowerBuilder
  3. # 3

 

To clarify - If the user clicks ONCE, the app works correctly? Yes, except when a particular sequence of steps is involved in which case it consistently happens on the first click. The sequence of steps are ones that a user would likely execute, so this is a significant issue.

Have you tested to see if the same error occurs in another, different DataWindow Control? No. The problem doesn't happen after the second click. It happens sometime after the first click. Also, it also always happens on the first click after a particular sequence of steps, but I would need to send you an installation program so you have the entire program to execute the sequence of steps.

The only consistent thing I can say about it is that when I run the debugger, the crash happens after the clicked event exits and before any other debuggable code executes.

Does the app crash when running from the IDE, when compiled/deployed, or both? Both

Is the application running as 32-bit or as 64-bit? 64-bit

Does the user click twice in rapid succession (such as when double-clicking) or is there a pause between clicks? Have you tested to see if there is some threshold (delay) that permits the app to work without crashing? There is a pause between clicks.

Is the app built using a framework, such as the PFC or STD class libraries? We use an old version of the PFC

Is the DW Control a descendant inherited from an ancestor DW control? Yes.

Does the DataWindow Control (or any ancestor DWC) have code present in any of the following events?

  • Clicked (This is ancestor code. If I put a RETURN 0 statement in the descendant and turn off Extend Ancestor Script I get the same crashing behavior immediately after the clicked event)

//////////////////////////////////////////////////////////////////////////////
//    Event:            clicked
//    Description:        DataWindow clicked
//////////////////////////////////////////////////////////////////////////////
//    Rev. History        Version
//                        5.0        Initial version
//                         6.0     Added Linkage service notification
//                         6.0     Introduced non zero return value
//                         7.0        Do not bypass processing on linkage failure.  
//                         7.0        Linkage service should not fire events when querymode is enabled
//////////////////////////////////////////////////////////////////////////////
//    Copyright © 1996-2000 Sybase, Inc. and its subsidiaries.  All rights reserved.  Any distribution of the
// PowerBuilder Foundation Classes (PFC) source code by other than Sybase, Inc. and its subsidiaries is prohibited.
//////////////////////////////////////////////////////////////////////////////
integer li_rc
boolean lb_disablelinkage

// Check arguments
if IsNull(xpos) or IsNull(ypos) or IsNull(row) or IsNull(dwo) then return

// Is Querymode enabled?
if IsValid(inv_QueryMode) then lb_disablelinkage = inv_QueryMode.of_GetEnabled()

if not lb_disablelinkage then
    if IsValid (inv_Linkage) then
        if inv_Linkage.Event pfc_clicked ( xpos, ypos, row, dwo ) = &
            inv_Linkage.PREVENT_ACTION then
            // The user or a service action prevents from going to the clicked row.
            return 1
        end if
    end if
end if
    
if IsValid (inv_RowSelect) then inv_RowSelect.Event pfc_clicked ( xpos, ypos, row, dwo )

if IsValid (inv_Sort) then inv_Sort.Event pfc_clicked ( xpos, ypos, row, dwo ) 

  • DoubleClicked Yes, but no double-clicking is involved.
  • ButtonClicking No
  • LButtonDown (or a user event mapped to pbm_dwnlbuttondown)

//////////////////////////////////////////////////////////////////////////////
//    Event:            lbuttondown
//    Description:        Send lbuttondown notification to services
//////////////////////////////////////////////////////////////////////////////
//    Rev. History        Version
//                        5.0   Initial version
//////////////////////////////////////////////////////////////////////////////
//    Copyright © 1996-2000 Sybase, Inc. and its subsidiaries.  All rights reserved.  Any distribution of the
// PowerBuilder Foundation Classes (PFC) source code by other than Sybase, Inc. and its subsidiaries is prohibited.
//////////////////////////////////////////////////////////////////////////////
if IsValid (inv_RowSelect) then inv_RowSelect.event pfc_lbuttondown (flags, xpos, ypos)

  • LButtonUp (or a user event mapped to pbm_dwnlbuttonup).

//////////////////////////////////////////////////////////////////////////////
//    Event:            lbuttonup
//    Description:        Send lbuttonup notification to services
//////////////////////////////////////////////////////////////////////////////
//    Rev. History        Version
//                        5.0   Initial version
//////////////////////////////////////////////////////////////////////////////
//    Copyright © 1996-2000 Sybase, Inc. and its subsidiaries.  All rights reserved.  Any distribution of the
// PowerBuilder Foundation Classes (PFC) source code by other than Sybase, Inc. and its subsidiaries is prohibited.
//////////////////////////////////////////////////////////////////////////////
if IsValid (inv_RowSelect) then inv_RowSelect.event pfc_lbuttonup (flags, xpos, ypos)

Would you be able/willing to include the ButtonClicked event script?

iw_Parent.EVENT ue_LogEvent( THIS, "Event ButtonClicked")
// Open window to prompt for values file
of_LoadCustomValues( Row )

Best regards, John

Comment
  1. John Fauss
  2. Friday, 14 June 2024 02:21 AM UTC
Thanks for the info! I know that was a lot of questions to answer, but it helps me understand what things are or might be in play. I'm very familiar with the PFC (although we use a more current version), so I'd be a little surprised to learn that it is the culprit. I'd like you to try (separately, then if no luck, together) two things in the DW's ButtonClicked event:

1. Comment out the ue_LogEvent call. I'm guessing that is something local to your app or installation, and I'd like to rule it out as a possible cause.

2. Post the of_LoadCustomValues function call: Post of_LoadCustomValues(row) - Don't know what this function does or how it works, but sometimes a problem can be alleviated by altering the sequence in which the code executes.

HTH
  1. Helpful 1
  1. Gordon Weil
  2. Friday, 14 June 2024 15:17 PM UTC
I tried both of those before, and tried again today. I can still get the crash. I can remove all the code in the buttonclicked event and it will still crash in one of the two scenarios that cause the crash.



In the most reliable scenario for generating the program crash, one of the key steps is to tab to the button. The next step in the scenario causes the datawindow to lose focus while a dialogue box displays. Of the two scenarios that cause the crash, both require that the button has focus and both generate a losefocus event followed by a display of a MessageBox before a click on the button that is then followed by the crash.



Based on this observation I may have found a solution, which may work for us but still indicates a problem with PowerBuilder. If I check the results of GetColumn or GetColumnName in the getfocus event after the messagebox is displayed (see previous paragraph), GetColumn returns 0 and GetColumnName returns an empty string. This is what happens, apparently, when a datawindow button has focus. If I use SetColumn in the getfocus event to set to an available column whenever GetColumn returns 0, then the program does not crash when clicking the datawindow button in my most reliable scenario for generating the crash.



I need to turn this over to my testers to see if this fixes the issue in their setup, so it might be a few days before I can confirm that the issue is resolved for us.



It may be that not having a current column is poorly handled in one of the PowerBuilder DLLs. It might be possible to duplicate the issue in a much simpler application, but then again a number of things happen in our application in the GetFocus event and if one of those things contributes to the problem then a simpler example of the issue would not be easy to write.
  1. Helpful
There are no comments made yet.
John Fauss Accepted Answer Pending Moderation
  1. Thursday, 13 June 2024 21:20 PM UTC
  2. PowerBuilder
  3. # 4

Hi, Gordon -

Using PB 2022 R3 Build 3356 with the runtime set to Build 3289, I'm unable to replicate the issue as a test case with the information you've supplied.

Can you please list or post a snapshot of the General properties of the Button DWObject, such as what I've included below:

To clarify - If the user clicks ONCE, the app works correctly?

Have you tested to see if the same error occurs in another, different DataWindow Control?

Does the app crash when running from the IDE, when compiled/deployed, or both?

Is the application running as 32-bit or as 64-bit?

Does the user click twice in rapid succession (such as when double-clicking) or is there a pause between clicks? Have you tested to see if there is some threshold (delay) that permits the app to work without crashing?

Is the app built using a framework, such as the PFC or STD class libraries?

Is the DW Control a descendant inherited from an ancestor DW control?

Does the DataWindow Control (or any ancestor DWC) have code present in any of the following events?

  • Clicked
  • DoubleClicked
  • ButtonClicking
  • LButtonDown (or a user event mapped to pbm_dwnlbuttondown)
  • LButtonUp (or a user event mapped to pbm_dwnlbuttonup).

Would you be able/willing to include the ButtonClicked event script?

Best regards, John

Comment
There are no comments made yet.
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.
We use cookies which are necessary for the proper functioning of our websites. We also use cookies to analyze our traffic, improve your experience and provide social media features. If you continue to use this site, you consent to our use of cookies.