Maximizing the form - Programmers Heaven

Howdy, Stranger!

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

Categories

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.