1. TOMAZ KRALJ
  2. PowerBuilder
  3. Thursday, 17 February 2022 12:05 PM UTC

Hello ,

PB 2021.1288

I have window with two dw and 4 picture buttons .

What I would like to do is , that when DW is resized the picture button has to be moved at the same distance from dw as it was before it has to be always at leftdown corner of dw. Anyone has any advice how to do it?

 

Regards

Tomaz

Accepted Answer
John Fauss Accepted Answer Pending Moderation
  1. Monday, 21 February 2022 15:38 PM UTC
  2. PowerBuilder
  3. # Permalink

Try the splitbar's of_SetMinObjectSize method:

 

Comment
  1. John Fauss
  2. Monday, 21 February 2022 15:53 PM UTC
Here is a link to an earlier post on how you can obtain the PDF's for an older version of the PFC documentation:



https://community.appeon.com/index.php/qna/q-a/could-anyone-use-pfc-documentation



The PFC has obviously changed since these publications were created. Still, I find this info useful - and I hope you will, also.
  1. Helpful
There are no comments made yet.
John Fauss Accepted Answer Pending Moderation
  1. Thursday, 17 February 2022 14:16 PM UTC
  2. PowerBuilder
  3. # 1

Hi, Tomaz - 

There are a couple of recent PB examples in CodeXchange you may find helpful. The first is one I wrote that includes a stand-alone version of the PFC's Resize service:

https://community.appeon.com/index.php/codeexchange/powerbuilder/304-enumerations-some-handy-stand-alone-service-objects#385

Kevin Ridley gave a very nice session at Elevate 2020 on how to adapt the PFC's Resize service in non-PFC application, and he has also recently posted code on this topic:

https://www.appeon.com/conference/elevate-2020/live?id=242

https://community.appeon.com/index.php/codeexchange/powerbuilder/268-pfc-resize-without-pfc#390

There is also a PB Tech Article I wrote that explains how to code complex resizing scenarios using the PFC Resize service which you may find helpful:

https://community.appeon.com/index.php/articles-blogs/tutorials-articles/2-powerbuilder/315-the-pfc-resize-service-complex-resizing-via-a-simple-methodology

Good luck!
John

Comment
  1. TOMAZ KRALJ
  2. Friday, 18 February 2022 06:22 AM UTC
Hi John,

Thanks for your reply, I will look at all your links. I am using PFC and also resize service. I just didn't find solution how one object (button) position can follow other object (dw) position. I would like to change x position of button if x position of dw is changed.

Tomaz
  1. Helpful
There are no comments made yet.
Miguel Leeuwe Accepted Answer Pending Moderation
  1. Thursday, 17 February 2022 23:19 PM UTC
  2. PowerBuilder
  3. # 2

Hi Tomaz,

John has given some great advice, but ... Are you using the PFC classes?

If not, you can add the pbm_dwnresize event to your datawindow and reposition your buttons using relative positions to the newHeight and newWidth parameters of that dw control.

regards.

Comment
  1. TOMAZ KRALJ
  2. Friday, 18 February 2022 06:25 AM UTC
Hi Miguel,

Yes, I am using PFC. I just didn't find solution how one object (button) position can follow other object (dw) position. I would like to change x position of button if x position of dw is changed. I think this is nothing to do with resize service, or ?

Regards

Tomaz
  1. Helpful 1
  1. Miguel Leeuwe
  2. Friday, 18 February 2022 06:31 AM UTC
Hi,

IF you are resizing the dw control itself, I think you might be right in saying it has "nothing" to do with the resize service of the PFCs. The Pfc resize service works when you resize the WINDOW, so you'll have to put in some code into the resize event of your datawindows.
  1. Helpful
  1. Miguel Leeuwe
  2. Friday, 18 February 2022 06:37 AM UTC
What I'm not sure of, is whether the code in the resize event of the dw control, might clash somehow with any PFC (window) resizing functionality . When you resize a pfc WINDOW, that would ALSO trigger the resize event of the dw control.
  1. Helpful
There are no comments made yet.
Sivaprakash BKR Accepted Answer Pending Moderation
  1. Saturday, 19 February 2022 05:48 AM UTC
  2. PowerBuilder
  3. # 3

Hello,

Looks like you are using split_bar. 

1.  Then create a new event in that splitbar with pbm_lbuttonup as event id, given your own name for Event Name
2.  In that event Reposition the buttons to dw's X value ie button.x = dw_2.X 

HTH

Happiness Always
BKR Sivaprakash

 

Comment
There are no comments made yet.
Benjamin Gaesslein Accepted Answer Pending Moderation
  1. Monday, 21 February 2022 13:53 PM UTC
  2. PowerBuilder
  3. # 4

Hi Tomaz,

I assume the DWs are resized by registering them to a pfc splitbar? In this case, just register the buttons on the right using the RIGHT_ANCHORED style:

splitbar_name.of_register( button_name, splitbar_name.RIGHT_ANCHORED )

That should to the trick.

Comment
There are no comments made yet.
TOMAZ KRALJ Accepted Answer Pending Moderation
  1. Monday, 21 February 2022 14:47 PM UTC
  2. PowerBuilder
  3. # 5

Hi Benjamin,

yes your code did the trick.

here is my code now:

//////////////////////////////////////////////////////////////////////////////
//
// Event:
// pfc_preopen
//
// Arguments:
// None
//
// Returns:
// None
//
// Description:
// Register with the SplitBar and Resize service.
//
//////////////////////////////////////////////////////////////////////////////

// Register the controls with the Vertical SplitBar
of_SetResize(True)
this.inv_resize.of_SetOrigSize(this.width, this.height)


st_v.of_Register(dw_1, st_v.LEFT)
st_v.of_Register(dw_2, st_v.RIGHT)
st_v.of_Register(pb_izracun_dodaj, st_v.RIGHT_ANCHORED)
st_v.of_Register(pb_izracun_BRISI, st_v.RIGHT_ANCHORED)


inv_resize.of_Register(dw_1, 0, 0, 0, 100)
inv_resize.of_Register(st_v, 0, 0, 0, 100)
inv_resize.of_Register(dw_2, 0, 0, 100, 100)
inv_resize.of_register(pb_obracun_dodaj, inv_resize.FIXEDBOTTOM)
inv_resize.of_register(pb_obracun_brisi ,inv_resize.FIXEDBOTTOM)
inv_resize.of_register(pb_izracun_dodaj, inv_resize.FIXEDBOTTOM)
inv_resize.of_register(pb_izracun_BRISI ,inv_resize.FIXEDBOTTOM)

 

Now buttons follow datawindows and SplitBar :

Only one problem is still there:

If I move SplitBar  to much to left, right buttons goes over the buttons on left. Is it possible to limit SplitBar  how much to the left is possible to move?

Regards

Tomaz

 

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.