-----------------------------------------------------------------------------------------------------
                      [BUG/PRB.] VFP 9.0 FIX - FIX THE LISTBOX CONTROL IS DISPLAYED OUTSIDE THE CONTAINER CONTROL
                                  January 2024
                 -----------------------------------------------------------------------------------------------------
                                     CCB



1. BUG:

     In vfp9 (and vfp6, vfp7, vfp8), sometimes the ListBox control is displayed outside the Container control for the MODIFY FORM command.

     The bug only occurs for the ListBox control in the Container control or the PageFrame.Page control.

     The bug only occurs for the MODIFY FORM command, it does not occur for the DO FORM command.

     In vfp9, sometimes the ListBox control is displayed outside the Container control, please refer to the picture testlistboxoutsidecontainer-vfp9.jpg:


2. CAUSE:

     There are some BUGs in the following code.


3. RESOLUTION:

     We can write some code to fix the BUG.

     Fun46fa4d :: ; proc near
             sub esp , 014h                                                  ;0x0046fa4d :        83ec14
             push esi                                                        ;0x0046fa50 :        56
             push edi                                                        ;0x0046fa51 :        57
             mov edi , eax                                                   ;0x0046fa52 :        8bf8
             mov ecx , edi                                                   ;0x0046fa54 :        8bcf
             call Fun426ed7                                                  ;0x0046fa56 :        e87c74fbff
             mov  eax , dword ptr [edi]                                      ;0x0046fa5b :        8b07
             mov  ecx , dword ptr [ eax + 098h ]                             ;0x0046fa5d :        8b8898000000
             test ecx , ecx                                                  ;0x0046fa63 :        85c9
             je Label46fb13                                                  ;0x0046fa65 :        0f84a8000000
             mov  ecx , dword ptr [ eax + 0C8h ]                             ;0x0046fa6b :        8b88c8000000
             test ecx , ecx                                                  ;0x0046fa71 :        85c9
             jne Label5a095a                                                 ;0x0046fa73 :        0f85e10e1300

     Label46fa79 ::
             mov  eax , dword ptr [edi]                                      ;0x0046fa79 :        8b07
             mov  ecx , dword ptr [ eax + 32 ]                               ;0x0046fa7b :        8b4820
             test ecx , ecx                                                  ;0x0046fa7e :        85c9
             jne Label46fa8f                                                 ;0x0046fa80 :        750d
             test  dword ptr [ eax + 12 ] , 0440000h                         ;0x0046fa82 :        f7400c00004400
             jne Label47004e                                                 ;0x0046fa89 :        0f85bf050000

     Label46fa8f ::
             mov ecx , edi                                                   ;0x0046fa8f :        8bcf
             call Fun41bf53                                                  ;0x0046fa91 :        e8bdc4faff
             mov  eax , dword ptr [edi]                                      ;0x0046fa96 :        8b07
             mov  ecx , dword ptr [ eax + 098h ]                             ;0x0046fa98 :        8b8898000000
             mov  edx , dword ptr [ecx]                                      ;0x0046fa9e :        8b11
             mov  esi , dword ptr [ edx + 52 ]                               ;0x0046faa0 :        8b7234
             test esi , esi                                                  ;0x0046faa3 :        85f6
             je Label5a0985                                                  ;0x0046faa5 :        0f84da0e1300

     Label46faab ::
             mov  eax , dword ptr [edi]                                      ;0x0046faab :        8b07
             mov  ecx , dword ptr [ eax + 12 ]                               ;0x0046faad :        8b480c
             test  byte ptr ch , 01h                                         ;0x0046fab0 :        f6c501
             jne Label46fb13                                                 ;0x0046fab3 :        755e
             mov  esi , dword ptr [ eax + 098h ]                             ;0x0046fab5 :        8bb098000000
             mov eax , edi                                                   ;0x0046fabb :        8bc7
             call Fun46f22f                                                  ;0x0046fabd :        e86df7ffff
             pushd 01h                                                       ;0x0046fac2 :        6a01
             lea eax ,  dword ptr [ esp + 12 ]                               ;0x0046fac4 :        8d44240c
             push eax                                                        ;0x0046fac8 :        50
             xor esi , esi                                                   ;0x0046fac9 :        33f6
             mov eax , edi                                                   ;0x0046facb :        8bc7
             call Fun437e58                                                  ;0x0046facd :        e88683fcff
             mov  ecx , dword ptr [edi]                                      ;0x0046fad2 :        8b0f
             mov  eax , dword ptr [ ecx + 098h ]                             ;0x0046fad4 :        8b8198000000
             mov  ecx , dword ptr [eax]                                      ;0x0046fada :        8b08
             mov  edx , dword ptr [ ecx + 68 ]                               ;0x0046fadc :        8b5144
             test  byte ptr dh , 01h                                         ;0x0046fadf :        f6c601
             jne Label46faff                                                 ;0x0046fae2 :        751b
             mov  ecx , dword ptr [ ecx + 48 ]                               ;0x0046fae4 :        8b4930
             test ecx , ecx                                                  ;0x0046fae7 :        85c9
             jne Label5a09a4                                                 ;0x0046fae9 :        0f85b50e1300

     Label46faef ::


     ;
     ;                 ------------------------------------------------------------------------------------------
     ;                      VFP 9.0 FIX - FIX THE LISTBOX CONTROL IS DISPLAYED OUTSIDE THE CONTAINER CONTROL
     ;                                September 2021
     ;                 ------------------------------------------------------------------------------------------
     ;                                     CCB
     ;
     ; In vfp9, sometimes the ListBox control is displayed outside the Container control for the MODIFY FORM command,
     ; now the ListBox control is displayed normal.
     ;
     ; 2021/9/6, by ccb
     ;

             cmp dword ptr vfpa_sys9069_data,00h
             je Label46faf0
             mov  ecx , dword ptr [ Data9388dc ]
             mov  edx , dword ptr [edi]
             mov  edx , dword ptr [ edx + 0E4h ]
             test  edx , edx
             je Label46faf0
             lea edx ,  dword ptr [ edx + 4 * edx ]
             shl edx , 05h
             test  byte ptr [ edx + ecx + 48 ] , 02h
             je Label46faf0
             cmp  word ptr [ edx + ecx + 16 ] , 033Dh
             jne Label46faf0

             mov edx ,  dword ptr [ edx + ecx + 24 ]
             test  edx , edx
             je Label46faf0
             lea edx ,  dword ptr [ edx + 4 * edx ]
             shl edx , 05h
             test  byte ptr [ edx + ecx + 48 ] , 02h
             je Label46faf0
             cmp  word ptr [ edx + ecx + 16 ] , 0350h
             je Label46faff
             cmp  word ptr [ edx + ecx + 16 ] , 0331h
             je Label46faff
             jmp Label46faf0


     Label46faf0 ::
             mov  eax , dword ptr [eax]                                      ;0x0046faef :        8b00
             mov  ecx , dword ptr [eax]                                      ;0x0046faf1 :        8b08
             lea edx ,  dword ptr [ esp + 8 ]                                ;0x0046faf3 :        8d542408
             push edx                                                        ;0x0046faf7 :        52
             push ecx                                                        ;0x0046faf8 :        51
             call  ValidateRect                                ;0x0046faf9 :        ff1538759100

     Label46faff ::
             mov  eax , dword ptr [edi]                                      ;0x0046faff :        8b07
             mov  ecx , dword ptr [ eax + 098h ]                             ;0x0046fb01 :        8b8898000000
             lea edx ,  dword ptr [ esp + 8 ]                                ;0x0046fb07 :        8d542408
             push edx                                                        ;0x0046fb0b :        52
             push ecx                                                        ;0x0046fb0c :        51
             push edi                                                        ;0x0046fb0d :        57
             call Fun46fb19                                                  ;0x0046fb0e :        e806000000

     Label46fb13 ::
             pop edi                                                         ;0x0046fb13 :        5f
             pop esi                                                         ;0x0046fb14 :        5e
             add esp , 014h                                                  ;0x0046fb15 :        83c414
             ret                                                             ;0x0046fb18 :        c3

     Now in VFP Advanced, the ListBox control is displayed normal.
     Please refer to the picture testlistboxoutsidecontainer-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_vfp9fix194.asp

     2, foxite.com:
     https://www.foxite.com/archives/not-a-problem-just-annoying-0000484676.htm


6. OTHER:

     For reference only, there is no guarantees.

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