Quantcast
Channel: VFPX
Viewing all articles
Browse latest Browse all 3798

New Post: ctl32_formstate bug

$
0
0
I've identified a bug in the above mentioned class which is part of the CTL32 class library. In the _restoreStateAfterFormShow method is the following code:
If This._FormType = CON_FORMTYPE_DEFAULT Then
    *!* we have a standard form, get coordinates of parent.
    *!* Parent can be a Top Level Form or the VFP _Screen
    m.loParentForm = ctlGetParentForm(Thisform)

    *!* Save parent position/size:
    With m.loRect
        .Left = 0
        .Top = 0
        .Right = m.loParentForm.Width
        .Bottom = m.loParentForm.Height
    Endwith
    m.loParentForm = .Null.
Else
If for some reason ctlGetParentForm does not return an object, the assignment of .Right and .Bottom will fail. I have updated my local version as follows:
If This._FormType = CON_FORMTYPE_DEFAULT Then
    *!* we have a standard form, get coordinates of parent.
    *!* Parent can be a Top Level Form or the VFP _Screen
    m.loParentForm = ctlGetParentForm(Thisform)

    *!* Save parent position/size:
    With m.loRect
        .Left = 0
        .Top = 0
*!* - rk - 2013-3-6 - make sure that loParentForm is an object, else fall back to display
        IF VARTYPE(m.loParentForm)=[O]
            .Right = m.loParentForm.Width
            .Bottom = m.loParentForm.Height
        ELSE 
            .Right = Sysmetric(SYSMETRIC_CLIENTWIDTH)
            ** BUG! VFP reports this as too small, add one title bar height to value:
            .Bottom = Sysmetric(SYSMETRIC_CLIENTHEIGHT) + Sysmetric(SYSMETRIC_WINDOWTITLEHEIGHT)
        ENDIF 
    Endwith
    m.loParentForm = .Null.
Else

Viewing all articles
Browse latest Browse all 3798

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>