0
votes

Hy Good Day!

Can any one tell me that why below code is not closing the window on pressing close button named as b_1? Am trying my code in Button Clicked Event...

Code Below:

dwo.Name = 'b_1'

String          ls_Object

ls_Object = String(dwo.name)
If ls_Object = "b_1" Then
    Close(Parent)
End If

Also please provide me with any good tutorials for power builder development specially for reports and data windows

Thanks

2

2 Answers

2
votes

Walid Ahmed, good day.
I would suggest the following:
1. Place the button outside the detail band of the datawindow, it doesn't tend to always work there correctly. The header, summary or footer bands would be OK.
2. Make sure your script is in the buttonclicked event.
3. To round up Matt's comment, if the datawindow is directly on the window then Close(Parent) but if it is on another control, such as a user object or a tabpage, you need to close a reference to that window:
(I recommend defining an instance variable:
window iw_win
and set it to the window in it's open event:

iw_win = this

and use it in the datawindow's buttonclicked event:

Close(iw_win)

)

0
votes

If your button is on the main form (the window) you simply need to use Close(Parent).

If your button is on a datawindow control you need to trigger the method on the Parent (window) of the datawindow (the form the datawindow is placed on).