Changeset 349

Show
Ignore:
Timestamp:
12/29/07 20:59:27 (1 year ago)
Author:
Pse
Message:

Ticket #13. Thanks to keinfarbton for reporting and fixing.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/src/gtk/ComboBox.d

    r348 r349  
    174174    public void setActiveText(char[] text, bool insert=false) 
    175175    { 
    176         int currActive = getActive(); 
    177176        int active = 0; 
    178         setActive(active); 
    179         bool found = false; 
    180         while ( !found && active==getActive) 
    181         { 
    182             found = text==getActiveText(); 
     177        setActive(0); 
     178        while ( getActive >= 0 ) // returns -1 if end of list if reached 
     179        { 
     180            if( text == getActiveText() ) return; 
    183181            ++active; 
    184         } 
    185         if ( !found ) 
    186         { 
    187             if ( insert ) 
    188             { 
    189                 appendText(text); 
    190                 setActive(active); 
    191             } 
    192             else 
    193             { 
    194                 //setActive(currActive); 
    195                 setActive(-1); 
    196             } 
     182            setActive(active); 
     183        } 
     184        // was not found, the combo has now nothing selected 
     185        if ( insert ) 
     186        { 
     187            appendText(text); 
     188            setActive(active); 
    197189        } 
    198190    } 
  • trunk/wrap/APILookupGtk.txt

    r346 r349  
    33973397    public void setActiveText(char[] text, bool insert=false) 
    33983398    { 
    3399         int currActive = getActive(); 
    3400         int active = 0; 
    3401         setActive(active); 
    3402         bool found = false; 
    3403         while ( !found && active==getActive) 
    3404         { 
    3405             found = text==getActiveText(); 
    3406             ++active; 
    3407         } 
    3408         if ( !found ) 
    3409         { 
    3410             if ( insert ) 
    3411             { 
    3412                 appendText(text); 
    3413                 setActive(active); 
    3414             } 
    3415             else 
    3416             { 
    3417                 //setActive(currActive); 
    3418                 setActive(-1); 
    3419             } 
    3420         } 
     3399            int active = 0; 
     3400            setActive(0); 
     3401            while ( getActive >= 0 ) // returns -1 if end of list if reached 
     3402            { 
     3403                if( text == getActiveText() ) return; 
     3404                ++active; 
     3405                setActive(active); 
     3406            } 
     3407            // was not found, the combo has now nothing selected 
     3408            if ( insert ) 
     3409            { 
     3410                appendText(text); 
     3411                setActive(active); 
     3412            } 
    34213413    } 
    34223414