1. DIPANJAN DUTTA
  2. PowerBuilder
  3. Tuesday, 28 August 2018 08:43 AM UTC

Hello All,

I am opening u_dw [pfemain.pbl object] user object dynamically on a window using OpenUserObject function.

Object is opening fine and working properly

My question is that I was unable to track the parent object on Clicked Event of u_dw. Its return null when I was using following syntax

  • This.Parent / dwo.Parent
  • This.GetParent() / dwo.GetParent()

I would appreciate all your advice on this issue.

Ronnie Po Accepted Answer Pending Moderation
  1. Tuesday, 28 August 2018 15:50 PM UTC
  2. PowerBuilder
  3. # 1

u_dw is a "standard visual" object inherited from datawindow, so you should place it on your window or userobject at design time using the menu option

Insert > Control > User Object...

Normally, you would not open u_dw using OpenUserObject(), which is usually used for "custom visual" objects (such as u_base).

 

Comment
  1. DIPANJAN DUTTA
  2. Tuesday, 28 August 2018 17:17 PM UTC
Hi Ronnie,



Thanks for you sharing.......I agree with U.....on that case it should not allow to open u_dw using OpenUserObject()........but Powerbuilder allow to do that and unexpectedly return NULL when U r trying to get Parent object.
  1. Helpful
There are no comments made yet.
Roland Smith Accepted Answer Pending Moderation
  1. Tuesday, 28 August 2018 15:07 PM UTC
  2. PowerBuilder
  3. # 2

I don't know. I just tried with a button object and it worked as expected. This isn't PFC, just a simple one window app.

Code in the button object:

Window lw_parent

lw_parent = this.GetParent()

If IsNull(lw_parent) Then
    MessageBox("GetParent", "Null")
Else
    MessageBox("GetParent", lw_parent.title)
End If

Code in the window open event:

OpenUserObject(u_cbparent, 10, 10)

 

So you added a GetParent() to u_dw and it returns null?

Comment
  1. DIPANJAN DUTTA
  2. Tuesday, 28 August 2018 17:18 PM UTC
Thanks Smith, It will helpful for me
  1. Helpful
There are no comments made yet.
DIPANJAN DUTTA Accepted Answer Pending Moderation
  1. Tuesday, 28 August 2018 14:29 PM UTC
  2. PowerBuilder
  3. # 3

Thanks Smith,

Your suggestion is helpful.

But my question is, if the user object open as a control in window (using OpenUserObject), why I am not getting Parent object?

Comment
  1. Chris Pollach @Appeon
  2. Tuesday, 28 August 2018 16:18 PM UTC
Hi Dipanjan;

It's an old "leftover" issue from way back in the old PowerSoft / Sybase days when the OpenUserObject () method was first implemented and they didn't finish (polish) the implementation 100%.

The same thing happens in the OpenTabPage() method as well. One way around both parentage problems is to use the SetParent() MS-Windows SDK call to establish the proper parentage (which PB should really do for you). The other way of course is to use the GetParent() or "withparm" approach to get around this limitation.

Please feel free though to open a free support ticket on this issue so that it gets on the Appeon engineering teams "ToDo" list for a proper fix.

Regards ... Chris
  1. Helpful
  1. DIPANJAN DUTTA
  2. Tuesday, 28 August 2018 17:20 PM UTC
Thanks for your sharing Chris......
  1. Helpful
There are no comments made yet.
Roland Smith Accepted Answer Pending Moderation
  1. Tuesday, 28 August 2018 13:07 PM UTC
  2. PowerBuilder
  3. # 4

You could use OpenUserObjectWithParm and pass the parent window. Then in the object constructor event, save a reference to it in and instance variable like this:

iw_parent = Message.PowerObjectParm

 

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.