Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

Maximizing the form

SaMoSaMo Posts: 36Member
Hello!

I am quite aware that this might be a pretty stupid question, but anyway. What I am trying to achieve is that my program performs some kind of action when the user maximizes the main form. In other words I need the program to act when user presses Maximize button in the top right corner of the form (standard button for any Windows application).

I tried basically two methods:
1) Application.onMaximize event but this one seems to have other purposes. This event is actually not triggered when form is maximized (or I did something wrong).

2) Main form's WinState property. However, this one works kinda strange. I expected it to become wsMaximized when user maximizes the window, but somehow it stays wsNormal, so the program does not do what I want it to.

Any help will be highly appreciated.

Comments

  • zibadianzibadian Posts: 6,349Member
    : Hello!
    :
    : I am quite aware that this might be a pretty stupid question, but anyway. What I am trying to achieve is that my program performs some kind of action when the user maximizes the main form. In other words I need the program to act when user presses Maximize button in the top right corner of the form (standard button for any Windows application).
    :
    : I tried basically two methods:
    : 1) Application.onMaximize event but this one seems to have other purposes. This event is actually not triggered when form is maximized (or I did something wrong).
    :
    : 2) Main form's WinState property. However, this one works kinda strange. I expected it to become wsMaximized when user maximizes the window, but somehow it stays wsNormal, so the program does not do what I want it to.
    :
    : Any help will be highly appreciated.
    :
    You can use the TForm.OnResize() for this, although it will report the previous WindowState. To get arround this, you need to call UpdateWindowState(), before checking the WindowState.
  • SaMoSaMo Posts: 36Member
    : You can use the TForm.OnResize() for this, although it will report the previous WindowState. To get arround this, you need to call UpdateWindowState(), before checking the WindowState.

    Thanks! I actually did just that but without calling UpdateWindowState(), and thus faced some problems.

Sign In or Register to comment.