1. Clarence Chamorro
  2. PowerBuilder
  3. Wednesday, 3 January 2024 22:51 PM UTC

I'm using PB 2022 R2 Build 2828. I upgraded the PFC version correlate with PB 2022.

So I have a window with the inv_resize active. Everything is working perfect. The dw are resizing perfect the columns are resizing (construction event register every column with the correct %) Every is working perfect. We have 4 different data presentations, means we change the datawindow object  thru a clicked event of a radio button.

Radio button clicked event:

//==================================

dw_7.dataobject = 'd_bid_product_list_group_1_data'

//CCH OPENING A CHANELL BETWEN DATABASE AND DATAWINDOW
dw_7.SetTransObject(sqlca)


inv_resize.of_UnRegister(tab_1.tabpage_2.tab_2.tabpage_12.dw_7)

dw_7.of_setresize(false)

inv_resize.of_Register(tab_1.tabpage_2.tab_2.tabpage_12.dw_7,0,0,100,70)

dw_7.triggerevent('constructor')

dw_7.retrieve(tab_1.tabpage_1.dw_1.OBJECT.bid_project_code[1])
IF dw_21.dataobject = 'd_bid_product_component_list_view_sumary' THEN
dw_21.retrieve(tab_1.tabpage_1.dw_1.OBJECT.bid_project_code[1],0)
ELSE
dw_21.retrieve(tab_1.tabpage_1.dw_1.OBJECT.bid_project_code[1],gstr_gen.compcode,0)
END IF

dw_7.TriggerEvent('resize')

//======================================

My issue is if I change the datawindow object with the window's size bigger than normal the columns do not resize according the size of the window, datawindow. The actual datawindow risizes with no issue but the columns do not.

Here the construction event of the datawindow. Depending which dataobject is I register the columns accordingly:

//==============================================================

//CCH OPENING A CHANELL BETWEN DATABASE AND DATAWINDOW
this.SetTransObject(sqlca)

// Start the Row Manager Service.
of_SetRowManager(true)

// Start the Row Selection Service.
of_SetRowSelect(true)

// Set the Row Selection Service to allow multiple
// record selection.
inv_rowselect.of_SetStyle(inv_rowselect.Extended)

//ACTIVATE THE SORT SERVICE FOR THE DATA WINDOW
OF_SETSORT(True)
THIS.INV_SORT.OF_SETSTYLE(1)
THIS.INV_SORT.OF_SETCOLUMNHEADER(TRUE)

//CCH DEACTIVATE THE RIGHT MOUSE BUTTOM PFC FUNCTIONALITY
ib_RMBmenu = FALSE

//CCH TELLING PROCESSING THIS DW IS NOT UPDATEABLE
//this.of_SetUpdateable(FALSE)


//CCH TURN ON RESIZE SERVICE
of_SetResize(true)


IF this.dataobject = 'd_bid_product_list_group_1_data' THEN //cch presentation product type
//// Args - PercentageX, PercentageY, PercentageWidth, PercentageHeight

inv_resize.of_Register('tbl_bid_products_line_number_t', 0, 0, 5, 0)
inv_resize.of_Register('tbl_bid_products_line_number', 0, 0, 5, 0)

inv_resize.of_Register('key1_t',5, 0,5, 0)
inv_resize.of_Register('key1', 5, 0, 5, 0)

inv_resize.of_register( 'c_bid_number',10,0,20,0)
inv_resize.of_Register('c_prod_name_t',10,0, 20, 0)
inv_resize.of_register("c_product_type",10,0,20,0)
inv_resize.of_Register('c_prod_name', 10, 0, 20, 0)


inv_resize.of_Register('tbl_bid_products_bid_prod_size_t',30,0,15, 0)
inv_resize.of_Register('tbl_bid_products_bid_prod_size', 30, 0, 15, 0)

inv_resize.of_Register('unit_mesur_t',45,0, 5, 0)
inv_resize.of_Register('unit_mesur', 45, 0, 5, 0)

inv_resize.of_Register('revise_qty_t',50,0, 5, 0)
inv_resize.of_Register('revise_qty', 50, 0, 5, 0)
inv_resize.of_register('c_revise_qty_sum',50,0,5,0)

inv_resize.of_Register('contract_qty_t',55,0, 5, 0)
inv_resize.of_Register('contract_qty', 55, 0, 5, 0)
inv_resize.of_register('c_contractqty_sum',55,0,5,0)

inv_resize.of_Register('ourcost_t',60,0, 5, 0)
inv_resize.of_Register('ourcost', 60, 0,5, 0)

inv_resize.of_Register('total_cost_per_unit_t',65,0, 10, 0)
inv_resize.of_Register('total_cost_per_unit', 65, 0, 10, 0)
inv_resize.of_register('c_total_cost_perunit_by_prodtype',65,0,10,0)
inv_resize.of_register('grand_total_cost',65,0,10,0)

inv_resize.of_Register('contract_price_t',75,0, 10, 0)
inv_resize.of_Register('contract_price', 75, 0, 10, 0)

inv_resize.of_Register('total_contract_price_t',85,0, 10, 0)
inv_resize.of_Register('total_contract_price', 85, 0, 10, 0)
inv_resize.of_register('c_total_per_productype_contractprice',85 ,0, 10, 0)
inv_resize.of_Register('grand_total_contract_price', 85, 0, 10, 0)

inv_resize.of_Register('tbl_bid_products_has_component_y_n',95,0, 5, 0)


ELSEIF this.dataobject = 'd_bid_product_list' THEN //cch presentation regular

//// Args - PercentageX, PercentageY, PercentageWidth, PercentageHeight
//
inv_resize.of_Register('tbl_bid_products_line_number_t', 0, 0, 5, 0)
inv_resize.of_Register('tbl_bid_products_line_number', 0, 0, 5, 0)

inv_resize.of_Register('key1_t',5, 0,5, 0)
inv_resize.of_Register('key1', 5, 0, 5, 0)

inv_resize.of_register( 'c_bid_number',10,0,20,0)
inv_resize.of_Register('c_prod_name_t',10,0, 20, 0)
inv_resize.of_Register('c_prod_name', 10, 0, 20, 0)

inv_resize.of_Register('tbl_bid_products_bid_prod_size_t',30,0,15, 0)
inv_resize.of_Register('tbl_bid_products_bid_prod_size', 30, 0, 15, 0)

inv_resize.of_Register('unit_mesur_t',45,0, 5, 0)
inv_resize.of_Register('unit_mesur', 45, 0, 5, 0)

inv_resize.of_Register('revise_qty_t',50,0, 5, 0)
inv_resize.of_Register('revise_qty', 50, 0, 5, 0)

inv_resize.of_Register('contract_qty_t',55,0, 5, 0)
inv_resize.of_Register('contract_qty', 55, 0, 5, 0)

inv_resize.of_Register('ourcost_t',60,0, 5, 0)
inv_resize.of_Register('ourcost', 60, 0,5, 0)

inv_resize.of_Register('total_cost_per_unit_t',65,0, 10, 0)
inv_resize.of_Register('total_cost_per_unit', 65, 0, 10, 0)
inv_resize.of_register('grand_total_cost',65,0,10,0)

inv_resize.of_Register('contract_price_t',75,0, 10, 0)
inv_resize.of_Register('contract_price', 75, 0, 10, 0)

inv_resize.of_Register('total_contract_price_t',85,0, 10, 0)
inv_resize.of_Register('total_contract_price', 85, 0, 10, 0)
inv_resize.of_Register('grand_total_contract_price', 85, 0, 10, 0)

inv_resize.of_Register('tbl_bid_products_has_component_y_n',95,0, 5, 0)


ELSEIF this.dataobject = 'd_bid_product_list_group_1_data_phase_order1' THEN
//// Args - PercentageX, PercentageY, PercentageWidth, PercentageHeight
//
inv_resize.of_Register('tbl_bid_products_line_number_t', 0, 0, 5, 0)
inv_resize.of_Register('tbl_bid_products_line_number', 0, 0, 5, 0)

inv_resize.of_Register('key1_t',5, 0,5, 0)
inv_resize.of_Register('key1', 5, 0, 5, 0)

inv_resize.of_register( 'c_bid_number',10,0,20,0)
inv_resize.of_Register('c_prod_name_t',10,0, 20, 0)
inv_resize.of_register('c_phase',10,0,20,0)
inv_resize.of_Register('c_prod_name', 10, 0, 20, 0)

inv_resize.of_Register('tbl_bid_products_bid_prod_size_t',30,0,15, 0)
inv_resize.of_register("c_product_type",30,0,15,0)
inv_resize.of_Register('tbl_bid_products_bid_prod_size', 30, 0, 15, 0)

inv_resize.of_Register('unit_mesur_t',45,0,10, 0)
inv_resize.of_Register('unit_mesur', 45, 0, 10, 0)

// inv_resize.of_Register('revise_qty_t',50,0, 5, 0)
// inv_resize.of_Register('revise_qty', 50, 0, 5, 0)
// inv_resize.of_register('c_revise_qty_sum',50,0,5,0)

inv_resize.of_Register('contract_qty_t',55,0, 5, 0)
inv_resize.of_Register('contract_qty', 55, 0, 5, 0)
inv_resize.of_register('c_contractqty_sum',55,0,5,0)

inv_resize.of_Register('ourcost_t',60,0, 5, 0)
inv_resize.of_Register('ourcost', 60, 0,5, 0)

inv_resize.of_Register('total_cost_per_unit_t',65,0, 10, 0)
inv_resize.of_Register('total_cost_per_unit', 65, 0, 10, 0)
inv_resize.of_register('c_subtotal_cost_byproductype',65,0,10,0)
inv_resize.of_register('c_total_cost_perunit_by_phase',65,0,10,0)
inv_resize.of_register('grand_total_cost',65,0,10,0)

inv_resize.of_Register('contract_price_t',75,0, 10, 0)
inv_resize.of_Register('contract_price', 75, 0, 10, 0)

inv_resize.of_Register('total_contract_price_t',85,0, 10, 0)
inv_resize.of_Register('total_contract_price', 85, 0, 10, 0)
inv_resize.of_register('c_subtotal_contractprice_byproductype',85,0,10,0)
inv_resize.of_register('c_total_per_phase_contractprice',85,0,10,0)
inv_resize.of_Register('grand_total_contract_price', 85, 0, 10, 0)

inv_resize.of_Register('tbl_bid_products_has_component_y_n',95,0, 5, 0)

ELSEIF this.dataobject = 'd_bid_product_list_group_1_paid_item' THEN
//// Args - PercentageX, PercentageY, PercentageWidth, PercentageHeight
//
inv_resize.of_Register('tbl_bid_products_line_number_t', 0, 0, 5, 0)
inv_resize.of_Register('tbl_bid_products_line_number', 0, 0, 5, 0)

inv_resize.of_Register('key1_t',5, 0,5, 0)
inv_resize.of_Register('key1', 5, 0, 5, 0)

inv_resize.of_register( 'c_bid_number',10,0,20,0)
inv_resize.of_Register('c_prod_name_t',10,0, 20, 0)
inv_resize.of_register('c_paiditem',10,0,20,0)
inv_resize.of_Register('c_prod_name', 10, 0, 20, 0)

inv_resize.of_Register('tbl_bid_products_bid_prod_size_t',30,0,15, 0)
inv_resize.of_Register('tbl_bid_products_bid_prod_size', 30, 0, 15, 0)

inv_resize.of_Register('unit_mesur_t',45,0, 5, 0)
inv_resize.of_Register('unit_mesur', 45, 0, 5, 0)

inv_resize.of_Register('revise_qty_t',50,0, 5, 0)
inv_resize.of_Register('revise_qty', 50, 0, 5, 0)


inv_resize.of_Register('contract_qty_t',55,0, 5, 0)
inv_resize.of_Register('contract_qty', 55, 0, 5, 0)


inv_resize.of_Register('ourcost_t',60,0, 5, 0)
inv_resize.of_Register('ourcost', 60, 0,5, 0)

inv_resize.of_Register('total_cost_per_unit_t',65,0, 10, 0)
inv_resize.of_Register('total_cost_per_unit', 65, 0, 10, 0)
inv_resize.of_register('c_total_cost_perunit_by_paiditem',65,0,10,0)
inv_resize.of_register('grand_total_cost',65,0,10,0)

inv_resize.of_Register('contract_price_t',75,0, 10, 0)
inv_resize.of_Register('contract_price', 75, 0, 10, 0)

inv_resize.of_Register('total_contract_price_t',85,0, 10, 0)
inv_resize.of_Register('total_contract_price', 85, 0, 10, 0)
inv_resize.of_register('c_total_per_payitem_contractprice',85,0,10,0)
inv_resize.of_Register('grand_total_contract_price', 85, 0, 10, 0)

inv_resize.of_Register('tbl_bid_products_has_component_y_n',95,0, 5, 0)

END IF

//==========================================================

I think I am missing something in my code. Any advise will be greatly appreciated.  

 

Regards,

 

Clarence.

Ronnie Po Accepted Answer Pending Moderation
  1. Thursday, 4 January 2024 19:47 PM UTC
  2. PowerBuilder
  3. # 1

Hi Clarence,

In the constructor event of dw_7, just after calling of_setResize(TRUE), try the following.

For freeform style:

inv_resize.of_setOrigSize(<rightmost control>.x + <rightmost control>.width, <bottommost control>.y + <bottommost control>.height)

For grid or tabular style:

inv_resize.of_setOrigSize(<rightmost control>.x + <rightmost control>.width, this.height)

Example:

inv_resize.of_setOrigSize(long(this.object.tbl_bid_products_has_component_y_n.x) + long(this.object.tbl_bid_products_has_component_y_n.width), this.height)

 

You probably want to pad the first argument value (width) with a little extra room for a vertical scrollbar.

Comment
  1. Clarence Chamorro
  2. Friday, 5 January 2024 17:13 PM UTC
Dr. Po. you were completely correct. I added one like of code (my x,y coordinates were zero both so my values were my width and height) and everything is working as intended. Very much appreciate for your genius responds.



Thanks.



Clarence
  1. Helpful
  1. Ronnie Po
  2. Friday, 5 January 2024 18:18 PM UTC
You're welcome! I'm glad everything is working.



By the way, I had forgotten about the PFC functions of_getWidth() and of_getHeight(). I would recommend the following as a more general solution:



inv_resize.of_setOrigSize(inv_resize.of_getWidth(), inv_resize.of_getHeight())

  1. Helpful
There are no comments made yet.
John Fauss Accepted Answer Pending Moderation
  1. Thursday, 4 January 2024 02:15 AM UTC
  2. PowerBuilder
  3. # 2

Hi, Clarence -

I think what you are missing is a conceptual understanding of how the DW Resize Service is designed to work. It does not do what you are asking it to.

When DWObjects are of_Register'd with the service, their position and size is recorded internally in the service, along with the size of the DataWindow control when the DW Control is first resized. As the size of the DW Control changes, the DW Resize Service analyzes the changes to the width and height and compares the current values to the original width and height. From these values and the resizing "rules" specified in the various of_Register method calls, the service calculates a new position and size for every registered DWObject.

If you swap out the original data object in the DW control with another, the internal list of DWObjects, their initial sizes and positions are no longer valid.

Even if you use inv_resize.of_UnRegister() to un-register all of the DWObjects before swapping the data objects, and subsequently register the DWObjects that reside in the "new" data object, the DW control is probably no longer at it's original size, so I expect the resizing functionality will "start over", so to speak... the resize service will NOT mimic the resizing actions that occurred earlier. I surmise this is the behavior you are experiencing.

I'm unsure what the overall purpose or goal of doing this resizing of DWObjects, but given the way the resize service is designed, I think the only alternative you have available is to use four overlapping DataWindow controls, one for each data object... one visible and three hidden, and use the DW Resize Service in each one. Instead of swapping the data objects in a single DW control, change which one of the four overlapping DW controls is visible. Admittedly, not elegant, but it should work.

Best regards, John

 

Comment
  1. Chris Pollach @Appeon
  2. Thursday, 4 January 2024 16:43 PM UTC
Hi Clarence;

Based on what John says about the PFC resizes behaviour / implementation - I would also suggest trying to implement the DW Control via its User Object. That way you can use the OpenUserObject() / CloseUserObject() command to reinstate a "Fresh" instantiation of the DW Control when swapping DWO's within the control. Food for thought. ;-)

HTH

Regards ... Chris
  1. Helpful
  1. John Fauss
  2. Thursday, 4 January 2024 18:52 PM UTC
@Chris - That's an intriguing idea!

@Clarence - If you have not done so already, look at the of_SetOrigSize(width,height) method of the DW Resize Service object. It MAY be possible to "reset" the resize logic after swapping the data object and registering a new set of DWObjects. I've not attempted this, so I cannot say with any certainty that it will work, but you might wish to try it.
  1. Helpful
  1. Clarence Chamorro
  2. Friday, 5 January 2024 17:22 PM UTC
Dr. Po was completely correct. I added one like of code (my x,y coordinates were zero both so my values were my width and height) and everything is working perfect.

Because I did not register the original size of the dw; pfc_resize did not know any changes on the size of the dw and so did not go thru the loop of all the object. Now it does know the original size and knows there is a change in size and goes thru the loop with the columns and resize everything correct.



Thank you again Dr.Po you are a genius.



Regards,



Clarence
  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.
We use cookies which are necessary for the proper functioning of our websites. We also use cookies to analyze our traffic, improve your experience and provide social media features. If you continue to use this site, you consent to our use of cookies.