1. Ruth Brown
  2. PowerBuilder
  3. Monday, 22 May 2023 15:42 PM UTC

Not my code, hired to maintain it (and fairly new to PB).  Please see attachment.

Attachments (1)
Chris Pollach @Appeon Accepted Answer Pending Moderation
  1. Monday, 22 May 2023 15:59 PM UTC
  2. PowerBuilder
  3. # 1

Hi Ruth;

  Nice class diagram. Looks very straightforward to me to use & maintain.

   Do you have a specific question(s) about this?

Regards ... Chris 

Comment
  1. Ruth Brown
  2. Tuesday, 23 May 2023 14:44 PM UTC
Thank you very much John and Andreas! I need to review the code and digest your responses further.

If an object says it inherits from "DataWindow-UserControl" does that mean it is a DWC?

Vice an object that inherits from "DataWindow" being a DW.

FYI I am using 2017.
  1. Helpful
  1. John Fauss
  2. Tuesday, 23 May 2023 15:19 PM UTC
It is unfortunate and regrettable that the term "DataWindow" was used for both the control and the data object. It can be SO confusing!

A DataWindow Data Object is not an object class (I know, even though the word "object" is in its name), so it cannot be inherited. Inheritance applies ONLY to DWC's. The class name of the base DWC from which all DWC's are instantiated and/or inherited is simply "datawindow", but it is a DataWindow Control.
  1. Helpful 1
  1. Roland Smith
  2. Tuesday, 23 May 2023 20:38 PM UTC
DWC = DataWindow Control. DW = DataWindow Object. The DWC has a property DataObject which is the name of the DataWindow Object assigned to it. Andreas analogy about the web browser is great. The DWC is like a WebBrowser control and the DW assigned to it is like a web page.



A DWC can be placed directly on the window or a separate DWC object can be created and placed on the window. That allows for common code to exist in only one object.
  1. Helpful 1
There are no comments made yet.
John Fauss Accepted Answer Pending Moderation
  1. Tuesday, 23 May 2023 02:38 AM UTC
  2. PowerBuilder
  3. # 2

Hi, Ruth - 

Welcome to PowerBuilder (PB) and to the Appeon Community!

I know it can be confusing at first, but as you've seen, there are two separate, but related entities that are informally called "DataWindows". I'll try to explain them...

The DataWindow Control (often referred to in the Q&A forum as DWC) is a visual object that is placed in Windows and in custom visual user objects (visual containers), like a command button or tab control. It has properties and methods (both functions and events).

There is also the DataWindow Data Object, often informally called simply a DataWindow or DW. It consists of a data source (typically, a SQL result set) and a visual presentation of the data provided by the data source. The presentation can be in one of many styles, such as tabular, grid, graph, free-format, n-up (newspaper-line columns), labels, treeview, rich text, etc. The object named "d_update_tabs" is a DataWindow Data Object. As you've observed, the DW Data Object does not support methods. It does contain all of the visual presentation information, including row sorting and data grouping definitions. It also contains the rules by which changes to the data is recorded in a database via Insert, Update and Delete SQL statements. DataWindow Data Objects are created and modified via the DataWindow Painter (designer).

Both the DWC and the DW are unique to PB, and they work together to provide the developer an extremely flexible and powerful data presentation and manipulation interface. A DWC is associated with a DW via the DWC's "dataobject" property, which names the DW Data Object the control is to use.

In a typical, simple data-entry scenario, a DW is assigned to a DWC either in the Window "painter" or in code. A PB Transaction object (a non-visual object that provides a connection to a database) is assigned to a DWC via the SetTransObject function in code. The DWC's Retrieve function is called to retrieve data from the database and the information is presented visually to the user via the rules contained in the DW Data Object. When the user makes changes to the data, mechanisms within the DWC keep track. When the DWC's Update function is called, SQL Insert/Update/Delete statements are automatically created and issued to the database using the update rules contained in the DW Data Object.

Of course, there is a lot more to the DWC and DW, but I hope this peels back a little of the "weirdness" and mystery. DataWindows may seem "weird" only because they are different.

The Q&A forum in the Appeon Community is here to help you, so I'm glad you found us. We have many experienced developers who volunteer their time and expertise to assist others as their availability permits. We're not consultants and this is not a Support Portal, but we'll try to help you the best we can.

Good luck and best regards, John

Comment
There are no comments made yet.
Andreas Mykonios Accepted Answer Pending Moderation
  1. Tuesday, 23 May 2023 07:09 AM UTC
  2. PowerBuilder
  3. # 3

Hi.

John's answer is great. Hope you read it.

I always compare a datawindow control with webbrowser control. Webbrowser control is a host control that will receive some html / css / javascript and will have to render some content. Then it will have to process some user actions - events and do some other tasks like send a request to some server (example when the user clicks on a link).

Datawindow control is also a host control. What it will show during runtime may be defined when placing the control to a window or a userobject, using its dataibject property, or may be defined during runtime. Dataobject (or datawindow syntax) is "attached - hosted" to datawindow control and defines what should be rendered to the control when a retrieve is issued or a row is inserted (these are some of its basic functions).

Datawindow has it's non visual "brother": datastore. Datastore is the non visual control to use when you need to process some data in memory. Both objects have similar functions.

While this may seem complex at the beginning, you will soon find that it is a very powerful model. It gives you the possibility to set and modify the "content" to render in a datawindow or datastore. You can use many styles for the presentation and you can easily issue insert, update and delete commands to the database without having to write those statements. You can share data between a datastore and a datawindow or even between two controls containing dataobjects with the same sql command but a different style. You can export or import data. You can have external datawindows that are not based to a select statement... And many other.

Dataobject that is assigned to a datawindow or datastore control contains the syntax that the control should use to design the presentation of the data and in some specific cases may also contain data (this can be useful when working with external datawindows).

Finally, the syntax (dataobject to be hosted) can be created or modified at runtime. Generated syntax can be saved to a file or to a library (pbl) to be reused.

As I said all those may sound complex. You need to exercise and you will see that the basic concept isn't so hard to understand.

Andreas.

Comment
  1. John Fauss
  2. Tuesday, 23 May 2023 14:38 PM UTC
That's a very nice conceptual analogy, Andreas! Thanks for sharing your insights.
  1. Helpful
There are no comments made yet.
Ruth Brown Accepted Answer Pending Moderation
  1. Tuesday, 23 May 2023 18:32 PM UTC
  2. PowerBuilder
  3. # 4

Thanks so much!  I have attached an updated diagram; please see the inheritance for u_tab_update.  I am still confused, is it a DW, DWC, or User Object?

Attachments (1)
Comment
  1. Benjamin Gaesslein
  2. Thursday, 25 May 2023 06:40 AM UTC
This will show you the exact inheritance chain for the object in question.
  1. Helpful 1
  1. Ruth Brown
  2. Thursday, 25 May 2023 13:26 PM UTC
I figured out what it does; the tree in the browser updates to show the direct parent and the siblings. I thought you meant it would show all of the ancestors, which it doesn't display. I already knew the direct parent from the designer. This is a nice tip though, to see all the direct children of each parent. Thank you!
  1. Helpful
  1. Benjamin Gaesslein
  2. Friday, 26 May 2023 05:42 AM UTC
It does show all of the ancestors, up to the first one that was derived from one of the built-in standard types.
  1. Helpful 1
There are no comments made yet.
Andreas Mykonios Accepted Answer Pending Moderation
  1. Wednesday, 24 May 2023 12:01 PM UTC
  2. PowerBuilder
  3. # 5

Hi Ruth.
A screenshot of the specific window would be more helpful, as you are asking us to tell you if your diagram is correct. But simply based on your notes?

Based on object names I would guess that you have:

  • A window of type child [wa_child].
  • A window that inherits from wa_child [w_update_tabs].
  • I guess that in this window you do have a tabcontrol. Maybe then you have tabpage… But this isn’t clear to me at this point as you mention that u_tab_update is inheriting from datawindow control, in your diagram… But I have a feeling (because of u_tab prefix) that u_tab_update is a tab control.
  • You then have a datawindow control [dw_update]. If u_tab_update is a tab control, then probably dw_update control inherits from standard datawindow control and I guess is placed on some tabpage.

Now, as I said a screenshot would help as at least to distinguish what controls are used in w_update_tabs.
As your question focuses on the parent of u_tab_update there are ways to find the parent. You can edit it in source mode just to see the parent. To edit in source mode you only need to close the window(s) using that control, then locate in your pbl the control, right click on it and press “Edit Source”. Normally an editor will show up with some content like:

forward
global type u_tab_update from <…here is the parent…>

If you prefer to check it using the designer, you can find that information when editing the control in properties window:

In my example pfc_u_dw inherits from datawindow which is a standard visual control in powerbuilder.

Standard visual controls are:

  • Animation
  • Checkbox
  • Commandbutton
  • Datawindow
  • Datepicker
  • Dropdownlistbox
  • Dropdownpicturelistbox
  • Editask
  • Graph
  • Groupbox
  • Hprogressbar
  • Hscrollbar
  • Htrackbar
  • Inkedit
  • Inkpicture
  • Listbox
  • Listview
  • Monthcalendar
  • Multilineedit
  • Olecontrol
  • Picture
  • Picturebutton
  • Picturehyperlink
  • Picturelistbox
  • Radiobutton
  • Ribbonbar
  • Richtextedit
  • Singlelineedit
  • Statichyperlink
  • Statictext
  • Tab
  • Treeview
  • Vprogressbar
  • Vscrollbar
  • Vtrackbar
  • Webbrowser

Whenever in a visual control you see that it inherits from one of the objects listed above, it means that you inherit from a standard control. If you see something different then it means that your control inherits from a control where there are “custom levels” of inheritance.

Also you have window control, userobject control and tabpage control.
I won’t talk about window as it is pretty common.
Userobject is a standard control that can be used like a container of other controls. At the end you’ll need to place it or open it in a window (or open it as a tabpage). This is very useful. Tabpage control is actually some sort of userobject control that can be designed – customized directly to a tab control.

Be aware that except of visual control, we do have also non visual controls. They also can be inherited. The main difference between visual and non visual controls is that non visual controls do not have (and don't need) a designer when edited.

Andreas.

Comment
  1. Benjamin Gaesslein
  2. Thursday, 25 May 2023 06:47 AM UTC
Wait, the file is called "u_tab_update" but in the source it says "global type u_tab_maf_update from datawindow"? The name in source should not deviate from the name of the file. While it is possible to change the name in source this will definitely be problematic.
  1. Helpful
  1. Andreas Mykonios
  2. Thursday, 25 May 2023 07:14 AM UTC
I will insist... Can you give as a screenshot of that specific window? I'm not asking the source code... Even with that screenshot it's not sure we can make correct assumptions, but in may help.

As Benjamin mentions for u_tab_update it should begin as:



forward

global type u_tab_update from <...some object from which it inherits...>

end type



The information you give is confusing at this point. And we cannot say if your diagram is correct without having a clue of what is used on your window...

Andreas.
  1. Helpful
  1. Ruth Brown
  2. Thursday, 25 May 2023 19:55 PM UTC
See my response at bottom, for screenshot. Thank you so much for sticking with me!
  1. Helpful
There are no comments made yet.
Ruth Brown Accepted Answer Pending Moderation
  1. Thursday, 25 May 2023 19:52 PM UTC
  2. PowerBuilder
  3. # 6

Comment
There are no comments made yet.
Ruth Brown Accepted Answer Pending Moderation
  1. Thursday, 25 May 2023 19:53 PM UTC
  2. PowerBuilder
  3. # 7

Trying to provide screenshot:

Comment
  1. Andreas Mykonios
  2. Friday, 26 May 2023 05:59 AM UTC
This is clearly a datawindow. I don't know what it's name begins with u_tab... (You made lot of effort to hide part of the name which was already mentioned).

Andreas.
  1. Helpful
  1. Arnd Schmidt
  2. Friday, 26 May 2023 08:22 AM UTC
And is still visible in the "ControlList" ;-)
  1. Helpful
  1. Ruth Brown
  2. Friday, 26 May 2023 21:31 PM UTC
<Facepalm!>
  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.