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.

  • 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.
  • Thanks for the answer, and no, I'm not using the layout manager.
  • Thanks for the answer, and no, I'm not using the layout manager.
  • Thanks. I reproduced the behavior you are seeing as well. It does appear to be a bug.
  • 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.

    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.