I am attempting to update a legacy PB desktop application that was NOT built with the PFC so that it will resize when maximized. I retrofitted the PFC resize functions into the ancestor windows and datawindows of my application. It seems to work fine until I get to resizing the information on the datawindows. It will resize the columns to fit the larger datawindow horizontally, but not vertically. I tried calling it with "scale" and "scalerightbottom" but neither worked. Any suggestions?
In addition to my response below, I forgot to mention that I have this in the resize event of the window ancestor.
IF this.Resizable and IsValid(inv_resize) THEN
inv_resize.event pfc_resize(sizetype, newwidth, newheight)
It does fire every time the window resizes, but doesn't resize anything. I followed all of this through the debugger and it runs all the code but does not resize correctly (seems to be sending in the wrong height and width) until I call it manually with a button.
- John Fauss
- Wednesday, 15 January 2020 19:30 PM UTC
My datawindows are based on u_dw. I have retrofitted the pfc code into the application and in the resize event of u_dw I have this:
IF IsValid(inv_dwresize) THEN
inv_dwresize.event pfc_resize(sizetype, newwidth, newheight)
This compiles, and fires when the window is resized, but doesn't resize anything. If I call the exact same code manually with a button, it does resize everything.
I put the following in the retrieveend event of u_dw, because I didn't know where else to do this. If you have any other ideas, please let me know. It does register the objects just fine, because it resizes all of them when I call it manually with the button.
string szObjects, szObject, szType
szObjects = this.Describe("datawindow.objects")
szObject = f_get_token(szObjects,"~t")
DO WHILE szObject <> '' // Register each object for resizing
szType = UPPER(this.describe(szObject + ".type"))
CHOOSE CASE szType
CASE "TEXT","GROUPBOX","COMPUTE","COLUMN","BUTTON","RECTANGLE", "PICTURE", "BITMAP"
szObject = f_get_token(szObjects,"~t")
I'm glad to help, Libby.
There needs to be different "resizing" logic in two places: 1) The window, and 2) the DataWindow Control (DWC). The PFC implements this functionality via two non-visual objects: pfc_n_cst_resize/n_cst_resize for the windows and pfc_n_cst_dwsrv_resize/n_cst_dwsrv_resize for the DWC's.
The Resize event in the window fires in response to the user dragging the window border or clicking the Min/Max buttons. There needs to be code/logic in this event to manage the position and size of the various controls within the window that are to be affected by resizing, such as a DWC.
When the DWC gets resized by the code in the window's resize event. then the DWC's Resize event fires, so this is where the code that manipulates the DWObjects within the DWC needs to reside or be called from.
Both pieces are needed to implement the functionality you are wanting.
John and Olan,
Thank you so much. That was the problem. Once I set the detail band to be autosize height, everything worked fine. BUT, I have another problem. I can get everything to resize if I put a resize button on the datawindow that resizes the window and then the datawindow, but if I rely on it to resize automatically when I maximize it, it doesn't work. It does call the resize event on both the window and the datawindow but nothing happens until I then click the button which has the window and datawindow resize code duplicated in it. It's almost like the height and width are not reset until the maximizing is done, but which time the resize has already been called. Any thoughts?
I've never used the DataWindow Resize service in the PFC before, but I tested it using the PFC libraries for PB 2017 and using PB 2017R2. The service works, but it works differently than how you probably are expecting, so I presume this is why you are asking about this issue.
The resizing logic resides in the of_resize function of the pfc_n_cst_dwsrv object in the pfcdwsrv.pbl. It dynamically creates and executes DW Modify expressions that adjust the X,Y position, Width and Height properties of the registered DWObjects based on the resizing method requested when each DWObject is registered with the service.
It does NOT adjust the height of any band or the font height used in any DWObject. You can verify/test this by enlarging the height of say, the detail band and using a "box" border for the DWObjects in the detail band and register these objects using the SCALERIGHTBOTTOM resize method.
If you were expecting/hoping to also accomplish band and font height resizing, you'll have to either develop the logic yourself or ask the community if anyone has coded this functionality before and if so, is allowed to share their code with you.
- Olan Knight
- Wednesday, 15 January 2020 01:10 AM UTC
Also please be aware that the PFC Resize service is rather limited, and that complex objects will befuddle the service. In many cases, especially with complex objects, you will need to code the resize event on the object itself, either extending the "of_resize()" function or coding to or adding to the Resize event of the object.
Hi, Libby -
What version of the PFC did you use to pull the resize functionality from? What PB version is your application using?
- Page :
However, you are not allowed to reply to this question.