Highlighted
Absent Member.
Absent Member.
1501 views

How does MF INVOKE interface with windows?

Jump to solution

Hi,

I'm using MF Dialog ListView control in windows 10 visual cobol 2.3.2. Through intelligent guesswork I've added: INVOKE my-listview-item-objref  "centered"  to the MF generated listview prog i.e. to centre a col rather than justify R/L. I'm enjoying getting to grips with objects and have some questions... 

1. Does MF invoke literally pass the message, "centered" to the object, or is some kind of translation going on?

2. Is there a list somewhere of other listview attributes I can change? And is this list somehow restricted/controlled by MF or do I have direct access to all aspects of the Window's objects? 

3. (Someone else asked this recently)... Is there a good summary somewhere of how windows objects work and how MF programmers can interact with them? My background is strong COBOL but not object oriented programming. I do though have some javascript experience. 

Many thanks,

Linden     

 

Linden Rowland - IT Consultant
Owner/Developer, www.SchoolReportWriter.com
IT Consultant to Tindle Newspaper Group

0 Likes
2 Solutions

Accepted Solutions
Highlighted
Micro Focus Expert
Micro Focus Expert

RE: How does MF INVOKE interface with windows?

Jump to solution

Hi Linden,

I would strongly recommend that for any new GUI development projects that you should NOT use Dialog System and the native OO Class Libraries.

We included Dialog System support in Visual COBOL for compatibility purposes for customers migrating from Net Express who had existing applications that used Dialog System.

We recommend that for any new GUI development work that you instead use managed code templates based on .NET technologies such as Windows Forms (WinForms) or Windows Presentation Foundation (WPF). These use standard class libraries provided by Microsoft as part of the .NET Framework.

The OO syntax in native COBOL is much harder to use and understand than is the equivalent in managed OO COBOL.

The GUI Class Libraries in native COBOL are actually written in COBOL so when you are invoking the ListView class you are invoking a method of a COBOL class and not Windows directly. In Net Express these classes were fully covered in the product documentation. In Visual COBOL they are not but we do provide the old Help files from Net Express in the folder C:\Program Files (x86)\Micro Focus\Visual COBOL\help. The name of the file containing this information is nxrclr.chm. The actual source code to the GUI class library can be found in C:\Program Files (x86)\Micro Focus\Visual COBOL\cpylib\guicl.

Again, I would highly recommend that you do not go down this road and instead take a look at the latest offerings in managed COBOL.

Thanks.

View solution in original post

0 Likes
Highlighted
Micro Focus Expert
Micro Focus Expert

RE: How does MF INVOKE interface with windows?

Jump to solution

TERM-FIELD is a pic x data-item and the setLabel property is expecting an object. Create a CharArray object from your string and then pass the object in and it should work.

View solution in original post

0 Likes
7 Replies
Highlighted
Micro Focus Expert
Micro Focus Expert

RE: How does MF INVOKE interface with windows?

Jump to solution

Hi Linden,

I would strongly recommend that for any new GUI development projects that you should NOT use Dialog System and the native OO Class Libraries.

We included Dialog System support in Visual COBOL for compatibility purposes for customers migrating from Net Express who had existing applications that used Dialog System.

We recommend that for any new GUI development work that you instead use managed code templates based on .NET technologies such as Windows Forms (WinForms) or Windows Presentation Foundation (WPF). These use standard class libraries provided by Microsoft as part of the .NET Framework.

The OO syntax in native COBOL is much harder to use and understand than is the equivalent in managed OO COBOL.

The GUI Class Libraries in native COBOL are actually written in COBOL so when you are invoking the ListView class you are invoking a method of a COBOL class and not Windows directly. In Net Express these classes were fully covered in the product documentation. In Visual COBOL they are not but we do provide the old Help files from Net Express in the folder C:\Program Files (x86)\Micro Focus\Visual COBOL\help. The name of the file containing this information is nxrclr.chm. The actual source code to the GUI class library can be found in C:\Program Files (x86)\Micro Focus\Visual COBOL\cpylib\guicl.

Again, I would highly recommend that you do not go down this road and instead take a look at the latest offerings in managed COBOL.

Thanks.

View solution in original post

0 Likes
Highlighted
Absent Member.
Absent Member.

RE: How does MF INVOKE interface with windows?

Jump to solution

Thank you Chris, that is so very helpful.

I appreciate what you are saying and if I could easily migrate from Dialog I very gladly would but I'm on a big project with tight deadline. I am moving more and more control to callouts though so that migrating will be easier at some point. Alas though we still have a lot of logic in the native dialog code itself.

A QUICK QUESTION .... meanwhile I'm trying to use listviews and have pretty much got to grips with i it but I can't see in the MF help nxrclr.chm,  'instance methods' list, a way to change the value of a column header? How can I do that?  

Linden Rowland - IT Consultant
Owner/Developer, www.SchoolReportWriter.com
IT Consultant to Tindle Newspaper Group

0 Likes
Highlighted
Micro Focus Expert
Micro Focus Expert

RE: How does MF INVOKE interface with windows?

Jump to solution

I understand your dilemma.

The column header is added in the AddColumn method. In the example program this occurs in Add-List-Header section.when statement:

   EVALUATE Call-Function

       WHEN "ADD-HEADER"  

            PERFORM Add-List-Header

is executed

The code in this paragraph will return a ListViewHeaderItem object which is actually used to set the Header text. Look in the same docs for ListViewHederItem to see what methods it supports.

0 Likes
Highlighted
Absent Member.
Absent Member.

RE: How does MF INVOKE interface with windows?

Jump to solution

thanks, in my haste i missed the separate pages for listview / item / header.

HOWEVER... in a quick " SetLabel" method test, I get error "240 obj ref not valid lsthdr" using code below. The justification code works so the obj ref is fine. The Term-field parameter is the one used in the original code above to set the col header in the first place so should also be fine.

            evaluate LVdats2-ITEM-ALIGN(k)

              when "R"

                  INVOKE LVdats2-item-objref(k) "rightJustified"

              when "C"

                  INVOKE LVdats2-item-objref(k) "centered"

              when other    

                  INVOKE LVdats2-item-objref(k) "leftJustified"

            end-evaluate

            invoke LVdats2-item-objref(k) "SetLabel" using Term-Field

Linden Rowland - IT Consultant
Owner/Developer, www.SchoolReportWriter.com
IT Consultant to Tindle Newspaper Group

0 Likes
Highlighted
Micro Focus Expert
Micro Focus Expert

RE: How does MF INVOKE interface with windows?

Jump to solution

TERM-FIELD is a pic x data-item and the setLabel property is expecting an object. Create a CharArray object from your string and then pass the object in and it should work.

View solution in original post

0 Likes
Highlighted
Absent Member.
Absent Member.

RE: How does MF INVOKE interface with windows?

Jump to solution

Thanks Chris, that sorted it.

Linden Rowland - IT Consultant
Owner/Developer, www.SchoolReportWriter.com
IT Consultant to Tindle Newspaper Group

0 Likes
Highlighted
Absent Member.
Absent Member.

RE: How does MF INVOKE interface with windows?

Jump to solution

Hi again Chris,

With a view to doing more outside of dialog... is it possible to get the object reference of dialog window elements (buttons, text boxes etc)? I would like to use the AbstractWindow class disable/enable methods and move all that logic into programs?

Thanks,

Linden

Linden Rowland - IT Consultant
Owner/Developer, www.SchoolReportWriter.com
IT Consultant to Tindle Newspaper Group

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.