Welcome Serena Central users! CLICK HERE
The migration of the Serena Central community is currently underway. Be sure to read THIS MESSAGE to get your new login set up to access your account.
YassirMabrouk Absent Member.
Absent Member.
379 views

AmortControl: Dot net controls wiped out after resizing the window

Hello everyone,

After experimenting with the AmortControl sample, i enabled the window to be resizable. When i resize the window, the screen behaves in unpredictable ways,

wiping out all the dot net controls.

Is it a problem of the cobol run time ?

- Before resize:

- After resize:

Thank you all.

0 Likes
4 Replies
Micro Focus Expert
Micro Focus Expert

RE: AmortControl: Dot net controls wiped out after resizing the window

Are you using the layout manager to handle the resizing. Currently the layout manager handles the standard GUI controls and does not handle ActiveX or .Net assembly resizing. We're hoping to fix that restriction in the future.
YassirMabrouk Absent Member.
Absent Member.

RE: AmortControl: Dot net controls wiped out after resizing the window

Thanks for the answer, and no, I'm not using the layout manager.
0 Likes
Micro Focus Expert
Micro Focus Expert

RE: AmortControl: Dot net controls wiped out after resizing the window

Thanks. I reproduced the behavior you are seeing as well. It does appear to be a bug.
0 Likes
gjmills10 Absent Member.
Absent Member.

RE: AmortControl: Dot net controls wiped out after resizing the window

The resize event is caught by the COBOL window, which has no specific knowledge of what layout the .NET component contains. When handling the event, the new window size is contained in event-data-1 and event-data-2. In my application, I catch the event on the COBOL side, and then call a .NET method, passing in the values of the new window size. In the .NET method, I can then determine what to do with the resizing. You may want to allow some screen components to resize wider but not taller. You can determine where you allow blank space to increase. It is not always desirable for all components on the screen to resize in all directions.

I do not use the layout manager, but I do specify layout-data. For one .NET control, I wanted it to resize horizontally and vertically. For a second .NET control, I wanted it to resize only vertically. Setting layout-data means I can control how the COBOL window can resize.

This is my specific resize code for the control that resizes only vertically:

this.Parent.Size = new Size(_newWinX, _newWinY);
this.Height = this.Parent.Size.Height - titleBar;
this.Dock = DockStyle.Fill;
toolStripContainer1.Height = this.Height;
memoEdit1.Height = toolStripContainer1.Height
- toolStripContainer1.TopToolStripPanel.Height
- toolStripContainer1.BottomToolStripPanel.Height;

// Must redisplay components and reset Text in order for the resize to display correctly.
this.Show();

My control is a UserControl, similar to AmortControl. You can see that I set a new Parent.Size, based on the new window size values that were passed in. I also set a new Height value for the UserControl, subtracting off the size of the window title bar (an int value which represents the height), which comes from the COBOL side. Because my control fills the COBOL window, I was able to use DockStyle.Fill. You may need a different setting. I am using a ToolStripContainer to hold a toolbar at the top, then an editor control in the center, and a small message label at the bottom. I don't ever want to resize the toolbar or the message label, only the editor control, and then I want it so resize only vertically. So I calculate the editor's new height, starting with the (calculated) Height of the ToolStripContainer and subtracting off the top and bottom panels, which I don't want to resize. And I must Show the screen so that it is redrawn with the new height values.

I started out testing functionality of AmortControl as I was adding some .NET controls to my COBOL application. In the beginning, the interaction between the two was not always logical or intuitive, but I've been successful in figuring out how to make it work. Our customers have been running our first .NET module for several months.
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.