Changeset 43

Show
Ignore:
Timestamp:
05/13/07 20:34:10 (2 years ago)
Author:
lindquist
Message:

Win32 new ListBox? interface now compiles and works

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/bughunt/minwin/listbox.d

    r42 r43  
    5858        int selection() { 
    5959            int sel = SendMessageA(peer,LB_GETCURSEL,0,0); 
    60             return sel == LB_ERR ? -1 : sel; 
     60            return sel < 0 ? -1 : sel; 
    6161        } 
    6262        void selection(int n) { 
    6363            if (n < 0) n = -1; 
    6464            int r = SendMessageA(peer,LB_SETCURSEL,cast(WPARAM)n,0); 
    65             sysAssert(r != LB_ERR, "Unable to select ListBox item"); 
     65            sysAssert(r >= 0, "Unable to select ListBox item"); 
    6666        } 
    6767 
     
    7373            if (useWfuncs) { 
    7474                int n = SendMessageW(peer,LB_GETTEXTLEN,cast(WPARAM)i,0); 
    75                 if (n == LB_ERR) return null; 
     75                if (n < 0) return null; 
    7676                scope str = new wchar[n+1]; 
    7777                n = SendMessageW(peer,LB_GETTEXT,cast(WPARAM)i,cast(LPARAM)str.ptr); 
    78                 if (n == LB_ERR) return null; 
     78                if (n < 0) return null; 
    7979                return toUTF8(str[0..$-1]); 
    8080            } else { 
    8181                int n = SendMessageA(peer,LB_GETTEXTLEN,cast(WPARAM)i,0); 
    82                 if (n == LB_ERR) return null; 
     82                if (n < 0) return null; 
    8383                scope str = new char[n+1]; 
    8484                n = SendMessageA(peer,LB_GETTEXT,cast(WPARAM)i,cast(LPARAM)str.ptr); 
    85                 if (n == LB_ERR) return null; 
     85                if (n < 0) return null; 
    8686                return fromMBSz(str.ptr); 
    8787            }