#368 ooDialog - createCenter does not center dialog


In ooDialog the UserDialog has a method createCenter which is supposed to center the dialog on the screen when it is created.

However, the created dialog is not centered on the screen. The immediate cause of the bug is that the method is using the size of the dialog to calculate the centered position. But, the screen size is in pixels and the dialog size is in dialog template units, so the calculation is incorrect.

In addition, dialogs have a DS_CENTER style that tells the OS to center the dialog. This is a better way to achieve a centered dialog because the OS seems to always get it right.

I'll attach a sample program that uses createCenter where it is fairly obvious the created dialog is not centered.


  • Mark Miesfeld

    Mark Miesfeld - 2007-07-25

    Example of un-centered dialog

  • Mark Miesfeld

    Mark Miesfeld - 2007-07-25

    Logged In: YES
    Originator: YES

    Committed revision 627.

    This commit changes the createCenter method so that it uses the DS_CENTER dialog style. It also updates the parsing of .rc files so that the DS_CENTER style is not ignored if present.



Cancel  Add attachments

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

No, thanks