cancel
Showing results for 
Search instead for 
Did you mean: 

Dynamically resize DataWindow with Application Window

Former Member
0 Kudos

Hi,

I was just wondering if there was a way that I can set it so that my DataWindows and objects move and resize relative to the application window being resized.

For example I have the following which just has a few data windows and buttons on it.

But if the user resizes the application window, the DataWindows and buttons etc stay static in their fixed position, widths and heights.

Is there a way to make the buttons move and the DataWindows resize relative to the Application Window size?

thanks.

Accepted Solutions (0)

Answers (4)

Answers (4)

Former Member
0 Kudos

Have you thought about converting the app to WPF using PB.Net? The XAML features take care of the resizing for you.

Former Member
0 Kudos

I would suggest that you use the PFC resize service even if your application is not PFC based. You can just extract the related objects from the PFC and use them in your application. That would save you a lot of time.

Former Member
0 Kudos

If you use PFC, you should use the Resize service.

If not, just code the window resize event.

integer liMargin

liMargin = dw_1.x

// right datawindow stretch right and leave a margin

dw_2.width = newwidth - dw_2.x - liMargin

// right datawindow heighten but make room for buttons.

dw_2.height = newheight - dw_2.y - cb_1.height - liMargin * 2

dw_1.height = dw_2.height

// glue buttons to bottom

cb_1.y = newheight - cb_1.height - liMargin

cb_2.y = cb_1.y

....

Former Member
0 Kudos

Hi Lars,

I noticed everyone mention PFC. All I was able to find on this was a codeplex download. (the wiki was not overly helpful)

What is it? and are there any good getting started guides or how-tos for it? I did stumble across a PowerBuilder Foundation Class (PFC) Introductory site but it stated:

Sybase may still have documentation on the steps needed to create the PFC layer (the last known location was moved).

I have not heard of it before. Is it worth doing whatever I need to do in order to make my application use it?

I might start with the window resize event as suggested by you and Terry, then go from there.

Former Member
0 Kudos

The PFC is a tightly coupled service oriented framework that has accompanied PowerBuilder since version 5. It is a bit of work converting an existing application to use PFC. You might find that you application already has a framework ( Set of ancestor classes you always inherit from and which handles frame, sheets, reminders to save before you close, maybe logical unit of works etc.)

As Neil is suggesting, you could consider re-using some of the PFC resize service for you re-sizing.  In my mind, unless you have many windows with many objects it might be simpler to hand code each resize event. It depends on you proficiency too.

Former Member
0 Kudos

If you happen to have a copy of PB9, the documentation on the PFC was included in the online help file.

(have you looked here: PFC - Documentation ?)

Former Member
0 Kudos

Yes.  In the window resize event you can code that.


Something basic like:

dw_1.height = this.height * .9

cb_1 = dw_1.X + dw_1.height

etc.  the resize event has parameters newwidth, newheight

You can also use workspaceheight/width

Take a look at the PFC if you want to see some advanced resizing options.