#123 SizeX and SizeY not updated after resizing

3.2.0
closed
5
2012-08-14
2006-01-28
No

When resizing a dialog, the common methods SizeX and
SizeY of the DialogControl class are not updated, they
always contain the original values which were set
during window initialization.

The calculated values when using the example from the
manual also return a different value so I can't use
that to compare the original and new values.

A script is attached to show the problem.

Discussion

  • Gert van der Kooij

     
  • Mark Miesfeld

    Mark Miesfeld - 2007-01-08

    Logged In: YES
    user_id=191588
    Originator: NO

    Gert,

    I took a look at this and I have a few questions.

    1.) I guess the main question is: why do you think they should be updated?

    I don't see anything in the docs saying that they always represent the correct size. If you don't create a resizable dialog, they will always be correct.

    If you decide to create a resizable dialog, then (maybe) it's up to you to correct those attributes when the dialog is resized? If you want them updated.

    I don't see anything in the code that is hooked into a dialog (the Windows dialog) being resized that would then update the SizeX and SizeY attributes. In other words, I don't see any code that is doing something wrong; any code that has a bug in it.

    2.) I guess my next question is what are you trying to do that makes this a problem?

    a.) The ~getSize method will give you the current width and height of the dialog.

    b.) If you want to track what the last size of a resizable dialog is, you could add your own attributes and update them in an OnResize method. At init set LastX and LastY to SizeX and SizeY. In the OnResize method, see what the new current size is, compare it to LastX and LastY, do what you want, then update LastX and LastY when you leave the method.

    3.) I'm not sure what you mean by "the calculated values when using the example ... also return a different value so I can't use that to compare the original and new values" Maybe that is related to my second question of what exactly are you trying to do. You know what the new values are, you know what the original values are (SizeX and SizeY are the original values.)

    I'm sorry, I must be missing some point you are trying to make. <grin>

     
  • Nobody/Anonymous

    Logged In: NO

    Hi,

    Because the docs don't make a difference between resizable and not resizable dialogs I assume that both are always correct. If they are only correct when using not reziable dialogs then that should be mentioned.

     
  • Mark Miesfeld

    Mark Miesfeld - 2007-07-25

    Logged In: YES
    user_id=191588
    Originator: NO

    Committed revision 631. (A documentation update.)

    There are 2 sets of SizeX / SizeY attributes. The base dialog class has this pair of attributes and so does the base DialogControl class.

    1.) For a dialog control object, the only way it can be resized is if the programmer manually resizes it. At that point, if the programmer is concerned about the attribute values staying in sync with the new size of the control, the programmer should update the attribute with the new value.

    2.) For a dialog object: a dialog can be resized by the programmer manually in a similar fashion to a dialog control object. The same reasoning applies. If the programmer is concerned about the attibute's values being correct, then the programmer needs to update the attributes when he resizes the dialog. The only other way a dialog can be resized is if the programmer creates a resizable dialog and the user resizes the dialog. In this case, it is the programmers responsibility to update the attributes, if he is concerned about the value being correct. The programmer would use the connectResize method to connect the resize event with a method. Then, when the resize event happens, update the attributes based on the new size.

    I've updated the ooDialog documentation to clarify this issue.

     


Anonymous

Cancel  Add attachments