----------------------------------------------------------------------
                      [BUG/PRB.] VFP 9.0 FIX - FIX THE FOCUS RECTANGLE DISAPPEARED
                                  August 2021
                 ----------------------------------------------------------------------
                                     CCB



1. BUG:

     In vfp9 (and vfp6, vfp7, vfp8), if we set the BackStyle property to 0 (Transparent), sometimes the focus rectangle disappeared.

     The bug only occurs when the BackStyle property is 0 (Transparent), it does not occur when the BackStyle property is 1 (Opaque).

     In vfp9, sometimes the focus rectangle disappeared, please refer to the picture testfocusrectangle-vfp9.jpg:


2. CAUSE:

     There are some BUGs in the following code.


3. RESOLUTION:

     We can write some code to fix the BUG.

     Fun428edc :: ; proc near
             sub esp , 094h                                                  ;0x00428edc :        81ec94000000
             push ebx                                                        ;0x00428ee2 :        53
             push esi                                                        ;0x00428ee3 :        56
             mov esi , ecx                                                   ;0x00428ee4 :        8bf1
             mov  ecx , dword ptr [ Data9388dc ]                             ;0x00428ee6 :        8b0ddc889300
             lea eax ,  dword ptr [ esi + 4 * esi ]                          ;0x00428eec :        8d04b6
             shl eax , 05h                                                   ;0x00428eef :        c1e005
             test  byte ptr [ eax + ecx + 48 ] , 02h                         ;0x00428ef2 :        f644083002
             mov  dword ptr [ esp + 120 ] , esi                              ;0x00428ef7 :        89742478
             jne Label428f4e                                                 ;0x00428efb :        7551
             push ebp                                                        ;0x00428efd :        55
             xor ebp , ebp                                                   ;0x00428efe :        33ed
             cmp edx , ebp                                                   ;0x00428f00 :        3bd5
             jne Label4797fd                                                 ;0x00428f02 :        0f85f5080500
             lea ebx ,  dword ptr [ esp + 108 ]                              ;0x00428f08 :        8d5c246c
             mov eax , esi                                                   ;0x00428f0c :        8bc6
             call Fun428d94                                                  ;0x00428f0e :        e881feffff
             test eax , eax                                                  ;0x00428f13 :        85c0
             je Label428f4d                                                  ;0x00428f15 :        7436

     Label428f17 ::


     ;
     ;                 -----------------------------------------------------------
     ;                      VFP 9.0 FIX - FIX THE FOCUS RECTANGLE DISAPPEARED
     ;                                  August 2021
     ;                 -----------------------------------------------------------
     ;                                     CCB
     ;
     ; If we set the BackStyle property to 0 (Transparent), sometimes the focus rectangle disappeared.
     ;
     ; 2021/8/26, by ccb
     ;

             cmp dword ptr vfpa_sys9068_data,00h
             je Label428f18
             push esi
             call vfpa_focusrectangle


     Label428f18 ::
             pushd 01h                                                       ;0x00428f17 :        6a01
             mov ebx , 0Ah                                                   ;0x00428f19 :        bb0a000000
             lea eax ,  dword ptr [ esp + 088h ]                             ;0x00428f1e :        8d842488000000
             mov  dword ptr [ esp + 088h ] , esi                             ;0x00428f25 :        89b42488000000
             mov  dword ptr [ esp + 08Ch ] , esi                             ;0x00428f2c :        89b4248c000000
             mov  dword ptr [ esp + 090h ] , ebp                             ;0x00428f33 :        89ac2490000000
             call Fun436eea                                                  ;0x00428f3a :        e8abdf0000
             mov esi , eax                                                   ;0x00428f3f :        8bf0
             cmp esi , ebp                                                   ;0x00428f41 :        3bf5
             mov  dword ptr [ esp + 20 ] , esi                               ;0x00428f43 :        89742414
             jne Label4d7481                                                 ;0x00428f47 :        0f8534e50a00

     Label428f4d ::
             pop ebp                                                         ;0x00428f4d :        5d

     Label428f4e ::
             pop esi                                                         ;0x00428f4e :        5e
             pop ebx                                                         ;0x00428f4f :        5b
             add esp , 094h                                                  ;0x00428f50 :        81c494000000
             ret                                                             ;0x00428f56 :        c3

     Now in VFP Advanced, the focus rectangle is displayed normal.
     Please refer to the picture testfocusrectangle-vfpa.jpg:


4. APPLIES TO:

     VFP 6.0.8167.0
     VFP 6.0.8961.0 (SP5)

     VFP 7.0.0.9262
     VFP 7.0.0.9465 (SP1)

     VFP 8.0.0.2521
     VFP 8.0.0.3117 (SP1)

     VFP 9.0.0.2412
     VFP 9.0.0.3504 (SP1)
     VFP 9.0.0.4611 (SP2)
     VFP 9.0.0.5015 (SP2)
     VFP 9.0.0.5411 (SP2)
     VFP 9.0.0.5721 (SP2)
     VFP 9.0.0.5815 (SP2)
     VFP 9.0.0.6303 (SP2)
     VFP 9.0.0.6602 (SP2)
     VFP 9.0.0.7423 (SP2)

     The bug has been fixed in VFP Advanced.


5. REFERENCE WEBSITES:

     1, baiyujia.com:
     http://www.baiyujia.com
     http://www.baiyujia.com/vfpdocuments/f_vfp9fix192.asp


6. OTHER:

     For reference only, there is no guarantees.

     Any questions or suggestions, please send me an email at ccb2000@163.com.