1. Paweł Kasperek
  2. PowerBuilder
  3. Tuesday, 24 October 2023 12:48 PM UTC

Hi,

 

How can I open an userobject in the center of the parent window without calculation? 

I fave the following code:

int li_ret

li_ret = this.OpenUserObjectWithParm(n_cst_myuserobject, "param1")

If li_ret = 1 then

End If

 where the "this" is a window.

I could open "n_cst_myuserobject" in the center of the window.

 

Rergards,

Pawel

 

 

Andreas Mykonios Accepted Answer Pending Moderation
  1. Tuesday, 24 October 2023 13:03 PM UTC
  2. PowerBuilder
  3. # 1

Hi.

You cannot. You have to calculate x, y and add them to your OpenUserObjectWithParm command:

int li_ret
int li_x, li_y

// calculate li_x, li_y

li_ret = this.OpenUserObjectWithParm(n_cst_myuserobject, "param1", li_x, li_y)

But you also need to know your userobject's width and height to do the calculations. These can be found like this:

int li_ret
int li_x, li_y
integer li_width, li_height
n_cst_myuserobject luo_cst_myuserobject

luo_cst_myuserobject = create n_cst_myuserobject

li_width = luo_cst_myuserobject.width
li_height = luo_cst_myuserobject.height

if isvalid(luo_cst_myuserobject) then destroy luo_cst_myuserobject

// calculate li_x, li_y

li_ret = this.OpenUserObjectWithParm(n_cst_myuserobject, "param1", li_x, li_y)

By the way, as your userobject is visible and not non visual, it's name should start with u_ (u_cst_myuserobject).

Comment
  1. Andreas Mykonios
  2. Wednesday, 25 October 2023 06:16 AM UTC
Yes. This is another way.
  1. Helpful
  1. Paweł Kasperek
  2. Wednesday, 25 October 2023 09:41 AM UTC
Thank you for answer. Currently, I calculated the position of my user object instance. I thought that there was another solution.
  1. Helpful
  1. Andreas Mykonios
  2. Wednesday, 25 October 2023 09:47 AM UTC
Only window have a center option (property). You can always place your userobject to a child window and open that child window with center property checked. But this may require a lot of changes to your existing code.

Andreas.
  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.