1. Sivaprakash BKR
  2. PowerBuilder
  3. Tuesday, 6 December 2022 06:17 AM UTC

Hello,

PB 2022 build 1892, NO PFC, using Kevin Ridley's Resize services

1.  Resizing of objects inside a window, works fine.  Even DW's inside tab's are resized.
2.  Now placing a splitbar [ u_st_splitbar from PFC ] in between upper DW and below Tabpage.

3.  When I move the splitbar, I want all objects to resize perfectly.   Here tabpage gets resized, but not dw control inside the tab.   

I want that also to be resized.   Any suggestions?

Happiness Always
BKR Sivaprakash

 

Sivaprakash BKR Accepted Answer Pending Moderation
  1. Saturday, 17 December 2022 05:59 AM UTC
  2. PowerBuilder
  3. # 1

Sorry for the delay in my reply.  I was totally preoccupied and got free only today.   

Thanks Andreas, Kevin and John.   Both code (Ardreas & John) works in our initial test.  Seems both code follows a similar approach, to have a user(object)tab.    

Thanks Again.

Happiness Always
BKR Sivaprakash

 

Comment
There are no comments made yet.
John Fauss Accepted Answer Pending Moderation
  1. Saturday, 10 December 2022 03:51 AM UTC
  2. PowerBuilder
  3. # 2

Attached is an example program that addresses the problem raised by Sivaprakash. It implements the steps outlined by Kevin Ridley. The example app does NOT use the PowerBuilder Foundation Class, but it does contain some objects based on similar objects in the PFC.

I already had an example program named "enumerations" that contained a non-PFC Resize service, so I adapted this app to include a splitter bar object and constructed a new window that illustrates one way to solve the problem.

Attachments (1)
Comment
There are no comments made yet.
Andreas Mykonios Accepted Answer Pending Moderation
  1. Thursday, 8 December 2022 13:37 PM UTC
  2. PowerBuilder
  3. # 3

@Kevin Ridley.

Don't know why you say it won't work.

Take a look to the attached code.

PS: I had to add splitbar from pfc, as I didn't had splitbar object.

Andreas.

Attachments (1)
Comment
  1. Kevin Ridley
  2. Thursday, 8 December 2022 21:31 PM UTC
Andreas, it works because you did exactly what I said to do - register with the splitbar.of_register. What I was saying wouldn't work is having a tabpage resize service since the tabpage never actually resizes. This does exactly what I said below. In the lbuttonup event of the splitbar it resizes the objects registerd with the SPLITBAR. Good work. I was trying to teach the OP to fish instead of giving him a basket of fish, lol. Should be just what he needs.
  1. Helpful
There are no comments made yet.
Andreas Mykonios Accepted Answer Pending Moderation
  1. Thursday, 8 December 2022 11:11 AM UTC
  2. PowerBuilder
  3. # 4

Another thing you may try to do is to create a reference for the object inside your tabpages to the window.

Example:

// You have tab_1.tabpage_1.dw_1

// In Window instance variables.

datawindow idw_tabpg_1_dw_1

// In window's post open event (because you must be sure that objects are created:

idw_tabpg_dw_1 = tab_1.tabpage_1.dw_1
// Now you must be able to register your control in both window's resize and splitbar.

Haven't tried to see if it will work. Anyway, you should not try to make it work in a tabpage where CreateOnDemand option is active. And if it seems to work it, you need to test it deep.

Even if this works, I believe that this solution isn't so clean and I do not advise it. I do prefer usercontrols where resize service is inside the control.

Andreas.

Comment
  1. Andreas Mykonios
  2. Thursday, 8 December 2022 11:24 AM UTC
Sorry.

Forget that answer. It won't work while window's size won't change!!!
  1. Helpful
There are no comments made yet.
Andreas Mykonios Accepted Answer Pending Moderation
  1. Thursday, 8 December 2022 08:56 AM UTC
  2. PowerBuilder
  3. # 5

Hi.

This is how we implement this.

We do add userobject as tabpages. Our user object can use resize service (u_tabpg). Usually it's from pfc (but this can also work with Kevin's isolated service). We then set our tab_x.tabpage_x constructor event to register controls it contains as needed.

We don't register controls to the window!

As controls are registered in uo, and resize service knows what to do, they will resize whatever is the reason of user object size change. Even if this happens beacause of splitbar usage.

I attach some sample code to show how we implement it. In my sample there is no splitbar. You can do this check yourself. But it should work. In my pfc based projects it does work.

I included Kevin's resize object in this sample code.

I also have a window (which doesn't inherit from a base window). It has of_set_resize function declared on it (Kevin's version). Normally there should be a base window.

In this window I added a tab control.

I have a user object named uo_custom_tab. I added to it: a) in instance variables: n_resize_service inv_resize, b) resize event with appropriate code, c) of_set_resize to enable the service.

In my tab control I insert a tab page using Insert User Object... I use my uo_custom_tab.

On the window, I put the resize logic for each tabpage to the tab_x.tabpage_x constructor event, as previously mentioned.

The main disadvantage of this logic is that I cannot modify my tabpage appearance directly from the window. But I generally prefer that because my windows are lighter in the IDE, and I can always edit my tabpage from the control.

Of course to use this model the best thing to do is to have:

a) a base window (the one Kevin provided is fine)

b) a base userobject (from this one we can inherit to create our tabpages).

Why I do always prefer working with user objects? That way if I remove a tabpage from a control, the tabpage is still there as a user object! If you want for example to move a tabpage from a tab control to another one, this way you can easy achieve your objective (while copy paste would also work). Another thing is that you can easily do a change that will affect all your tabpages (by modifying an ancestor). Finally you can have userobject functions in tabpages...

Andreas.

Attachments (1)
Comment
  1. Kevin Ridley
  2. Thursday, 8 December 2022 12:49 PM UTC
That would work if the tabpage was resizing, but in this case it's not. The tabpage stays the same size when the splitbar moves. I'll add more to my response below.
  1. Helpful
There are no comments made yet.
Kevin Ridley Accepted Answer Pending Moderation
  1. Wednesday, 7 December 2022 18:42 PM UTC
  2. PowerBuilder
  3. # 6

The reason it's not working with the splitbar is it wasn't designed for that.  You are using the WINDOWS resize service, so all the objects you registered only resize when the window resizes.  Moving the splitbar doesn't resize the window at all, so nothing that you registered will resize.  You're going to have to write custom code based on the position of the splitbar, I'm guessing the lbuttonup event.  I haven't done any of this with the splitbar yet but seems like where to start.  For fun, I checked out the u_st_splitbar object and it *DOES* have an of_register function for this purpose.  So if you don't want to "roll your own", try experimenting with that of_register of the splitbar.  Good luck and let us know what you come up with, I'm curious.

 

Kevin

Comment
  1. Kevin Ridley
  2. Thursday, 8 December 2022 13:34 PM UTC
@Sivaprakash - it's important to understand what the services do. I provided a WINDOWS resize service and a DW resize service. The windows resize service resizes objects registered with it only when the window resizes. The window's resize event kicks off the service (it might be a good idea to put a stop in the window's resize event and step through the code to get a better understanding of what happens). Same thing for the dw resize service, when the dw's resize event fires, the service resizes registered objects inside the dw. In your scenario, you are only moving the scrollbar, so the window is *NOT* resizing, so the window's resize event never fires and the service never gets called. Whatever you do needs to be based on the lbuttonup event. The u_st_splitbar.of_register does exactly this, based on the lbuttonup event. I'd suggest using this.



I'm also a bit confused. In your original post, you say it's not a pfc app, but u_st_splitbar *IS* a pfc object. Isn't it located in pfemain.pbl? Or did you pull u_st_splitbar out of the pfc and modify it to work outside the pfc? Anyway, it looks like you should be fine with the of_register, but you'll have to code it (or hire me, lol).
  1. Helpful
  1. Andreas Mykonios
  2. Thursday, 8 December 2022 13:42 PM UTC
@Kevin.

It is easy to isolate u_st_splitbar. I did it in my previous answer and I guess Sivaprakash did the same...

As I say while answering to you, I tried the code, and it works. Try it also and if I'm wrong let me know...

Anyway, your work on isolating resize service is great.

Andreas.
  1. Helpful
  1. Kevin Ridley
  2. Thursday, 8 December 2022 14:38 PM UTC
I agree, and thank you.
  1. Helpful
There are no comments made yet.
John Fauss Accepted Answer Pending Moderation
  1. Wednesday, 7 December 2022 02:47 AM UTC
  2. PowerBuilder
  3. # 7

* * * Update * * *
The information that follows is incorrect, and I apologize for posting this misleading information. Please disregard.

Kevin Ridley's response in a later post outlines how to solve this issue. I will post a new response that contains an example program that illustrates a working solution constructed using the information Kevin posted.
* * * End of Update * * *

Andreas and Miguel are on the right track. Our PFC-based application has a window using a horizontal splitter bar and a tab control below the splitter, and it resizes in the manner you are requesting.

When registering the window's controls with the Resize service, you have to register each of the tabpage objects within the tab control in addition to the tab control and the controls within each tabpage.

Here is an example:

// The DW above the splitter bar.
This.inv_resize.of_Register(dw_above_splitter,"ScaleToRight")

// The horizontal splitter bar.
This.inv_resize.of_Register(hsp_splitter,"ScaleToRight")

// The tab control below the splitter bar.
This.inv_resize.of_Register(tab_1,"ScaleToRight&Bottom")

// The first tabpage and the DW on the first tabpage.
This.inv_resize.of_Register(tab_1.tabpage_1,"ScaleToRight&Bottom")
This.inv_resize.of_Register(tab_1.tabpage_1.dw_1,"ScaleToRight&Bottom")

// The second tabpage and the DW on the second tabpage.
This.inv_resize.of_Register(tab_1.tabpage_2,"ScaleToRight&Bottom")
This.inv_resize.of_Register(tab_1.tabpage_2.dw_2,"ScaleToRight&Bottom")

By registering the "container" tab page objects with the resize service, the contents of each tabpage respond to any resizing of the registered tab control and its tabpages.

This works with standard/default tabpages that do not contain any resize logic. Even though our app is PFC-based, we do not use the u_tabpg object or any custom tabpage user objects.

HTH, John

Comment
  1. Andreas Mykonios
  2. Thursday, 8 December 2022 09:32 AM UTC
These sound normal, as your window size hasn't changed...

Andreas.
  1. Helpful 1
  1. Kevin Ridley
  2. Thursday, 8 December 2022 14:40 PM UTC
@John - I agree with Andreas. In this case, the window and the tabpage haven't resized, so the service would never get triggered. The tabpage remains the same size, he's just dragging the splitbar around.
  1. Helpful
  1. Andreas Mykonios
  2. Thursday, 8 December 2022 18:06 PM UTC
On the other hand, the example I posted works for me. But I use a custom user object which as I state has a resize event...

Andreas.
  1. Helpful
There are no comments made yet.
Miguel Leeuwe Accepted Answer Pending Moderation
  1. Tuesday, 6 December 2022 23:15 PM UTC
  2. PowerBuilder
  3. # 8

Hi,

In our PFC based application we use some splitbars.

This is an example of the code in my Vertical (not horizontal) splitbar.
You have to somehow indicate the relation that objects have to the position of your splitbar:

// constructor event of my v-splitbar:

// Register The objects which belong to the Split Screen Bar
this.of_register( st_results, this.LEFT )
this.of_register( dw_results, this.LEFT )
this.of_register( dw_basic_search, this.RIGHT )
this.of_register( dw_ext_search, this.RIGHT )
this.of_register( uo_basic, this.left_anchored)
this.of_register( uo_extended, this.left_anchored  )
this.of_register( st_ext, this.RIGHT )
this.of_register( dw_standardlist, this.LEFT )

In other words, I don't know if there's anything similar in the code that you are using, but if not, checkout what the PFC's do.

HIH,

MiguelL

Comment
  1. Sivaprakash BKR
  2. Wednesday, 7 December 2022 02:54 AM UTC
Thanks MigueIL

That's what I've done. I could only indicate Top (dw) and Bottom (Tab) to Splitbar and NOT dw(s) inside Tab / Tabpage. I checked with PFC, so far I couldn't find anything with splitbar. May be it might be there in u_tab, u_tabpg... I'vent checked that.
  1. Helpful
  1. Miguel Leeuwe
  2. Wednesday, 7 December 2022 09:08 AM UTC
Yes, the of_register() of the h-split object itself, is only to tell what objects above and below do when moving the split.

The objects inside any of these objects, have to be registered with the inv_resize service. (like John says in his latest answer).
  1. Helpful 1
There are no comments made yet.
Chris Pollach @Appeon Accepted Answer Pending Moderation
  1. Tuesday, 6 December 2022 20:34 PM UTC
  2. PowerBuilder
  3. # 9

 Hi BK;

  Since you  contacted me directly about using the STD Framework last week. I just wanted to point out that the framework supplies you with a user resize event in the case of Tab Pages and CVUOs (Custom Visual User Objects). For example ...

Tabpage:

CVUO:

  I solved the "complex problem of resizing over 20 years ago by adding the Resize events that were missing from certain object types. The problem you are trying to address with the PFC_Resize is that you have nested levels of Parent=>Child objects. For example, you can have ...

Window => Tab Control => Tab Page => CVUO => TC => TP ... etc and then at the end your two DataWindow Controls & a Split Bar. The challenge with the PFC_Resize is that you need to register all the "nested" controls starting at the Window level. In the above scenario, that becomes not only a daunting coding exercise but the PFC_Resize execution can become unhinged.

  To solve this (as neither PB or the PFC account for this deficiency) - almost 20+ years ago in the STD framework, I added the missing resize events and then configured the potential parent(s) of these controls to pass down their respective resize values. Thus in the above example, the only resize logic you need is on the "oe_resize" event of the Tab Page that owns the two DC's and the split bar (3 objects in total). At this granular level, the resize logic is trivial and all the necessary values are handed to you in the "oe_resize" event.

   If you continue on with my design logic, resizing is greatly simplified. In fact since I wrote the initial framework starting in 1993, I have had only 3 people have ask me about something like a PFC_Resize NVUO. Personally with this low level granularity and scrollbars (my persona; favourite)  - I usually can't even imagine why you need something like a PFC_Resize. Just my $0.02. Food for thought.

Regards ... Chris

PS: I have no idea why PowerSoft, Sybase or SAP never added the missing resize events to all PB System Class visual objects (controls).

Comment
  1. Sivaprakash BKR
  2. Wednesday, 7 December 2022 02:38 AM UTC
Thanks Chris,

Yes, we are still going through the phase of understanding STD-FC. With our understanding STD-FC, so far,

1. Our programmers are (little bit) hesitating to suffix a window with _e [ English]. Don't know whether we can avoid that.

2. We couldn't find vs_splitbar_master or its equivalent in STD-FC so far.

3. It's taking more time to understand how menu has been used in STD-FC.

  1. Helpful
  1. Chris Pollach @Appeon
  2. Wednesday, 7 December 2022 03:09 AM UTC
Hi BK;

1) Since the Framework is multilingual, the language identifier is required. The App user though can bypass this prompt as your App can set the language identifier in the Application Controller as a fixed setting.

2) I don't have a slit bar object as 99% of the PB developers normally just use a line object for that with drag & drop turned on.

3) Understandable, as with any framework.

Regards ... Chris
  1. Helpful
There are no comments made yet.
Andreas Mykonios Accepted Answer Pending Moderation
  1. Tuesday, 6 December 2022 14:34 PM UTC
  2. PowerBuilder
  3. # 10

The following is based on screenshots you provided.

I see that the datawindow size in first tab is affected (a little). Is this tab_1.tabpage_1.dw_3 or tab_1.tabpage_2.dw_4? Or you datawindow gets hidden from tabpage?

In pfc I wouldn't register the datawindow to the window's resize service but to the tabpage resize service...

I guess the "isolated" service can be used that way but haven't tried.

Andreas.

Comment
  1. Sivaprakash BKR
  2. Tuesday, 6 December 2022 15:48 PM UTC
Andreas

What I attached (image) is not maximized to full. If maximised, the gap is more.
  1. Helpful
  1. Sivaprakash BKR
  2. Tuesday, 6 December 2022 15:50 PM UTC
Also issue is not in resize. Resizing happens perfectly. Only when I move the splitbar, this issue (gap) is there in dw inside tabpage.



I can understand that those dws are not registered with splitbar. I couldn't find such an option in splitbar.

  1. Helpful
  1. Andreas Mykonios
  2. Tuesday, 6 December 2022 15:58 PM UTC
You have to relate datawindow size with tabpage's size. Not with splitbar. That's my opinion.
  1. Helpful
There are no comments made yet.
Andreas Mykonios Accepted Answer Pending Moderation
  1. Tuesday, 6 December 2022 12:29 PM UTC
  2. PowerBuilder
  3. # 11

Hi.

Tell us how do you register the datawindow to the resize service.

Andreas.

Comment
  1. Sivaprakash BKR
  2. Tuesday, 6 December 2022 13:53 PM UTC
Thanks Andreas. Here is my registration code

inv_resize.of_register(st_status, inv_resize.FixedRight)

inv_resize.of_register(st_title, inv_resize.ScaleRight)

inv_resize.of_register(st_version_border, inv_resize.FIXEDRIGHTBOTTOM)

inv_resize.of_register(st_version, inv_resize.FIXEDRIGHTBOTTOM)

inv_resize.of_register(st_message_border, inv_resize.FIXEDBOTTOM_SCALERIGHT)

inv_resize.of_register(st_message, inv_resize.FIXEDBOTTOM_SCALERIGHT)

inv_resize.of_register(st_computer_border, inv_resize.FIXEDBOTTOM)

inv_resize.of_register(st_computer, inv_resize.FIXEDBOTTOM)

inv_resize.of_register(st_user_border, inv_resize.FIXEDBOTTOM)

inv_resize.of_register(st_user, inv_resize.FIXEDBOTTOM)



inv_resize.of_register(dw_entry, 0, 0, 100, 50)

inv_resize.of_register(tab_1, 0, 50, 100, 50)

inv_resize.of_register(st_split_tab, 0, 50, 100, 0)



inv_resize.of_register(st_find, 70, 0, 0, 0)

inv_resize.of_register(sle_find, 70, 0, 30, 0)

inv_resize.of_register(dw_list, 70, 0, 30, 100)



inv_resize.of_register(cb_1, inv_resize.fixedright)

inv_resize.of_register(cb_2, inv_resize.fixedright)

inv_resize.of_register(cb_3, inv_resize.fixedright)

inv_resize.of_register(cb_4, inv_resize.fixedright)

inv_resize.of_register(cb_find, inv_resize.fixedright)



inv_resize.of_register(tab_1.tabpage_1.dw_3, 0, 0, 100, 50)

inv_resize.of_register(tab_1.tabpage_2.dw_4, 0, 0, 100, 35)



st_split_tab.of_register(dw_entry, st_split_tab.ABOVE)

st_split_tab.of_register(tab_1, st_split_tab.BELOW)



  1. Helpful
There are no comments made yet.
John Fauss Accepted Answer Pending Moderation
  1. Tuesday, 6 December 2022 06:48 AM UTC
  2. PowerBuilder
  3. # 12

Hi, Sivaprakash -

If I understand what you are asking for, you are wanting to have the contents (the DWObjects within the upper DataWindow control's data object resize in response to the resizing of the DataWindow control?

If that is correct, to accomplish that you need to use the DW Resize "service" (that Kevin also adapted from the PFC), which he presented in his Elevate 2022 session recently. If you have not yet seen his latest session, I recommend you do so. All of the Elevate 2022 sessions are available for replay.

Here is a link to all of the session replays:

   https://www.appeon.com/conference/elevate-2022/session-catalog.html

Kevin's session is listed near the end of the list of sessions.

Best regards, John

Comment
  1. Sivaprakash BKR
  2. Tuesday, 6 December 2022 08:29 AM UTC
Thanks John,

NO. I want the Datawindow control, in every tabpage of tab, to get resized when splitbar is moved.

You can see the gap between the DW control in the tabpage with the 'User' displayed in the status bar at bottom, after splitbar has been moved.
  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.