1. Adam Narten
  2. PowerBuilder
  3. Wednesday, 4 May 2022 14:57 PM UTC


We have a datawindow control in our application which includes code in the itemfocuschanged event to perform some additional processing when column data is changed in the datawindow. We have added some error checking at the beginning of the event as follows which is sometimes generating an error itself:

From pbm_dwnitemchangefocus --> itemfocuschanged (long row, dwobject dwo);

LONG lg_y, lg_pos, lg_x, lg_position
STRING st_ret
IF dwo.Type <> 'column' THEN RETURN


Error accessing external object property type at line 5 in itemfocuschanged event

My understanding of that error being on line 5 is that it cannot access property "Type" of object dwo but we are checking the validity/null state of the dwobject in the lines immediately above that. According to the PB Help "DWObject arguments for DataWindow events in PowerBuilder" we should be checking dwo.Type to ensure other properties are available for use later in the script, but how can the Type property not be available? 

Is there another method that would be more applicable here to achieve the same level of error checking or are we missing something else? 

We are using Powerbuilder 2017 R3 build 1915.

Thank you in advance. 

Accepted Answer
John Fauss Accepted Answer Pending Moderation
  1. Wednesday, 4 May 2022 15:31 PM UTC
  2. PowerBuilder
  3. # Permalink


Is there any code that manually triggers/posts the DW's ItemFocusChanged event? That might be the cause...

  1. Adam Narten
  2. Thursday, 5 May 2022 15:41 PM UTC
This might be onto something. There is one situation where we do manually dynamically post the itemfocuschanged event. This error is sporadic and has only come up at our client sites so I will experiment with this and come back with updates. Thank you!
  1. Helpful
There are no comments made yet.
Miguel Leeuwe Accepted Answer Pending Moderation
  1. Thursday, 5 May 2022 14:42 PM UTC
  2. PowerBuilder
  3. # 1


Can you access "dwo.name" ?


There are no comments made yet.
Sivaprakash BKR Accepted Answer Pending Moderation
  1. Thursday, 5 May 2022 07:47 AM UTC
  2. PowerBuilder
  3. # 2

1.  Do you assign DW object at runtime?
2.  Do you shift focus to that datawindow control from some other object?

May be that the object is not available (checking is done, I know), still itemfocuschanged event is called ?  
can you verify whether any object is available in that dw control, before this type checking?

Happiness Always
BKR Sivaprakash

  1. Adam Narten
  2. Thursday, 5 May 2022 15:43 PM UTC
Thanks for the tip, I will investigate this in conjunction with John's response. Typically the dwobject is assigned natively into the arguments of the event but I will check if the one situation where we post the itemfocuschanged event is incorrectly assigning the dwobject at runtime.
  1. Helpful
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.