PlanetSquires Forums

Support Forums => Other Software and Code => Topic started by: Martin Francom on November 08, 2011, 08:44:43 PM

Title: Window size Wrong in FF35
Post by: Martin Francom on November 08, 2011, 08:44:43 PM
Paul,
   I have converted a FF31/PB9  program to FF35/PB10 and the window size
of the main window is not conforming to the size which is was set.
Take a look at the attached screen prints.  The first one is the new FF35/PB10
program and the second is the FF31/PB9.   Notice how much extra space is
on the right and bottom of the FF35/PB10 version.

   How do I correct this?
Title: Re: Window size Wrong in FF35
Post by: Martin Francom on November 08, 2011, 11:25:30 PM
Ok, got to playing with form size to see if I could
find out what the problem is and or a fix.  So I create a
new project. It only has 1 form and no controls. 
I set height to 780 and width to 1090.

Then I compile that with FF35 and FF31 and compare
the Windows size of the two programs.  The FF31 program
window is the correct size but the FF35 program window
is much larger.

Does any one else get this result?

Further testing showed that if I set the MinWidth/MinHeight and MaxWidth/MaxHeight
to 1090/780 1090/780 respectfully
and also set the  Width and Height setting to something smaller then the program window
would display at the correct size (1090/780)   
But if Width and Height were the same as the Min/Max then the program window didnot display at
the correct size.

So I think I found a work around for my project but I believe there is a problem as to how FF35
handles the Width and Height settings.
 
Title: Re: Window size Wrong in FF35
Post by: David Kenny on November 09, 2011, 01:38:42 PM
Marty,

Can you attach your test project?

Title: Re: Window size Wrong in FF35
Post by: Martin Francom on November 09, 2011, 07:20:59 PM
Quote from: David Kenny on November 09, 2011, 01:38:42 PM
Marty,

Can you attach your test project?


Just start a new project in FF31 and a new project in FF35 and
set the height and width of FORM1  and compile both projects
run both compiled projects and compare the Window size of each
program with each other.  If height and width are set the same
then the Window size should be the same but they are not
(at lease not on my computer) the FF35 windows is much larger.
Title: Re: Window size Wrong in FF35
Post by: Richard Kelly on November 17, 2011, 12:35:52 AM
I created a form 1024x768 and then in forms create method used FF_GetObjectWidth(hWndForm)/FF_GetObjectHeight(hWndForm) functions and the window size was 1280x960.

Rick Kelly
Title: Re: Window size Wrong in FF35
Post by: Richard Kelly on November 17, 2011, 01:28:55 AM
I think the issue is the DPI aware capabilties in Jose's includes. Your windows are scaling up, in my case by 125%.

In the cwindow.inc look for:


      ' // Check if the process is DPI aware
      LOCAL pWindow AS IWindow
      pWindow = ME
'     IF ISOBJECT(pWindow) THEN
'        pWindow.DPI = -1   ' // Scale windows according to the DPI setting
'        pWindow = NOTHING
'     END IF


If you comment out the IF/ENDIF section as I've shown above, your windows will not be resized.

When FF creates the window there is an optional parameter in Jose's methods that is a boolean on whether to use scaling or not. Perhaps the answer is to have that option included in the forms properties.

Rick kelly
Title: Re: Window size Wrong in FF35
Post by: José Roca on November 17, 2011, 02:00:02 AM
Quote from: Richard Kelly on November 17, 2011, 01:28:55 AM
I think the issue is the DPI aware capabilties in Jose's includes. Your windows are scaling up, in my case by 125%.

In the cwindow.inc look for:


      ' // Check if the process is DPI aware
      LOCAL pWindow AS IWindow
      pWindow = ME
'     IF ISOBJECT(pWindow) THEN
'        pWindow.DPI = -1   ' // Scale windows according to the DPI setting
'        pWindow = NOTHING
'     END IF


If you comment out the IF/ENDIF section as I've shown above, your windows will not be resized.

Rick kelly

Instead of commenting it, change it to


      ' // Check if the process is DPI aware
      LOCAL pWindow AS IWindow
      pWindow = ME
      IF ISOBJECT(pWindow) THEN
         IF pWindow.IsProcessDPIAware THEN
            pWindow.DPI = -1   ' // Scale windows according to the DPI setting
         END IF
         pWindow = NOTHING
      END IF


Otherwise, it won't work correctly with Vista/Windows 7.
Title: Re: Window size Wrong in FF35
Post by: Richard Kelly on November 17, 2011, 02:07:43 AM
I am running Win 7 64 bit and commenting out as I originally posted worked for me. I understand your changes and with that in place my FF forms still resize as my system is set to be DPI aware (125% setting). I still think the best answer is for FF to have a boolean scaling property.

Since I only use these includes with FF, I'll just reverse the meaning of the optional bNoScale as shown below. That way, I can leave my system DPI settings where they are and continue with my FF project while you titans of technology pursue a best case update.



      IF not bNoScale THEN
         m_hwnd = CreateWindowEx(dwExStyle, BYVAL dwClass, BYCOPY strTitle, dwStyle, _
                  IIF&(x = %CW_USEDEFAULT, %CW_USEDEFAULT, x), _
                  IIF&(y = %CW_USEDEFAULT, %CW_USEDEFAULT, y), _
                  IIF&(nWidth = %CW_USEDEFAULT, %CW_USEDEFAULT, nWidth), _
                  IIF&(nHeight = %CW_USEDEFAULT, %CW_USEDEFAULT, nHeight), _
                  hParent, %NULL, m_hInstance, tCreateParams)
      ELSE
         m_hwnd = CreateWindowEx(dwExStyle, BYVAL dwClass, BYCOPY strTitle, dwStyle, _
                  IIF&(x = %CW_USEDEFAULT, %CW_USEDEFAULT, x * m_rx), _
                  IIF&(y = %CW_USEDEFAULT, %CW_USEDEFAULT, y * m_ry), _
                  IIF&(nWidth = %CW_USEDEFAULT, %CW_USEDEFAULT, nWidth * m_rx), _
                  IIF&(nHeight = %CW_USEDEFAULT, %CW_USEDEFAULT, nHeight * m_ry), _
                  hParent, %NULL, m_hInstance, tCreateParams)
      END IF


Rick Kelly
Title: Re: Window size Wrong in FF35
Post by: José Roca on November 17, 2011, 02:37:03 AM
This parameter is not for that purpose.

If Paul adds a no scale option, what it has to do is to add


   pWindow.DPI = 96


After


Function FORM1_Show( _
                    ByVal hWndParent As Dword, _
                    ByVal ShowModalFlag As Long, _
                    Optional ByVal UserData As Long _
                    )  As Long

    Local IsMDIForm as Long

    ' // Create an instance of the class
    Local pWindow As IWindow
    pWindow = Class "CWindow"
    If IsNothing(pWindow) Then Function = -1: Exit Function

Title: Re: Window size Wrong in FF35
Post by: José Roca on November 17, 2011, 02:38:53 AM
Which theme are you using? Windows 7 Basic?
Title: Re: Window size Wrong in FF35
Post by: Richard Kelly on November 17, 2011, 03:17:45 AM
Quote from: Jose Roca on November 17, 2011, 02:38:53 AM
Which theme are you using? Windows 7 Basic?

Aero Landscapes with a 24 inch monitor at 1920x1200.

Rick Kelly
Title: Re: Window size Wrong in FF35
Post by: José Roca on November 17, 2011, 11:57:44 AM
If you're using Aero and it still resizes after adding


         IF pWindow.IsProcessDPIAware THEN
            pWindow.DPI = -1   ' // Scale windows according to the DPI setting
         END IF


to CWindow.inc, then you must have "Use Windows XP DPI style scaling" checked. This option of the DPI configuration dialog is a workaround of Vista/Windows 7 to force legacy non DPI aware applications to be DPI aware.

As I said, for those not wanting resolution independence, Paul must add


   pWindow.DPI = 96



after


Function FORM1_Show( _
                    ByVal hWndParent As Dword, _
                    ByVal ShowModalFlag As Long, _
                    Optional ByVal UserData As Long _
                    )  As Long

    Local IsMDIForm as Long

    ' // Create an instance of the class
    Local pWindow As IWindow
    pWindow = Class "CWindow"
    If IsNothing(pWindow) Then Function = -1: Exit Function


in the generated code.