---------------------------------------------------------------
                      [BUG/PRB.] VFP 9.0 FIX - COMBOBOX CONTROL SELECT ITEM
                                 January 2024
                 ---------------------------------------------------------------
                                     CCB



1. BUG:

     In vfp9, for the combobox control, sometimes when we move the mouse to select one item, but we can not select the item.

     The bug only occurs in vfp 9.0.0.3504 (SP1) or later, it does not occur in vfp6, vfp7, vfp8 and vfp 9.0.0.2412.

     The bug was reported by Swen Kleinau and kangss.


2. CAUSE:

     There are some BUGs in the following code.


3. RESOLUTION:

     We can write some code to fix the BUG.

     Label8c7512 ::
             cmp  dword ptr [ ebp + 0100h ] , 07h                            ;0x008c7512 :        83bd0001000007
             jne Label8c755d                                                 ;0x008c7519 :        7542
             mov edx , 01h                                                   ;0x008c751b :        ba01000000
             mov ecx , edi                                                   ;0x008c7520 :        8bcf
             call Fun42f404                                                  ;0x008c7522 :        e8dd7eb6ff
             mov  eax , dword ptr [eax]                                      ;0x008c7527 :        8b00
             mov  ecx , dword ptr [ eax + 0D0h ]                             ;0x008c7529 :        8b88d0000000
             mov  edx , dword ptr [ecx]                                      ;0x008c752f :        8b11
             mov  esi , dword ptr [ edx + 20 ]                               ;0x008c7531 :        8b7214
             mov edx , 01h                                                   ;0x008c7534 :        ba01000000
             mov ecx , esi                                                   ;0x008c7539 :        8bce
             call Fun42f404                                                  ;0x008c753b :        e8c47eb6ff
             mov  eax , dword ptr [eax]                                      ;0x008c7540 :        8b00
             test  byte ptr [ eax + 12 ] , 01h                               ;0x008c7542 :        f6400c01
             je Label8c755d                                                  ;0x008c7546 :        7415
             mov edx , 01h                                                   ;0x008c7548 :        ba01000000
             mov ecx , esi                                                   ;0x008c754d :        8bce
             call Fun42f404                                                  ;0x008c754f :        e8b07eb6ff
             xor edx , edx                                                   ;0x008c7554 :        33d2
             mov ecx , eax                                                   ;0x008c7556 :        8bc8
             call Fun416d0b                                                  ;0x008c7558 :        e8aef7b4ff

     Label8c755d ::
             mov esi , edi                                                   ;0x008c755d :        8bf7
             mov ebx , ebp                                                   ;0x008c755f :        8bdd
             call Fun4f2324                                                  ;0x008c7561 :        e8beadc2ff
             and  dword ptr [ ebp + 016Ch ] , 0FFDFFFFFh                     ;0x008c7566 :        81a56c010000ffffdfff


     ;
     ;                 ----------------------------------------------------
     ;                      VFP 9.0 FIX - COMBOBOX CONTROL SELECT ITEM
     ;                                 January 2019
     ;                 ----------------------------------------------------
     ;                                     CCB
     ;
     ; For the combobox control, sometimes when we move the mouse to select one item, but we can not select the item.
     ;
     ; 2019/1/30, by ccb
     ;

             jmp Label8c75e4


             mov edx , 01h                                                   ;0x008c7570 :        ba01000000
             mov ecx , edi                                                   ;0x008c7575 :        8bcf
             call Fun42f404                                                  ;0x008c7577 :        e8887eb6ff
             mov esi , eax                                                   ;0x008c757c :        8bf0
             mov ecx , esi                                                   ;0x008c757e :        8bce
             call Fun426ed7                                                  ;0x008c7580 :        e852f9b5ff
             mov al ,  byte ptr [ Data936f50 ]                               ;0x008c7585 :        a0506f9300
             test al , al                                                    ;0x008c758a :        84c0
             je Label8c759a                                                  ;0x008c758c :        740c
             mov ecx , 01h                                                   ;0x008c758e :        b901000000
             call Fun790ffa                                                  ;0x008c7593 :        e8629aecff
             jmp Label8c75a2                                                 ;0x008c7598 :        eb08

     Label8c759a ::
             mov  ecx , dword ptr [esi]                                      ;0x008c759a :        8b0e
             mov  eax , dword ptr [ ecx + 098h ]                             ;0x008c759c :        8b8198000000

     Label8c75a2 ::
             pushd 09h                                                       ;0x008c75a2 :        6a09
             push eax                                                        ;0x008c75a4 :        50
             call Fun43ebb2                                                  ;0x008c75a5 :        e80876b7ff
             mov edx , 01h                                                   ;0x008c75aa :        ba01000000
             mov ecx , edi                                                   ;0x008c75af :        8bcf
             call Fun42f404                                                  ;0x008c75b1 :        e84e7eb6ff
             mov esi , eax                                                   ;0x008c75b6 :        8bf0
             mov ecx , esi                                                   ;0x008c75b8 :        8bce
             call Fun426ed7                                                  ;0x008c75ba :        e818f9b5ff
             mov al ,  byte ptr [ Data936f50 ]                               ;0x008c75bf :        a0506f9300
             test al , al                                                    ;0x008c75c4 :        84c0
             je Label8c75d4                                                  ;0x008c75c6 :        740c
             mov ecx , 01h                                                   ;0x008c75c8 :        b901000000
             call Fun790ffa                                                  ;0x008c75cd :        e8289aecff
             jmp Label8c75dc                                                 ;0x008c75d2 :        eb08

     Label8c75d4 ::
             mov  edx , dword ptr [esi]                                      ;0x008c75d4 :        8b16
             mov  eax , dword ptr [ edx + 098h ]                             ;0x008c75d6 :        8b8298000000

     Label8c75dc ::
             pushd 0Ah                                                       ;0x008c75dc :        6a0a
             push eax                                                        ;0x008c75de :        50
             call Fun43ebb2                                                  ;0x008c75df :        e8ce75b7ff

     Label8c75e4 ::
             test  byte ptr [ ebp + 0170h ] , 01h                            ;0x008c75e4 :        f6857001000001
             je Label8c769b                                                  ;0x008c75eb :        0f84aa000000
             xor edx , edx                                                   ;0x008c75f1 :        33d2
             lea ecx ,  dword ptr [ esp + 20 ]                               ;0x008c75f3 :        8d4c2414
             call Fun54ea34                                                  ;0x008c75f7 :        e83874c8ff
             mov  ebx , dword ptr [ esp + 76 ]                               ;0x008c75fc :        8b5c244c
             lea eax ,  dword ptr [ esp + 28 ]                               ;0x008c7600 :        8d44241c
             push eax                                                        ;0x008c7604 :        50
             mov eax , ebx                                                   ;0x008c7605 :        8bc3
             call Fun507352                                                  ;0x008c7607 :        e846fdc3ff
             mov edi , eax                                                   ;0x008c760c :        8bf8
             lea esi ,  dword ptr [ esp + 20 ]                               ;0x008c760e :        8d742414
             call Fun49fd9c                                                  ;0x008c7612 :        e88587bdff
             mov  ecx , dword ptr [ esp + 24 ]                               ;0x008c7617 :        8b4c2418
             mov  eax , dword ptr [ esp + 20 ]                               ;0x008c761b :        8b442414
             pushd 02h                                                       ;0x008c761f :        6a02
             lea edx ,  dword ptr [ esp + 32 ]                               ;0x008c7621 :        8d542420
             push edx                                                        ;0x008c7625 :        52
             push ecx                                                        ;0x008c7626 :        51
             push eax                                                        ;0x008c7627 :        50
             mov esi , eax                                                   ;0x008c7628 :        8bf0
             lea eax ,  dword ptr [ esp + 96 ]                               ;0x008c762a :        8d442460
             push eax                                                        ;0x008c762e :        50
             mov  eax , dword ptr [ esp + 48 ]                               ;0x008c762f :        8b442430
             mov edi , ecx                                                   ;0x008c7633 :        8bf9
             mov  dword ptr [ esp + 100 ] , 00h                              ;0x008c7635 :        c744246400000000
             call Fun49fc67                                                  ;0x008c763d :        e82586bdff
             test eax , eax                                                  ;0x008c7642 :        85c0
             je Label8c768c                                                  ;0x008c7644 :        7446
             nop                                                             ;0x008c7646 :        90

     Label8c7647 ::
             mov  eax , dword ptr [ esp + 80 ]                               ;0x008c7647 :        8b442450
             test eax , eax                                                  ;0x008c764b :        85c0
             je Label8c7675                                                  ;0x008c764d :        7426
             mov  edx , dword ptr [ Data9388dc ]                             ;0x008c764f :        8b15dc889300
             lea ecx ,  dword ptr [ eax + 4 * eax ]                          ;0x008c7655 :        8d0c80
             shl ecx , 05h                                                   ;0x008c7658 :        c1e105
             mov  cx , word ptr [ ecx + edx + 16 ]                           ;0x008c765b :        668b4c1110
             cmp cx , 033Ah                                                  ;0x008c7660 :        6681f93a03
             je Label8c7690                                                  ;0x008c7665 :        7429
             cmp cx , 033Eh                                                  ;0x008c7667 :        6681f93e03
             je Label8c7690                                                  ;0x008c766c :        7422
             cmp cx , 0336h                                                  ;0x008c766e :        6681f93603
             je Label8c7690                                                  ;0x008c7673 :        741b

     Label8c7675 ::
             pushd 02h                                                       ;0x008c7675 :        6a02
             lea ecx ,  dword ptr [ esp + 32 ]                               ;0x008c7677 :        8d4c2420
             push ecx                                                        ;0x008c767b :        51
             push edi                                                        ;0x008c767c :        57
             push esi                                                        ;0x008c767d :        56
             lea edx ,  dword ptr [ esp + 96 ]                               ;0x008c767e :        8d542460
             push edx                                                        ;0x008c7682 :        52
             call Fun49fc67                                                  ;0x008c7683 :        e8df85bdff
             test eax , eax                                                  ;0x008c7688 :        85c0
             jne Label8c7647                                                 ;0x008c768a :        75bb

     Label8c768c ::
             mov  eax , dword ptr [ esp + 80 ]                               ;0x008c768c :        8b442450

     Label8c7690 ::
             cmp eax , ebx                                                   ;0x008c7690 :        3bc3
             je Label8c769b                                                  ;0x008c7692 :        7407
             mov eax , ebx                                                   ;0x008c7694 :        8bc3
             call Fun8c99cd                                                  ;0x008c7696 :        e832230000

     Label8c769b ::
             cmp  dword ptr [ esp + 84 ] , 02h                               ;0x008c769b :        837c245402
             jne Label8c76ca                                                 ;0x008c76a0 :        7528
             mov  ebx , dword ptr [ ebp + 0140h ]                            ;0x008c76a2 :        8b9d40010000
             lea eax ,  dword ptr [ esp + 84 ]                               ;0x008c76a8 :        8d442454
             lea edi ,  dword ptr [ ebp + 24 ]                               ;0x008c76ac :        8d7d18
             push eax                                                        ;0x008c76af :        50
             call Fun4ebb38                                                  ;0x008c76b0 :        e88344c2ff
             test eax , eax                                                  ;0x008c76b5 :        85c0
             je Label8c76ca                                                  ;0x008c76b7 :        7411
             mov  edx , dword ptr [ esp + 84 ]                               ;0x008c76b9 :        8b542454
             mov  ecx , dword ptr [ ebp + 0140h ]                            ;0x008c76bd :        8b8d40010000
             pushd 00h                                                       ;0x008c76c3 :        6a00
             call Fun4ecea2                                                  ;0x008c76c5 :        e8d857c2ff

     Label8c76ca ::
             cmp  dword ptr [ ebp + 80 ] , 02h                               ;0x008c76ca :        837d5002
             jne Label8c76d7                                                 ;0x008c76ce :        7507
             mov  dword ptr [ ebp + 80 ] , 01h                               ;0x008c76d0 :        c7455001000000

     Label8c76d7 ::
             mov  eax , dword ptr [ ebp + 56 ]                               ;0x008c76d7 :        8b4538
             call Fun4defb8                                                  ;0x008c76da :        e8d978c1ff

     Label8c76df ::
             or  dword ptr [ ebp + 016Ch ] , 018h                            ;0x008c76df :        838d6c01000018

     Label8c76e6 ::
             mov  eax , dword ptr [ esp + 76 ]                               ;0x008c76e6 :        8b44244c
             mov ecx , ebp                                                   ;0x008c76ea :        8bcd
             call Fun48237c                                                  ;0x008c76ec :        e88bacbbff

     Label8c76f1 ::
             mov  eax , dword ptr [ esp + 16 ]                               ;0x008c76f1 :        8b442410
             pop edi                                                         ;0x008c76f5 :        5f
             pop esi                                                         ;0x008c76f6 :        5e
             pop ebp                                                         ;0x008c76f7 :        5d
             pop ebx                                                         ;0x008c76f8 :        5b
             add esp , 038h                                                  ;0x008c76f9 :        83c438
             ret 0Ch                                                         ;0x008c76fc :        c20c00

     For the Drop-down list box (ComboBox.Style=2),
     recommend to add the following code to the ComboBox.InteractiveChange() event to refresh the selected item:
     IF THIS.STYLE=2
        THIS.VALUE=THIS.VALUE
        THIS.REFRESH
     ENDIF


4. APPLIES TO:

     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

     2, foxite.com:
     https://www.foxite.com/archives/vfp90-combobox-not-selecting-items-0000322918.htm

     3, mzvfp.com:
     http://www.mzvfp.com/read.php?tid=102302

     4, microsoft.com:
     https://social.msdn.microsoft.com/Forums/en-US/8702a050-8a09-4eaf-8b58-2e6a572512a8/vfp-90-combo-box-select-list-problem