Object Oriented Question

Started by Jeffrey Ferreira, June 23, 2019, 07:19:06 PM

Previous topic - Next topic

Jeffrey Ferreira

Hello List,
i'm really new to oop.
I was trying to create an object using pxplus charts that would do something like the following:
and then i change properties to make a bar, line chart etc..then i can invoke the object from any panel presenting data....
the problem i am having is I want it to display in  a window...
i would like to equate to:

def object excel_obj="Excel.Application" and you have a visible excel that you can close....

the problem is when i draw a 'dialogue' and put my chart on it
if i close it i close my whole session....

i feel like once i get past this hurdle i can run with it....

Jeffrey Ferreira

i re-read my post...i should clarify...all the oop examples are like:


i'm wondering if associating a panel is a good idea or possible with oop



Stéphane Devouard


If you're using Nomads for your GUI development, about using the concurrent panels feature ?
Check out this section of the PxPlus Doc : https://manual.pvxplus.com/PXPLUS/NOMADS%20Graphical%20Application/Program%20Interaction/Concurrent%20Panels/Overview.htm

Hope this helps
Stéphane Devouard
Portfolio | Work

Jeffrey Ferreira

Hi Stephane,

Thanks for getting back to me. My only concern with that is that I think then all the controls / variables will be visible in new window.  I dont think that is a good idea or at least it violates the concept of encapsulation. I feel like a dummy because i read all these tutorials on OOP and it seems to work fine if you never want a user interface. But again it is probably the way I am implementing and I'm missing something very basic.


Mike King


If you are using PxPlus 2019 just use the *obj/chart object.  It will draw a chart on the screen, a Windows printer, PDF file, and can even generate HTML for the chart.

You can find the documentation at: https://manual.pvxplus.com/page/utilities/chart_object.htm which includes a few sample uses of the object.

Mike King
President - BBSysco Consulting
eMail: mike.king@bbsysco.com

Jeffrey Ferreira

Hi Mike,

Thank you I will look at it. However, I was trying to get my feet with OOP and I thought why not do it with something useful.
I guess what I was looking for was an answer to the question:

is OOP good to use for GUI user interfaces?
or just for doing calculations and storing data.

For instance i can see the usefulness of something like this
Customer.pvc object

print cust'ar_balance

but i cant see a good way to get it to work with a panel....

and the answer might be, "No Jeff you dont use OOP with panels."

thanks for you patience with me.


Stéphane Devouard


My answer to you was to resolve the issue you had when testing in a separate 'DIALOGUE'() and it closed all your windows when you closed the new one. Concurrent panels will take care of that.

Now, OOP is a completely different subject.

As a starter, if you want to get your feet wet with it, I would suggest creating classes as libraries of functions for your app and replace the existing calls and performs.

Then you will start using them to represent entities in your app (customers, vendors, invoices) with their data/properties (name, address, email) and their behaviours/methods (Add(), Edit(), Delete(), Purchase(), Sell(), etc...)

Stéphane Devouard
Portfolio | Work

Jeffrey Ferreira


i think i finally understand what you are saying and how it could work....
if i had program1 create instantiate an object...
and inside method of the object i use the concurrent window that would allow me to create a closeable window  and because it is inside the method it would not be visible to the program that isntantiated the object...
is that what you were saying?


Stéphane Devouard


Well, the problem is that to create a separate window, you must use some NOMADS reserved variables.
No problem with the %NOMAD_CONCURRENT_WDW global variable which is visible even inside an object (breaking the encapsulation OOP rule) but the other ones are "local", so if you set them inside an object's method, they won't be seen from the outside world. You could of course set the method as FUNCTION PERFORM so that it shares all its variables with the calling code, but that's also breaking the encapsulation rule, and if your intent is to learn OOP, it's not good to start by not honouring the base OOP concepts.

You could use the NOMADS object interface as explained there :
But that's not an easy way to start with OOP

So, referring to prior messages in this thread :

  • Use the *obj/chart class as suggested by Mike if what you want is experiment with "consuming" an object created by others
  • If you want to experiment with writing your own classes, rather start with something relatively simple, such as replacing some of the CALLed programs used in your app with methods/function from a utility class you build

Hope this helps,
Stéphane Devouard
Portfolio | Work