changeset 1019:452388c9c3d8

Attempt at fixing no SELECT event being triggered during container insertion on OS/2.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Wed, 18 May 2011 01:02:23 +0000
parents a943f973c3ff
children c63abcab5312
files os2/dw.c
diffstat 1 files changed, 33 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/os2/dw.c	Tue May 17 23:27:33 2011 +0000
+++ b/os2/dw.c	Wed May 18 01:02:23 2011 +0000
@@ -4766,7 +4766,7 @@
                         WC_CONTAINER,
                         NULL,
                         WS_VISIBLE | CCS_READONLY |
-                        (multi ? CCS_EXTENDSEL : CCS_SINGLESEL) |
+                        (multi ? CCS_MULTIPLESEL : CCS_SINGLESEL) |
                         CCS_AUTOPOSITION,
                         0,0,2000,1000,
                         NULLHANDLE,
@@ -7574,6 +7574,25 @@
    }
 }
 
+/* Internal function to get the first item with given flags */
+PRECORDCORE _dw_container_start(HWND handle, unsigned long flags)
+{
+   PRECORDCORE pCore = WinSendMsg(handle, CM_QUERYRECORD, (MPARAM)0L, MPFROM2SHORT(CMA_FIRST, CMA_ITEMORDER));
+
+   if(pCore)
+   {
+       while(pCore)
+       {
+           if(pCore->flRecordAttr & flags)
+           {
+               return pCore;
+           }
+           pCore = WinSendMsg(handle, CM_QUERYRECORD, (MPARAM)pCore, MPFROM2SHORT(CMA_NEXT, CMA_ITEMORDER));
+       }
+   }
+   return NULL;
+}
+
 /*
  * Sets the title of a row in the container.
  * Parameters:
@@ -7585,6 +7604,7 @@
 {
    RECORDINSERT recin;
    ContainerInfo *ci = (ContainerInfo *)pointer;
+   PRECORDCORE pCore;
 
    if(!ci)
       return;
@@ -7599,6 +7619,17 @@
    _dw_send_msg(handle, CM_INSERTRECORD, MPFROMP(ci->data), MPFROMP(&recin), 0);
 
    free(ci);
+
+   if((pCore = _dw_container_start(handle, CRA_CURSORED)))
+   {
+       NOTIFYRECORDEMPHASIS pre;
+
+       pre.pRecord = pCore;
+       pre.fEmphasisMask = CRA_CURSORED;
+       pre.hwndCnr = handle;
+       _run_event(handle, WM_CONTROL, MPFROM2SHORT(0, CN_EMPHASIS), (MPARAM)&pre);
+       pre.pRecord->flRecordAttr |= CRA_CURSORED;
+   }
 }
 
 /*
@@ -7714,7 +7745,7 @@
          return pCore->pszIcon;
       }
    }
-    return NULL;
+   return NULL;
 }
 
 /*