home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Professional Developers Kit 1992 November / Disc01 / Disc01.mdf / cppbeta / clsam4j / testcnr.cp_ / TESTCNR.CPP
Encoding:
C/C++ Source or Header  |  1992-10-25  |  43.8 KB  |  1,373 lines

  1.  
  2. #include <os2.h>
  3. #include "testcnr.hpp"
  4. #include <istring.hpp>
  5. #include <itrace.hpp>
  6. #include <ititle.hpp>
  7. #include <ireslib.hpp>
  8. #include <iapp.hpp>           
  9. #include <icnrctl.hpp>
  10. #include <iabmenu.hpp>        
  11. #include "testcnr.h"
  12.  
  13. #ifdef __automake__
  14.   source "testcnr.rc", "testcnr.def";
  15.   library  "ibase", "ibaseapp", "ibasectl", "icnr";
  16. #endif
  17.  
  18.  
  19. /*--------------------------------------------------------*/
  20. /* This is the entry point from the System.               */
  21. /*--------------------------------------------------------*/
  22. void  main(int argc,char **argv)
  23. {
  24.    IMODTRACE_DEVELOP("main");
  25.  
  26.    // create our main window has child of the desktop
  27.    CustomerList* pcnrList = new CustomerList(IRectangle());
  28.  
  29.    /*-----------------------------------------------------*/
  30.    /* set the title data for all views, but make invisable*/
  31.    /*-----------------------------------------------------*/
  32.    ITRACE_DEVELOP("setting container Title");
  33.    pcnrList->container().setContainerTitle("Customer Records");
  34.  
  35.    ITRACE_DEVELOP("setting focus");
  36.    pcnrList->setFocus();
  37.  
  38.    // run the aplication
  39.    ITRACE_DEVELOP("running the app");
  40.    IApplication::current.run();
  41.  
  42.    delete pcnrList;
  43. }
  44.  
  45.  
  46.  
  47.  
  48. /*--------------------------------------------------------*/
  49. /* CustomerList Constructor.                              */
  50. /*--------------------------------------------------------*/
  51. CustomerList :: CustomerList(const IRectangle& rect,
  52.                                Boolean fLoadObjectsIn)
  53.   : IFrameWindow(CNR_MAINWINDOW),
  54.     // Create a Container Control
  55.     _pcnrCustList(new IContainerControl(CNR_MAINCONTROL, this, this, IRectangle())),
  56.     _pObjectList(new IContainerControl(CNR_MAINCONTROL+1, this, this, IRectangle(),
  57.                  IContainerControl::extendedSelection | IWindow::visible,
  58.                  IContainerControl::textView)),
  59.      cnrcolIcon( IContainerObject :: iconOffset(),
  60.                 IContainerColumn::defHeadingStyle,
  61.                 IContainerColumn::icon |
  62.                 IContainerColumn::centerVertically),
  63.      cnrcolName(IContainerObject::iconTextOffset(),
  64.                 IContainerColumn::defHeadingStyle,
  65.                 IContainerColumn::string | 
  66.                 IContainerColumn::centerVertically | 
  67.                 IContainerColumn::leftJustify | 
  68.                 IContainerColumn::horizontalSeparator),
  69.      cnrcolAddress( FIELDOFFSET2(Customer, strCustomerAddress)),
  70.      cnrcolPhone( FIELDOFFSET2(Customer, strCustomerPhone)),
  71.      cnrcolAge( FIELDOFFSET2(Customer, ulCustomerAge),
  72.                 IContainerColumn::defHeadingStyle,
  73.                 IContainerColumn::number | 
  74.                 IContainerColumn::centerVertically | 
  75.                 IContainerColumn::horizontalSeparator | 
  76.                 IContainerColumn::rightJustify),
  77.      cnrcolOrderDate( FIELDOFFSET2(Customer, strOrderDate),
  78.                 IContainerColumn::defHeadingStyle,
  79.                 IContainerColumn::string |
  80.                 IContainerColumn::centerVertically | 
  81.                 IContainerColumn::horizontalSeparator | 
  82.                 IContainerColumn::leftJustify),
  83.      cnrcolOrderTime( FIELDOFFSET2(Customer, strOrderTime),
  84.                 IContainerColumn::defHeadingStyle,
  85.                 IContainerColumn::string |
  86.                 IContainerColumn::centerVertically | 
  87.                 IContainerColumn::horizontalSeparator | 
  88.                 IContainerColumn::rightJustify)
  89.  
  90. {
  91.    IMODTRACE_DEVELOP("CnrLst::CnrLst");
  92.  
  93.    // Add a title
  94. //   _pTitle = new ITitle(this, "Container Test Program");
  95.  
  96.    // set ourselves as event handler, since we multiple-inherit
  97.    addHandler(this);
  98.  
  99.    // set main menu
  100.    IActionBarMenu* pabmnMain=new IActionBarMenu(CNR_MAIN_MENU,this);
  101.  
  102.    // Put the main container in the client area
  103.    setClient(_pcnrCustList);
  104.  
  105.    // Create static text status area
  106.    _pStatusLine = new IStaticText(CNR_STATUSAREA, this, this, IRectangle());
  107.    _pStatusLine->setText("Loading Container. Please wait...");
  108.  
  109.    // set status line on top of client fill-box
  110.    addControl(_pStatusLine,
  111.               IFrCtlAttr::placeTop | IFrCtlAttr::splitBar,
  112.               _pcnrCustList, None, 30);
  113.  
  114.    // Put the object list container as a frame extension
  115.    addControl(_pObjectList,
  116.               IFrCtlAttr::placeRight | IFrCtlAttr::splitBar,
  117.               _pcnrCustList, None, 90);
  118.  
  119.  
  120.    // Create titlebar icon
  121. //   _pTitleIcon = new IIconControl(CNR_MINIICON, this, this, IRectangle(0, 0, 30,30),
  122. //                                  CNR_MINIICON);
  123.  
  124.    // set this one as extension, left of titlebar
  125. //   addControl(_pTitleIcon,
  126. //              IFrCtlAttr::placeBottom | IFrCtlAttr::thinSepLine,
  127. //              0, Titlebar, 30);
  128.  
  129.  
  130.    cnrcolAddress.enableDataUpdate();
  131.    fLoadObjects=fLoadObjectsIn;
  132.  
  133.    show();
  134.    container().hide();
  135.  
  136.    if(loadObjects()==TRUE)
  137.       loadContainer(container());
  138.  
  139.    // Create Objects to match all of these and store the pointers
  140.    // as an object in the second container.
  141.    {
  142.      ICnrObjectSet objset = container().objectList();
  143.      ICnrObjectSet::Cursor objcur(objset);
  144.      IContainerObject *pcnrobjOld, *pcnrobjNew;
  145.      IString strPointer;
  146.      for(objcur.setToFirst(); objcur.isValid(); objcur.setToNext())
  147.      {
  148.         pcnrobjOld = objset.elementAt(objcur);
  149.         strPointer = IString((unsigned long)pcnrobjOld);
  150.         strPointer.d2x();
  151.         pcnrobjNew = new IContainerObject(strPointer);
  152.         objectList().addObject(pcnrobjNew);
  153.      }
  154.    }
  155.  
  156.    /*-----------------------------------------------------*/
  157.    /* Details View setup (Not required if not used).      */
  158.    /*-----------------------------------------------------*/
  159.  
  160.    /* set the title data for details view  */
  161.    colIcon()->setHeadingText("Icon");
  162.    colName()->setHeadingText("Customer Name");
  163.    colAddress()->setHeadingText("Address ");
  164.    colPhone()->setHeadingIcon(IResourceId(ICON_PHONE));
  165.    colAge()->setHeadingText("Customer Age");
  166.    colOrderDate()->setHeadingText("Order Date");
  167.    colOrderTime()->setHeadingText("Order Time");
  168.  
  169.    /* add column separators */
  170.    colName()->showDataSeparators(IContainerColumn::horizontalSeparator);
  171.    colAddress()->showDataSeparators();
  172.    colPhone()->showDataSeparators(IContainerColumn::verticalSeparator);
  173.  
  174.    /* add the columns to the container */
  175.      container().addColumn(colIcon());
  176.      container().addColumn(colName());
  177.      container().addColumn(colAddress());
  178.      container().addColumn(colPhone());
  179.      container().addColumn(colAge());
  180.      container().addColumn(colOrderDate());
  181.      container().addColumn(colOrderTime());
  182.  
  183.    container().setDetailsViewSplit(colName(), 150);
  184.  
  185.    container().setDestroyObjectsOnClose();
  186.  
  187.    /*-----------------------------------------------------*/
  188.    /* Misc. adjustments to the various views.             */
  189.    /*-----------------------------------------------------*/
  190.    container().arrangeIconView();
  191.    container().showTreeLine();
  192.    container().showContainerTitle();
  193.    container().enableOwnerDraw();
  194.  
  195.    container().showTreeIconView();
  196.  
  197.    /*-----------------------------------------------------*/
  198.    /* Setup to allow Direct Manipulation on the Container.*/
  199.    /*-----------------------------------------------------*/
  200.  
  201.    container().show();
  202.    _pStatusLine->setText("O.K.");
  203.  
  204. }
  205.  
  206. /*--------------------------------------------------------*/
  207. /* Add the objects to the passed container loading icons  */
  208. /* from the passed resource manager.                      */
  209. /*--------------------------------------------------------*/
  210. void loadContainer(IContainerControl& cnrctl)
  211. {
  212.    IResourceLibrary reslib;
  213.  
  214.    IMODTRACE_DEVELOP("loadContainer()");
  215.  
  216.    /* load the icons */
  217.    ITRACE_DEVELOP("Loading icons");
  218.    IPointerHandle hptrNotebook = reslib.loadIcon(ICON_NOTEBOOK);
  219.    ITRACE_DEVELOP(IString("Returned PointerValue is:")+IString(hptrNotebook));
  220.    IPointerHandle hptrCabinet  = reslib.loadIcon(ICON_CABINET);
  221.    ITRACE_DEVELOP(IString("Returned PointerValue is:")+IString(hptrCabinet));
  222.    IPointerHandle hptrInBasket = reslib.loadIcon(ICON_INBASKET);
  223.    IPointerHandle hptrShredder = reslib.loadIcon(ICON_SHREDDER);
  224.  
  225.    /* construct some strings to use in the objects  */
  226.    ITRACE_DEVELOP("Building default strings");
  227.    IString strText("");
  228.    IString strIconName(" - Icon Name");
  229.    IString strName(" - Name");
  230.    IString strAddress(" - Address");
  231.    IString strPhone(" - Phone");
  232.  
  233.    /* Declare some stack arrays for the objects pointers */
  234.    const int sObjCount = 10;
  235.    Customer* NoteBookList[sObjCount];
  236.    Customer* CabinetList[sObjCount];
  237.    Customer* InBasketList[sObjCount];
  238.    Customer* ShredderList[sObjCount];
  239.  
  240.  
  241.    /*  Build The Parent Objects  */
  242.    ITRACE_DEVELOP("Building parent objects");
  243.    NoteBookList[0] = new Customer("Notebook Parent",hptrNotebook);
  244.    CabinetList[0]  = new Customer("Cabinet Parent" ,hptrCabinet );
  245.    InBasketList[0] = new Customer("InBasket Parent",hptrInBasket);
  246.    ShredderList[0] = new Customer("Shredder Parent",hptrShredder);
  247.  
  248.    /* Add Name Address & Phone to parents */
  249.    ITRACE_DEVELOP(IString("Text is ")+NoteBookList[0]->iconText());
  250.    NoteBookList[0]->setCustomerName("Nate Notebook");
  251.    NoteBookList[0]->setCustomerAddress("12 Address");
  252.    NoteBookList[0]->setCustomerPhone("361-5511");
  253.    NoteBookList[0]->setCustomerAge(10);
  254.    NoteBookList[0]->setOrderDate(IDate(IDate::December, 1, 1992));
  255.    NoteBookList[0]->setOrderTime(ITime::now());
  256.  
  257.    CabinetList[0]->setCustomerName("Carla Cabinet");
  258.    CabinetList[0]->setCustomerAddress("34 Address");
  259.    CabinetList[0]->setCustomerPhone("361-5512");
  260.    CabinetList[0]->setCustomerAge(20);
  261.    CabinetList[0]->setOrderDate(IDate(IDate::February, 15, 1990));
  262.    CabinetList[0]->setOrderTime(ITime::now());
  263.  
  264.    InBasketList[0]->setCustomerName("Inna InBasket");
  265.    InBasketList[0]->setCustomerAddress("56 Address");
  266.    InBasketList[0]->setCustomerPhone("361-5512");
  267.    InBasketList[0]->setCustomerAge(30);
  268.    InBasketList[0]->setOrderDate(IDate(IDate::February, 22, 1993));
  269.    InBasketList[0]->setOrderTime(ITime::now());
  270.  
  271.    ShredderList[0]->setCustomerName("Shirley Shredder");
  272.    ShredderList[0]->setCustomerAddress("78 Address");
  273.    ShredderList[0]->setCustomerPhone("361-551");
  274.    ShredderList[0]->setCustomerAge(40);
  275.    ShredderList[0]->enableDataUpdate();
  276.    ShredderList[0]->setOrderDate(IDate(IDate::December, 3, 3));
  277.    ShredderList[0]->setOrderTime(ITime::now());
  278.  
  279.  
  280.    /* Add the parent objects to the container */
  281.    ITRACE_DEVELOP("Adding parent objects to container");
  282.    cnrctl.addObject(NoteBookList[0]);
  283.    cnrctl.addObject(CabinetList[0]);
  284.    cnrctl.addObject(InBasketList[0]);
  285.    cnrctl.addObject(ShredderList[0]);
  286.  
  287.    int s;
  288.    ITRACE_DEVELOP("Constructing Notebook child objects");
  289.    /* Add some children to the Notebook */
  290.    for (s=1; s<sObjCount; s++)
  291.    {
  292.      strText = IString(s) + strName;
  293.  
  294.      /* construct the Notebook Customer */
  295.      hptrNotebook = reslib.loadIcon(ICON_NOTEBOOK);
  296.      NoteBookList[s] = new Customer(strText,hptrNotebook);
  297.  
  298.      /* Add the Name, Address, and Phone  */
  299.      NoteBookList[s]->setCustomerName(strText);
  300.      strText = IString(s) + strAddress;
  301.      NoteBookList[s]->setCustomerAddress(strText);
  302.      strText = IString(s) + strPhone;
  303.      NoteBookList[s]->setCustomerPhone(strText);
  304.      NoteBookList[s]->setCustomerAge(10+s);
  305.      NoteBookList[0]->setOrderDate(IDate::today());
  306.      NoteBookList[0]->setOrderTime(ITime::now());
  307.  
  308.  
  309.      /* add the object to the container            */
  310.      cnrctl.addObject(NoteBookList[s], NoteBookList[0]);
  311.    }
  312.  
  313. /* Add some children to the Cabinet */
  314.    ITRACE_DEVELOP("Constructing Cabinet child objects");
  315.    for (s=1; s<sObjCount; s++)
  316.    {
  317.      strText = IString(s) + strName;
  318.  
  319.      /* construct the Cabinet Customer */
  320.      hptrCabinet  = reslib.loadIcon(ICON_CABINET);
  321.      CabinetList[s] = new Customer(strText,hptrCabinet);
  322.  
  323.      /* Add the Name, Address, and Phone  */
  324.      CabinetList[s]->setCustomerName(strText);
  325.      strText = IString(s) + strAddress;
  326.      CabinetList[s]->setCustomerAddress(strText);
  327.      strText = IString(s) + strPhone;
  328.      CabinetList[s]->setCustomerPhone(strText);
  329.      CabinetList[s]->setCustomerAge(20+s);
  330.      CabinetList[0]->setOrderDate(IDate::today());
  331.      CabinetList[0]->setOrderTime(ITime::now());
  332.  
  333.      /* add the object to the container            */
  334.      cnrctl.addObject(CabinetList[s], CabinetList[0]);
  335.    }
  336.  
  337. /* Add some children to the Inbasket */
  338.    ITRACE_DEVELOP("Constructing Inbasket child objects");
  339.    for (s=1; s<sObjCount; s++)
  340.    {
  341.      strText = IString(s) + strName;
  342.  
  343.      /* construct the Inbasket Customer */
  344.      hptrInBasket = reslib.loadIcon(ICON_INBASKET);
  345.      InBasketList[s] = new Customer(strText,hptrInBasket);
  346.  
  347.      /* Add the Name, Address, and Phone  */
  348.      InBasketList[s]->setCustomerName(strText);
  349.      strText = IString(s) + strAddress;
  350.      InBasketList[s]->setCustomerAddress(strText);
  351.      strText = IString(s) + strPhone;
  352.      InBasketList[s]->setCustomerPhone(strText);
  353.      InBasketList[s]->setCustomerAge(30+s);
  354.      InBasketList[0]->setOrderDate(IDate::today());
  355.      InBasketList[0]->setOrderTime(ITime::now());
  356.  
  357.      /* add the object to the container            */
  358.      cnrctl.addObject(InBasketList[s], InBasketList[0]);
  359.    }
  360.  
  361. /* Add some children to the Shredder */
  362.    ITRACE_DEVELOP("Constructing Shredder child objects");
  363.    for (s=1; s<sObjCount; s++)
  364.    {
  365.      strText = IString(s) + strName;
  366.  
  367.      /* construct the Shredder Customer */
  368.      hptrShredder = reslib.loadIcon(ICON_SHREDDER);
  369.      ShredderList[s] = new Customer(strText,hptrShredder);
  370.  
  371.      /* Add the Name, Address, and Phone  */
  372.      ShredderList[s]->setCustomerName(strText);
  373.      strText = IString(s) + strAddress;
  374.      ShredderList[s]->setCustomerAddress(strText);
  375.      strText = IString(s) + strPhone;
  376.      ShredderList[s]->setCustomerPhone(strText);
  377.      ShredderList[s]->setCustomerAge(40+s);
  378.      ShredderList[0]->setOrderDate(IDate::today());
  379.      ShredderList[0]->setOrderTime(ITime::now());
  380.  
  381.  
  382.      /* add the object to the container            */
  383.      cnrctl.addObject(ShredderList[s], ShredderList[0]);
  384.    }
  385.  
  386.    /* Test Dropping on an Object */
  387.    ITRACE_DEVELOP("Constructing Drop Tester");
  388.    Customer* DropTester = new Customer("Drop Tester",
  389.                                        reslib.loadIcon(ICON_SHREDDER));
  390. //   DropTester->enableDrop();
  391.    DropTester->setCustomerName("Drop Gobler");
  392.    DropTester->setCustomerAddress("1");
  393.    DropTester->setCustomerPhone("2");
  394.    DropTester->setCustomerAge(50);
  395.    cnrctl.addObject(DropTester);
  396.  
  397. };
  398.  
  399.  
  400. void Customer :: handleOpen(IContainerControl* pcnrctl)
  401. {
  402.    IMODTRACE_DEVELOP("Cust::open");
  403.   /* Construct a Child Iterator */
  404.   IContainerControl::ObjectCursor iter(*pcnrctl, this);
  405.   Customer* pcust;
  406.   pcust = (Customer*)iter.first();
  407.  
  408.   /* If any children open a container on the children */
  409.   if (pcust!=0L)
  410.   {
  411.  
  412.      ITRACE_DEVELOP("Building Child Container");
  413.      CustomerList* pcnr2 = new CustomerList(IRectangle(0,0,0,0), FALSE);
  414.  
  415.      pcnr2->container().setContainerTitle("Customer Child Records");
  416.  
  417.      while(pcust!=0L)
  418.      {
  419.         pcnr2->container().addObject(pcust);
  420.         pcust = (Customer*)iter.next();
  421.      }
  422.  
  423.      pcnr2->container().arrangeIconView();
  424.      pcnr2->container().showTreeLine();
  425.      pcnr2->container().showContainerTitle();
  426.      pcnr2->container().showDetailsView();
  427.      pcnr2->show();
  428.   }
  429.   /* ensure we get marked as "open" */
  430.   IContainerObject::setOpen();
  431. }
  432.  
  433. /*--------------------------------------------------------*/
  434. /* Customer object constructor.                           */
  435. /*--------------------------------------------------------*/
  436. Customer :: Customer(const IString& strName, const IPointerHandle& hptrIcon,
  437.                       const IString& strAddress,
  438.                       const IString& strPhone, unsigned long ulAge)
  439.              : IContainerObject(strName, hptrIcon),
  440.                strCustomerName(strName),
  441.                strCustomerAddress(strAddress),
  442.                strCustomerPhone(strPhone),
  443.                ulCustomerAge(ulAge),
  444.                strOrderDate(),
  445.                strOrderTime()
  446. {
  447.    IMODTRACE_DEVELOP("Cust::Cust");
  448. }
  449.  
  450.  
  451. /*--------------------------------------------------------*/
  452. /* Customer object copy constructor.                      */
  453. /*--------------------------------------------------------*/
  454. Customer ::  Customer(Customer& custOld) : IContainerObject(custOld),
  455.                strCustomerName(custOld.customerName()),
  456.                strCustomerAddress(custOld.customerAddress()),
  457.                strCustomerPhone(custOld.customerPhone()),
  458.                ulCustomerAge(custOld.ulCustomerAge)
  459. {
  460.     IMODTRACE_DEVELOP("Cust::Cust(&)");
  461. }
  462.  
  463. /*--------------------------------------------------------*/
  464. /* Return a copy of an object.                            */
  465. /*--------------------------------------------------------*/
  466. IContainerObject* Customer ::  objectCopy()
  467. {
  468.    /* invoke Customer :: Customer(Customer&) to do copy */
  469.    Customer* pcustCopy = new Customer(*this);
  470.    return (IContainerObject*)pcustCopy;
  471. }
  472.  
  473.  
  474. /*--------------------------------------------------------*/
  475. /* CustomerList object destructor.                        */
  476. /*--------------------------------------------------------*/
  477. Customer ::  ~Customer()
  478. {
  479.    IMODTRACE_DEVELOP("Cust::~Cust");
  480. }
  481.  
  482. void Customer :: setOrderDate(const IDate& date)
  483. {
  484. #if 0
  485.   cdateOrder.day = date.dayOfMonth();
  486.   cdateOrder.month = date.monthOfYear();
  487.   cdateOrder.year = date.year();
  488. #else
  489.   strOrderDate = date.asString();
  490. #endif
  491.  
  492. }
  493.  
  494. void Customer :: setOrderTime(const ITime& time)
  495. {
  496. #if 0
  497.   ctimeOrder.hours = time.hours();
  498.   ctimeOrder.minutes = time.minutes();
  499.   ctimeOrder.seconds = time.seconds();
  500. #else
  501.   strOrderTime = time.asString();
  502. #endif
  503. }
  504.  
  505.  
  506.  
  507.  
  508.  
  509. /**********************************************************/
  510. /* Process commands from the Window (MenuItems)           */
  511. /**********************************************************/
  512. Boolean CustomerList::command(ICommandEvent& cmdevt)
  513. {
  514.    IMODTRACE_DEVELOP("CustList::command");
  515.  
  516.    static IContainerControl::ObjectCursor iter(container());
  517.    static Customer* pcustSave;
  518.  
  519.  
  520.    ITRACE_DEVELOP(IString("Command Id is ")+IString(cmdevt.commandId()));
  521.  
  522.    switch(cmdevt.commandId())
  523.    {
  524.       /*--------------------------------------*/
  525.       /* View Menu                            */
  526.       /*--------------------------------------*/
  527.        case CNR_VIEW_TEXT:
  528.           container().showTextView();
  529.           break;
  530.  
  531.        case CNR_VIEW_FLOWED_TEXT:
  532.           container().showFlowedTextView();
  533.           break;
  534.  
  535.        case CNR_VIEW_NAME:
  536.           container().showNameView();
  537.           break;
  538.  
  539.        case CNR_VIEW_FLOWED_NAME:
  540.           container().showFlowedNameView();
  541.           break;
  542.  
  543.        case CNR_VIEW_ICON:
  544.           container().showIconView();
  545.           break;
  546.  
  547.        case CNR_VIEW_DETAIL:
  548.           container().showDetailsView();
  549.           break;
  550.  
  551.        case CNR_VIEW_TREE_ICON:
  552.           container().showTreeIconView();
  553.           break;
  554.  
  555.        case CNR_VIEW_TREE_TEXT:
  556.           container().showTreeTextView();
  557.           break;
  558.  
  559.        case CNR_VIEW_TREE_NAME:
  560.           container().showTreeNameView();
  561.           break;
  562.  
  563.       /*--------------------------------------*/
  564.       /* View - Sort SubMenu                  */
  565.       /*--------------------------------------*/
  566.        case CNR_SORT_BYCUSTOMER:
  567.           container().setSortFunction((ICOMPOBJCALLBACK*)pfncompName);
  568.           container().sort();
  569.           break;
  570.  
  571.        case CNR_SORT_BYADDRESS:
  572.           container().setSortFunction((ICOMPOBJCALLBACK*)pfncompAddress);
  573.           container().sort();
  574.           break;
  575.  
  576.        case CNR_SORT_BYPHONE:
  577.           container().setSortFunction((ICOMPOBJCALLBACK*)pfncompPhone);
  578.           container().sort();
  579.           break;
  580.  
  581.        case CNR_SORT_BYAGE:
  582.           container().setSortFunction((ICOMPOBJCALLBACK*)pfncompAge);
  583.           container().sort();
  584.           break;
  585.  
  586.        case CNR_ARRANGE_ICONVIEW:
  587.           container().arrangeIconView();
  588.           break;
  589.  
  590.       /*--------------------------------------*/
  591.       /* View - Include SubMenu               */
  592.       /*--------------------------------------*/
  593.        case CNR_INCLUDE_A_K :
  594.        {
  595.           container().setFilterFunction((IFILTEROBJCALLBACK*)pfnfilterA_K);
  596.           container().filter();
  597.           break;
  598.        }
  599.  
  600.        case CNR_INCLUDE_L_Z :
  601.        {
  602.           container().setFilterFunction((IFILTEROBJCALLBACK*)pfnfilterL_Z);
  603.           container().filter();
  604.           break;
  605.        }
  606.  
  607.        case CNR_INCLUDE_OVER_30 :
  608.        {
  609.           container().setFilterFunction((IFILTEROBJCALLBACK*)pfnfilterOver30);
  610.           container().filter();
  611.           break;
  612.        }
  613.  
  614.        case CNR_INCLUDE_ALL :
  615.        {
  616.           container().setFilterFunction((IFILTEROBJCALLBACK*)0);
  617.           container().filter();
  618.           break;
  619.        }
  620.  
  621.       /*--------------------------------------*/
  622.       /* Edit Menu                            */
  623.       /*--------------------------------------*/
  624.       /* Note: copy just keeps a pointer to the object around */
  625.        case CNR_COPY_CURSOR:
  626.        {
  627.           pcustSave = (Customer*)container().cursoredObject();
  628.           break;
  629.        }
  630.  
  631.        case CNR_COPY_MARKS:
  632.        {  /* Note: iterating through a collection while adding */
  633.           /* objects is dangerous business.  Be sure you know  */
  634.           /* what you are doing. Here we iterate from the end  */
  635.           /* while adding new things to the end so we don't see*/
  636.           /* them twice.                                       */
  637.           IContainerControl::ObjectCursor cnrcursor(container(), IContainerObject::selected);
  638.           Customer* pcust = (Customer*)cnrcursor.last();
  639.           Customer* pcustCopy;
  640.  
  641.           while(pcust)
  642.           {
  643.              pcustCopy = new Customer(*pcust);
  644.              pcustCopy->setRefreshOff();
  645.              container().addObject(pcustCopy);
  646.              pcust = (Customer*)cnrcursor.previous();
  647.           }
  648.           container().refresh();
  649.           break;
  650.        }
  651.  
  652.        case CNR_DELETE_CURSOR:
  653.        {
  654.           Customer* pcust = (Customer*)container().cursoredObject();
  655.           delete pcust;
  656.           break;
  657.        }
  658.  
  659.        case CNR_DELETE_MARKS:
  660.        {
  661.           container().deleteSelectedObjects();
  662.           break;
  663.        }
  664.  
  665.        case CNR_DELETE_ALL_OBJECTS:
  666.        {
  667.           container().deleteAllObjects();
  668.           break;
  669.        }
  670.  
  671.        case CNR_CREATE_AT_CURSOR:
  672.        {
  673.           Customer* pcust = new Customer("Added Object",
  674.                            ICON_INBASKET);
  675.           pcust->setCustomerName("Added Shredder");
  676.           pcust->setCustomerAddress("34 Address");
  677.           pcust->setCustomerPhone("361-5512");
  678.           Customer* pcustCurrent = (Customer*)container().cursoredObject();
  679.           container().addObjectAfter(pcust, pcustCurrent);
  680.           break;
  681.        }
  682.  
  683.        case CNR_CREATE_AS_CHILD:
  684.        {
  685.           Customer* pcustCurrent = (Customer*)container().cursoredObject();
  686.           Customer* pcust = new Customer("Added Child Object",
  687.                                       ICON_INBASKET);
  688.           pcust->setCustomerName("Added Shredder");
  689.           pcust->setCustomerAddress("34 Address");
  690.           pcust->setCustomerPhone("361-5512");
  691.           container().addObject(pcust, pcustCurrent);
  692.           break;
  693.        }
  694.  
  695.        case CNR_CUT_OBJECT:
  696.        {
  697.           Customer* pcust = (Customer*)container().cursoredObject();
  698.           pcustSave = pcust;
  699.           delete pcust;
  700.           break;
  701.        }
  702.  
  703.        case CNR_PASTE_AT_CURSOR:
  704.        {
  705.           Customer* pcust = (Customer*)container().cursoredObject();
  706.           if(pcustSave && pcust)
  707.           {
  708.              Customer* pcustNew = new Customer(*pcustSave);
  709.              container().addObjectAfter(pcustNew,pcust);
  710.           }
  711.           break;
  712.        }
  713.  
  714.        case CNR_PASTE_AS_CHILD: /*  Add a copy as child of current */
  715.        {
  716.            Customer* pcust = (Customer*)container().cursoredObject();
  717.            if(pcustSave && pcust)
  718.            {
  719.              container().copyObjectTo(pcust, pcustSave);
  720. //              Customer* pcustNew = new Customer(*pcustSave);
  721. //              container().addObject(pcustNew,pcust);
  722.            }
  723.            break;
  724.        }
  725.  
  726.        case CNR_REMOVE_CURSOR:
  727.        {
  728.           Customer* pcust = (Customer*)container().cursoredObject();
  729.           if(pcust!=0)
  730.              container().removeObject(pcust);
  731.           break;
  732.        }
  733.  
  734.        case CNR_REMOVE_MARKS:
  735.        {
  736.           container().removeSelectedObjects();
  737.           break;
  738.        }
  739.  
  740.        case CNR_REMOVE_ALL:
  741.        {
  742.           container().removeAllObjects();
  743.           break;
  744.        }
  745. #if 1
  746.        case CNR_SELECT_ALL:
  747.        {
  748.           break;
  749.        }
  750.  
  751.        case CNR_DESELECT_ALL:
  752.        {
  753.           break;
  754.        }
  755. #endif
  756.       /*--------------------------------------*/
  757.       /* Attribute Menu - Column SubMenu      */
  758.       /*--------------------------------------*/
  759.        case CNR_SHOW_COL_2:
  760.        {
  761.           unsigned long ul = 1;
  762.           IContainerColumn* pcnrcol = container().columnAt(ul);
  763.           if(pcnrcol!=0)
  764.              pcnrcol->show();
  765.           break;
  766.        }
  767.  
  768.        case CNR_HIDE_COL_2:
  769.        {
  770.           IContainerColumn* pcnrcol = container().columnAt(1);
  771.           if(pcnrcol!=0)
  772.              pcnrcol->hide();
  773.           break;
  774.        }
  775.  
  776.        case CNR_MOVE_COL_2TOLAST:
  777.        {
  778.           IContainerColumn* pcnrcol = container().columnAt(1);
  779.           IContainerColumn* pcnrcol3 = container().columnAt(3);
  780.           container().removeColumn(pcnrcol);
  781.           container().addColumn(pcnrcol, pcnrcol3);
  782.           container().setDetailsViewSplit(pcnrcol);
  783.           break;
  784.        }
  785.  
  786.        case CNR_INCREASE_WIDTH_COL2:
  787.        {
  788.           IContainerColumn* pcnrcol = container().columnAt(1);
  789.           if(pcnrcol->displayWidth() == 0)
  790.              pcnrcol->setDisplayWidth(40);
  791.           else
  792.              pcnrcol->setDisplayWidth(pcnrcol->displayWidth() + 10);
  793.           break;
  794.        }
  795.  
  796.        case CNR_DECREASE_WIDTH_COL2:
  797.        {
  798.           IContainerColumn* pcnrcol = container().columnAt(1);
  799.           if(pcnrcol->displayWidth() == 0)
  800.              pcnrcol->setDisplayWidth(30);
  801.           else
  802.              pcnrcol->setDisplayWidth(pcnrcol->displayWidth() - 10);
  803.           break;
  804.        }
  805.  
  806.       /*--------------------------------------*/
  807.       /* Attribute Menu - Container Sub-Menu  */
  808.       /*--------------------------------------*/
  809.        case CNR_INCREMENT_LINESPACING:
  810.        {
  811.           container().setLineSpacing(container().lineSpacing() + 5);
  812.           break;
  813.        }
  814.  
  815.        case CNR_DECREMENT_LINESPACING:
  816.        {
  817.           container().setLineSpacing(container().lineSpacing() - 5);
  818.           break;
  819.        }
  820.  
  821.        case CNR_ORDEREDTARGET:
  822.        {
  823.           container().setOrderedTargetEmphasis();
  824.           break;
  825.        }
  826.  
  827.        case CNR_MIXEDTARGET:
  828.        {
  829.           container().setMixedTargetEmphasis();
  830.           break;
  831.        }
  832.  
  833.        case CNR_NORMALTARGET:
  834.        {
  835.           container().setNormalTargetEmphasis();
  836.           break;
  837.        }
  838.  
  839.        case CNR_SINGLESELECT:
  840.        {
  841.           container().setSingleSelection();
  842.           break;
  843.        }
  844.  
  845.        case CNR_MULTIPLESELECT:
  846.        {
  847.           container().setMultipleSelection();
  848.           break;
  849.        }
  850.  
  851.        case CNR_EXTENDEDSELECT:
  852.        {
  853.           container().setExtendedSelection();
  854.           break;
  855.        }
  856.  
  857.       /*--------------------------------------*/
  858.       /* Attribute Menu - Object Sub-Menu     */
  859.       /*--------------------------------------*/
  860.        case CNR_ENABLE_DROP_ALL:
  861.        {
  862.           Customer* pcust = (Customer*)container().cursoredObject();
  863.           if(pcust)
  864.              pcust->enableDrop();
  865.           break;
  866.        }
  867.  
  868.        case CNR_ENABLE_DROP_ONE:
  869.        {
  870.           Customer* pcust = (Customer*)container().cursoredObject();
  871.           if(pcust)
  872.              container().enableDrop(pcust);
  873.           break;
  874.        }
  875.  
  876.        case CNR_DISABLE_DROP_ALL:
  877.        {
  878.           Customer* pcust = (Customer*)container().cursoredObject();
  879.           if(pcust)
  880.             pcust->disableDrop();
  881.           break;
  882.        }
  883.  
  884.        case CNR_DISABLE_DROP_ONE:
  885.        {
  886.           Customer* pcust = (Customer*)container().cursoredObject();
  887.           if(pcust)
  888.             container().disableDrop(pcust);
  889.           break;
  890.        }
  891.  
  892.        case CNR_ENABLE_OBJECTUPDATE_ALL:
  893.        {
  894.           Customer* pcust = (Customer*)container().cursoredObject();
  895.           if(pcust)
  896.              pcust->enableDataUpdate();
  897.           break;
  898.        }
  899.  
  900.        case CNR_ENABLE_OBJECTUPDATE_ONE:
  901.        {
  902.           Customer* pcust = (Customer*)container().cursoredObject();
  903.           if(pcust)
  904.              container().enableDataUpdate(pcust);
  905.           break;
  906.        }
  907.  
  908.        case CNR_DISABLE_OBJECTUPDATE_ALL:
  909.        {
  910.           Customer* pcust = (Customer*)container().cursoredObject();
  911.           if(pcust)
  912.              pcust->disableDataUpdate();
  913.           break;
  914.        }
  915.  
  916.        case CNR_DISABLE_OBJECTUPDATE_ONE:
  917.        {
  918.           Customer* pcust = (Customer*)container().cursoredObject();
  919.           if(pcust)
  920.              container().disableDataUpdate(pcust);
  921.           break;
  922.        }
  923.  
  924.        case CNR_SET_INUSE_ALL:
  925.        {
  926.           Customer* pcust = (Customer*)container().cursoredObject();
  927.           if(pcust!=0)
  928.              pcust->setInUse();
  929.           break;
  930.        }
  931.  
  932.        case CNR_SET_INUSE_ONE:
  933.        {
  934.           Customer* pcust = (Customer*)container().cursoredObject();
  935.           if(pcust!=0)
  936.              container().setInUse(pcust);
  937.           break;
  938.        }
  939.  
  940.        case CNR_REMOVE_INUSE_ALL:
  941.        {
  942.           Customer* pcust = (Customer*)container().cursoredObject();
  943.           if(pcust!=0)
  944.              pcust->removeInUse();
  945.           break;
  946.        }
  947.  
  948.        case CNR_REMOVE_INUSE_ONE:
  949.        {
  950.           Customer* pcust = (Customer*)container().cursoredObject();
  951.           if(pcust!=0)
  952.              container().removeInUse(pcust);
  953.           break;
  954.        }
  955.  
  956.        case CNR_SELECT:
  957.        {
  958.           Customer* pcust = (Customer*)container().cursoredObject();
  959.           if(pcust!=0)
  960.              container().setSelected(pcust);
  961.           break;
  962.        }
  963.  
  964.        case CNR_DESELECT:
  965.        {
  966.           Customer* pcust = (Customer*)container().cursoredObject();
  967.           if(pcust!=0)
  968.              container().removeSelected(pcust);
  969.           break;
  970.        }
  971.  
  972.        case CNR_EXPAND_CURRENT:
  973.        {
  974.           Customer* pcust = (Customer*)container().cursoredObject();
  975.           if(pcust!=0)
  976.              container().expand(pcust);
  977.           break;
  978.        }
  979.  
  980.        case CNR_COLLAPSE_CURRENT:
  981.        {
  982.           Customer* pcust = (Customer*)container().cursoredObject();
  983.           if(pcust!=0)
  984.              container().collapse(pcust);
  985.           break;
  986.        }
  987.  
  988.        case CNR_INCREMENT_ICONSIZE:
  989.        {
  990.           ISize siz = container().iconSize();
  991.           container().setIconSize(siz + ISize(5,5));
  992.           break;
  993.        }
  994.  
  995.        case CNR_DECREMENT_ICONSIZE:
  996.        {
  997.           ISize siz = container().iconSize();
  998.           container().setIconSize(siz - ISize(5,5));
  999.           break;
  1000.        }
  1001.  
  1002.       /*------------------------------------------*/
  1003.       /* Attribute Menu - Object Status Sub-Menu  */
  1004.       /*------------------------------------------*/
  1005.        case CNR_IS_DROP_ENABLED_ALL:
  1006.        {
  1007.           Customer* pcust = (Customer*)container().cursoredObject();
  1008.           if (pcust->isDropOnAble())
  1009.              statusArea().setText("Cursor Object is droponable in all containers");
  1010.           else
  1011.              statusArea().setText("Cursor Object is Not droponable in all containers");
  1012.           break;
  1013.        }
  1014.  
  1015.        case CNR_IS_DROP_ENABLED_ONE:
  1016.        {
  1017.           Customer* pcust = (Customer*)container().cursoredObject();
  1018.           if (container().isDropOnAble(pcust))
  1019.              statusArea().setText("Cursor Object is droponable in this containers");
  1020.           else
  1021.              statusArea().setText("Cursor Object is Not droponable in this containers");
  1022.           break;
  1023.        }
  1024.  
  1025.        case CNR_IS_READONLY_ALL:
  1026.        {
  1027.           Customer* pcust = (Customer*)container().cursoredObject();
  1028.           if (pcust->isReadOnly())
  1029.              statusArea().setText("Cursor Object is readonly in all containers.");
  1030.           else
  1031.              statusArea().setText("Cursor Object is editable in all containers.");
  1032.           break;
  1033.        }
  1034.  
  1035.        case CNR_IS_READONLY_ONE:
  1036.        {
  1037.           Customer* pcust = (Customer*)container().cursoredObject();
  1038.           if (container().isReadOnly(pcust))
  1039.              statusArea().setText("Cursor Object is readonly in this containers.");
  1040.           else
  1041.              statusArea().setText("Cursor Object is editable in this containers.");
  1042.           break;
  1043.        }
  1044.  
  1045.        case CNR_IS_INUSE_ALL:
  1046.        {
  1047.           Customer* pcust = (Customer*)container().cursoredObject();
  1048.           if (pcust->isInUse())
  1049.              statusArea().setText("Cursor Object is in-use in all containers.");
  1050.           else
  1051.              statusArea().setText("Cursor Object is not in-use in all containers.");
  1052.           break;
  1053.        }
  1054.  
  1055.        case CNR_IS_INUSE_ONE:
  1056.        {
  1057.           Customer* pcust = (Customer*)container().cursoredObject();
  1058.           if (container().isInUse(pcust))
  1059.              statusArea().setText("Cursor Object is in-use in this containers.");
  1060.           else
  1061.              statusArea().setText("Cursor Object is not in-use in this containers.");
  1062.           break;
  1063.        }
  1064.  
  1065.        case CNR_IS_SELECTED:
  1066.        {
  1067.           Customer* pcust = (Customer*)container().cursoredObject();
  1068.           if (container().isSelected(pcust))
  1069.              statusArea().setText("Cursor Object is selected.");
  1070.           else
  1071.              statusArea().setText("Cursor Object is not selected.");
  1072.           break;
  1073.        }
  1074.  
  1075.        case CNR_IS_EXPANDED:
  1076.        {
  1077.           Customer* pcust = (Customer*)container().cursoredObject();
  1078.           if (container().isExpanded(pcust))
  1079.              statusArea().setText("Cursor Object is expanded.");
  1080.           else
  1081.              statusArea().setText("Cursor Object is not expanded.");
  1082.           break;
  1083.        }
  1084.  
  1085.       /*------------------------------------------*/
  1086.       /* Attribute Menu - Title Sub-Menu          */
  1087.       /*------------------------------------------*/
  1088.        case CNR_SHOW_CONTAINERTITLE:
  1089.        {
  1090.           container().showContainerTitle();
  1091.           break;
  1092.        }
  1093.  
  1094.        case CNR_HIDE_CONTAINERTITLE:
  1095.        {
  1096.           container().hideContainerTitle();
  1097.           break;
  1098.        }
  1099.  
  1100.        case CNR_CONTAINERTITLE_VISIBLE:
  1101.        {
  1102.           if (container().isContainerTitleVisible())
  1103.              statusArea().setText("Title is visible.");
  1104.           else
  1105.              statusArea().setText("Title is not visible.");
  1106.           break;
  1107.        }
  1108.  
  1109.        case CNR_ENABLE_TITLEUPDATE:
  1110.        {
  1111.           container().enableTitleUpdate();
  1112.           break;
  1113.        }
  1114.  
  1115.        case CNR_DISABLE_TITLEUPDATE:
  1116.        {
  1117.           container().disableTitleUpdate();
  1118.           break;
  1119.        }
  1120.  
  1121.        case CNR_SHOW_TITLESEPARATOR:
  1122.        {
  1123.           container().showTitleSeparator();
  1124.           break;
  1125.        }
  1126.  
  1127.        case CNR_HIDE_TITLESEPARATOR:
  1128.        {
  1129.           container().hideTitleSeparator();
  1130.           break;
  1131.        }
  1132.  
  1133.       /*------------------------------------------*/
  1134.       /* Attribute Menu - TreeView Sub-Menu       */
  1135.       /*------------------------------------------*/
  1136.        case CNR_SHOW_TREELINE:
  1137.        {
  1138.           container().showTreeLine();
  1139.           break;
  1140.        }
  1141.  
  1142.        case CNR_HIDE_TREELINE:
  1143.        {
  1144.           container().hideTreeLine();
  1145.           break;
  1146.        }
  1147.        case CNR_INCREMENT_EXPANDICON:
  1148.        {
  1149.           ISize siz = container().iconSize();
  1150.           container().setTreeExpandIconSize(siz + ISize(2,2));
  1151.           break;
  1152.        }
  1153.  
  1154.        case CNR_DECREMENT_EXPANDICON:
  1155.        {
  1156.           ISize siz = container().iconSize();
  1157.           container().setTreeExpandIconSize(siz - ISize(2,2));
  1158.           break;
  1159.        }
  1160.  
  1161.        case CNR_EXPAND:
  1162.        {
  1163.           container().expandTree();
  1164.           break;
  1165.        }
  1166.  
  1167.        case CNR_COLLAPSE:
  1168.        {
  1169.           container().collapseTree();
  1170.           break;
  1171.        }
  1172.  
  1173.       /*------------------------------------------*/
  1174.       /* Attribute Menu - DetailsView Sub-Menu    */
  1175.       /*------------------------------------------*/
  1176.        case CNR_SHOW_DETAILSTITLE:
  1177.        {
  1178.           container().showDetailsViewTitles();
  1179.           break;
  1180.        }
  1181.  
  1182.        case CNR_HIDE_DETAILSTITLE:
  1183.        {
  1184.           container().hideDetailsViewTitles();
  1185.           break;
  1186.        }
  1187.  
  1188.  
  1189.        case CNR_SHOW_SPLITBAR:
  1190.        {
  1191.           container().showSplitBar();
  1192.           break;
  1193.        }
  1194.  
  1195.        case CNR_HIDE_SPLITBAR:
  1196.        {
  1197.           container().hideSplitBar();
  1198.           break;
  1199.        }
  1200.  
  1201.  
  1202.       /*------------------------------------------*/
  1203.       /* Move Menu                                */
  1204.       /*------------------------------------------*/
  1205.        case CNR_MOVE_ICON_RIGHT:
  1206.        {
  1207.           Customer* pcust = (Customer*)container().cursoredObject();
  1208.           IPoint pt = container().iconRectangle(pcust).bottomLeft();
  1209.           container().moveIconTo(pcust, pt + IPoint(5,0));
  1210.           break;
  1211.        }
  1212.        case CNR_MOVE_ICON_LEFT:
  1213.        {
  1214.           Customer* pcust = (Customer*)container().cursoredObject();
  1215.           IPoint pt = container().iconRectangle(pcust).bottomLeft();
  1216.           container().moveIconTo(pcust, pt + IPoint(-5,0));
  1217.           break;
  1218.        }
  1219.        case CNR_MOVE_ICON_UP:
  1220.        {
  1221.           Customer* pcust = (Customer*)container().cursoredObject();
  1222.           IPoint pt = container().iconRectangle(pcust).bottomLeft();
  1223.           pt += IPoint(0,5);
  1224.           container().moveIconTo(pcust, pt );
  1225.           break;
  1226.        }
  1227.        case CNR_MOVE_ICON_DOWN:
  1228.        {
  1229.           Customer* pcust = (Customer*)container().cursoredObject();
  1230.           IPoint pt = container().iconRectangle(pcust).bottomLeft();
  1231.           container().moveIconTo(pcust, pt + IPoint(0,-5));
  1232.           break;
  1233.        }
  1234.        case CNR_MOVE_CURSORED_TOVIEW:
  1235.        {
  1236.           IMODTRACE_DEVELOP("To View");
  1237.           Customer* pcust = (Customer*)container().cursoredObject();
  1238.           container().scrollToObject(pcust);
  1239.           break;
  1240.        }
  1241.        case CNR_MOVE_CURSORED_TOPRIGHT:
  1242.        {
  1243.           IMODTRACE_DEVELOP("Top Right");
  1244.           Customer* pcust = (Customer*)container().cursoredObject();
  1245.           IRectangle rectIcon = container().iconRectangle(pcust);
  1246.           IRectangle rectClient = container().rect();
  1247.           ISize siz = ISize(rectClient.topRight()-rectIcon.topRight());
  1248.           ITRACE_DEVELOP(IString("Size is ")+IString(siz.sizeX())+IString(",")+IString(siz.sizeY()));
  1249.           container().scroll(siz.sizeY(), siz.sizeX());
  1250.           break;
  1251.        }
  1252.        case CNR_MOVE_CURSORED_TOPLEFT:
  1253.        {
  1254.           IMODTRACE_DEVELOP("Top Left");
  1255.           Customer* pcust = (Customer*)container().cursoredObject();
  1256.           IRectangle rectIcon = container().iconRectangle(pcust);
  1257.           IRectangle rectClient = container().rect();
  1258.           ISize siz = ISize(rectClient.topLeft()-rectIcon.topLeft());
  1259.           ITRACE_DEVELOP(IString("Size is ")+IString(siz.sizeX())+IString(",")+IString(siz.sizeY()));
  1260.           container().scroll(siz.sizeY(), siz.sizeX());
  1261.           break;
  1262.        }
  1263.        case CNR_MOVE_CURSORED_BOTRIGHT:
  1264.        {
  1265.           IMODTRACE_DEVELOP("Bottom Right");
  1266.           Customer* pcust = (Customer*)container().cursoredObject();
  1267.           IRectangle rectIcon = container().iconRectangle(pcust);
  1268.           IRectangle rectClient = container().rect();
  1269.           ISize siz = ISize(rectClient.bottomRight()-rectIcon.bottomRight());
  1270.           ITRACE_DEVELOP(IString("Size is ")+IString(siz.sizeX())+IString(",")+IString(siz.sizeY()));
  1271.           container().scroll(siz.sizeY(), siz.sizeX());
  1272.           break;
  1273.        }
  1274.        case CNR_MOVE_CURSORED_BOTLEFT:
  1275.        {
  1276.           IMODTRACE_DEVELOP("Bottom Left");
  1277.           Customer* pcust = (Customer*)container().cursoredObject();
  1278.           IRectangle rectIcon = container().iconRectangle(pcust);
  1279.           IRectangle rectClient = container().rect();
  1280.           ISize siz = ISize(rectClient.bottomLeft()-rectIcon.bottomLeft());
  1281.           ITRACE_DEVELOP(IString("Size is ")+IString(siz.sizeX())+IString(",")+IString(siz.sizeY()));
  1282.           container().scroll(siz.sizeY(), siz.sizeX());
  1283.           break;
  1284.        }
  1285.        default :
  1286.           return false;
  1287.    }
  1288.   return true;
  1289. };
  1290.  
  1291.  
  1292. /*--------------------------------------------------------*/
  1293. /* Compare Customer names - for sorting.                  */
  1294. /*--------------------------------------------------------*/
  1295. long _System pfncompName(const Customer* p1,
  1296.                                const Customer* p2,
  1297.                                const IContainerControl* pcnrctl)
  1298. {
  1299.    return (pcnrctl->nlsCompare(p1->customerName(),
  1300.                                p2->customerName()));
  1301. };
  1302.  
  1303. /*--------------------------------------------------------*/
  1304. /* Compare Customer Address - for sorting.                */
  1305. /*--------------------------------------------------------*/
  1306. long _System pfncompAddress(const Customer* p1,
  1307.                                const Customer* p2,
  1308.                                const IContainerControl* pcnrctl)
  1309. {
  1310.    return (pcnrctl->nlsCompare(p1->customerAddress(),
  1311.                                p2->customerAddress()));
  1312. };
  1313.  
  1314. /*--------------------------------------------------------*/
  1315. /* Compare Customer Phone - for sorting.                  */
  1316. /*--------------------------------------------------------*/
  1317. long _System pfncompPhone(const Customer* p1,
  1318.                             const Customer* p2,
  1319.                             const IContainerControl* pcnrctl)
  1320. {
  1321.    return (pcnrctl->nlsCompare(p1->customerPhone(),
  1322.                                p2->customerPhone()));
  1323. };
  1324.  
  1325. /*--------------------------------------------------------*/
  1326. /* Compare Customer Age - for sorting.                    */
  1327. /*--------------------------------------------------------*/
  1328. long _System pfncompAge(const Customer* p1,
  1329.                           const Customer* p2,
  1330.                           const IContainerControl* pcnrctl)
  1331. {
  1332.    if(p1->customerAge() > p2->customerAge())
  1333.       return 1;
  1334.    else if(p1->customerAge() < p2->customerAge())
  1335.       return -1;
  1336.    else
  1337.       return 0;
  1338.  
  1339. };
  1340.  
  1341.  
  1342. /*--------------------------------------------------------*/
  1343. /* Filter Function - return TRUE for A-K                  */
  1344. /*--------------------------------------------------------*/
  1345. Boolean  _System pfnfilterA_K(const Customer* pcust,
  1346.                                const IContainerControl* pcnrctl)
  1347. {
  1348.    Boolean fKeep = (pcnrctl->nlsCompare(pcust->customerName(), "L") < 0);
  1349.    return fKeep;
  1350. }
  1351.  
  1352. /*--------------------------------------------------------*/
  1353. /* Filter Function - return TRUE for L-Z                  */
  1354. /*--------------------------------------------------------*/
  1355. Boolean  _System pfnfilterL_Z(const Customer* pcust,
  1356.                                const IContainerControl* pcnrctl)
  1357. {
  1358.    Boolean fKeep = (pcnrctl->nlsCompare(pcust->customerName(), "K") > 0);
  1359.    return fKeep;
  1360.  
  1361. }
  1362. /*--------------------------------------------------------*/
  1363. /* Filter Function - return TRUE for Age>30               */
  1364. /*--------------------------------------------------------*/
  1365. Boolean  _System pfnfilterOver30(const Customer* pcust,
  1366.                                   const IContainerControl* pcnrctl)
  1367. {
  1368.    Boolean fKeep = (pcust->customerAge() > 30);
  1369.    return fKeep;
  1370.  
  1371. }
  1372.  
  1373.