Changeset 41

Show
Ignore:
Timestamp:
05/13/07 18:18:59 (2 years ago)
Author:
lindquist
Message:

Win32 Fixed ListBox? scrollbars
Win32 ListBox? did not respect userPreferredSize

Files:

Legend:

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

    r40 r41  
    3232            this.name = name; 
    3333            HINSTANCE hInst = GetModuleHandleA(null); 
     34            DWORD dwStyle = (vscroll?WS_VSCROLL:0) | (hscroll?WS_HSCROLL:0); 
    3435            peer = CreateWindowA("LISTBOX","", 
    35                  WS_CHILD | WS_VISIBLE
     36                 WS_CHILD | WS_VISIBLE | dwStyle
    3637                 0,0,10,10,parentp, 
    3738                 cast(HMENU)0,hInst,null); 
     
    4849        Point preferredSize() { 
    4950            //            width = SendMessageA(peer,CB_GETDROPPEDWIDTH,0,0); 
    50             int height = SendMessageA(peer,LB_GETITEMHEIGHT,cast(WPARAM)-1,0)* 
    51                 SendMessageA(peer,LB_GETCOUNT,0,0); 
    52             int width = 75; 
     51            int width = (userPreferredWidth > 0) ? userPreferredWidth : 75; // TODO this is arbitrary 
     52            int height = (userPreferredHeight > 0) ? userPreferredHeight : 
     53                        SendMessageA(peer,LB_GETITEMHEIGHT,cast(WPARAM)-1,0) 
     54                      * SendMessageA(peer,LB_GETCOUNT,0,0); 
    5355            return XY(width,height); 
    5456        }