Symptom

If you assign the handle of an object (for example a window) to an array whose datatype is any, the result is incorrect: you always get 0.

Environment

PowerBuilder

Reproducing the Issue

  1. Create an external DataWindow object with a column of type long
  2. Assign this object to a DataWindow controldw_1
  3. Code the following script in the Open event of the DataWindow control

    any la_array[]
    la_array[1] = Handle(this)

    dw_1.InsertRow(0)
    dw_1.SetItem(1, 1, la_array[1])

    dw_1.InsertRow(0)
    dw_1.SetItem(2, 1, Handle(this))
     

You will see that values of each row are different !!
For your convenience, seeattached example

Resolution

As a workaround, you can cast the any array to a Long as follows: la_array[1] = Long(Handle(this))
 

Attachment
pb.zip8.38 KB
0
0