Popup window questions

Answered
0
0

I’m currently evaluating WiseJ and have some questions about the popupwindow control which I plan to use like a modal window in WinForms to edit database records.

  1. I’ve set the property “Moveable” to false. But at runtime if I move the mouse over the title bar the cursor icon changes to the move icon. Is there any way to prevent this ?
  2. Also I set the property “StartPosition” to “CenterParent”. This works but I want to keep the PopupWindow centered within the browser even if I resize the browser window.
  • You must to post comments
Best Answer
0
0

Hi Tobias,

the cursor issue is logged as WJ-8435 and is fixed in the latest Wisej release (1.4.24).

Best regards
Frank

  • You must to post comments
0
0

Thanks for your answer Luca. I’ll give it a try.
I thought the cursor topic may be a bug because I don’t see any reason for displaying a move cursor when the popupwindow should be unmovable !?

 

  • You must to post comments
0
0

 

The Wisej.Web.Form control is a floating window and it’s not part of a layout container (unless you make it a child of a control).

Child controls, like the UserControl, Panel, etc, can keep  their relative position by setting the Anchor property to None.

You can force the location of the window and adjust it the screen (the browser) every time it changes by adding this code:

public Window1()
{
  InitializeComponent();

  this.Disposed += Window1_Disposed;
  Application.BeginRequest += Application_BeginRequest;
}

private void Window1_Disposed(object sender, EventArgs e)
{
  // Application.BeginRequest is a static event and needs to be detached on dispose.
  Application.BeginRequest -= Application_BeginRequest;
}

private void Application_BeginRequest(object sender, EventArgs e)
{
  // Use BeginInvoke to execute the call at the end of the request so we have the updated browser size.
  BeginInvoke((Action)this.CenterToScreen);
}

/** 
    For some reason this method is missing from our class. It will be added to Wisej.Web.Form.
    We'll also add Control.CenterToParent().
*/

/// <summary>
/// Centers the window on the current browser size.
/// </summary>
protected void CenterToScreen()
{
  if (this.TopLevel)
  {
    var mySize = this.Size;
    var parentSize = Application.Browser.Size;

    this.Location = new System.Drawing.Point(
      (parentSize.Width - mySize.Width) / 2,
      (parentSize.Height - mySize.Height) / 2
    );
  }
}

The code above simply centers the forms when the browser size changes.

To disable the “move” cursor from the caption bar you need a mixin theme. Every Wisej application should have a/Themes/Application.mixin.theme since at one point or another you’ll need a custom style without having to replicate a whole theme and you want the custom change to be compatible with any theme. Which is what mixins do. The other way is to use css files, but Wisej themes are more flexible.

Use this mixin:

{
  "appearances": {
    "fixed-window": {
      "inherit": "window",
      "components": {
        "captionbar": {
          "states": {
            "default": {
              "properties": {
                "cursor": "default"
              }
            }
          }
        }
      }
    }
  }
}

As you can see this mixin changes only the cursor of the window/captionbar.

The set the appearance key of the fixed window in the constructor or InitializeComponent to:

  this.AppearanceKey = "fixed-window";

HTH

Best,

Luca

  • You must to post comments
Showing 3 results
Your Answer

Please first to submit.