home *** CD-ROM | disk | FTP | other *** search
/ ActiveX Programming Unleashed CD / AXU.iso / componen / interact / demo / data.2 / samples / ansic / INTERACT / SETTEXT.C < prev    next >
Encoding:
C/C++ Source or Header  |  1996-03-04  |  3.8 KB  |  156 lines

  1. //lRegen_FileHeading
  2. //lRegen_FileHeading
  3.  
  4.      /********************************************************************
  5.       *
  6.       *   Source File:  settext.c
  7.       *   Author:
  8.       *   Module:
  9.       *   Program Desc:
  10.       *   Date:         Mon Feb 19 13:11:39 1996
  11.       *   Language:     ANSI C
  12.       *
  13.       ********************************************************************/
  14.  
  15. #include ".\idoiface.h"
  16.  
  17.  
  18. //lRegen_Variables
  19. //lRegen_Variables
  20.  
  21. VIEW     hViewsettext;
  22. HWND     hWndsettext;
  23. LRESULT CALLBACK EXPORT fnsettextWndProc(HWND, UINT, WPARAM, LPARAM);
  24.  
  25. int fnsettext(HWND hParentWnd, UINT iData, void FAR *lpData)
  26. {
  27.    int   ReturnCode;
  28.  
  29.    //lRegen_BeginFunction
  30.    ENTITY entity;
  31.  
  32.    if(!idoGetCurrentEntity(GetActiveIDO(), &entity))
  33.    {
  34.       // no current entity
  35.       return FALSE;
  36.    }
  37.    //lRegen_BeginFunction
  38.  
  39.    //lRegen_InitDlg
  40.    //lRegen_InitDlg
  41.  
  42.    if(NULL == (hViewsettext = vwCreateView(hInstance,
  43.                    MAKEINTRESOURCE(settext),
  44.                    hParentWnd,
  45.                    (VIEWPROC)fnsettextWndProc,
  46.                    NULL)))
  47.    {
  48.          //lRegen_Create
  49.          //lRegen_Create
  50.         return FALSE;
  51.    }
  52.    //lRegen_InitView
  53.    //lRegen_InitView
  54.    if((ReturnCode = vwShowModalView(hViewsettext)) == -1)
  55.    {
  56.         MessageBox(NULL, "Unable to display view", "System Error",
  57.                    MB_SYSTEMMODAL | MB_ICONHAND | MB_OK);
  58.         return FALSE;
  59.    }
  60.  
  61.    //lRegen_TermView
  62.    //lRegen_TermView
  63.    return(ReturnCode);
  64. }
  65.  
  66. LRESULT CALLBACK EXPORT fnsettextWndProc(HWND hWnd, UINT uMessage, WPARAM wParam, LPARAM lParam)
  67. {
  68. GETVIEW;
  69.    WORD CtlId;
  70.    WORD Notify;
  71.    HWND CtlWnd;
  72.  
  73.    //lRegen_WindowProcVariables
  74.  
  75.    char szText[100+1];
  76.    ENTITY entity;
  77.  
  78.    //lRegen_WindowProcVariables
  79.  
  80.    switch(uMessage)
  81.    {
  82.       //lRegen_WndProc
  83.       //lRegen_WndProc
  84.  
  85.       case WM_INITDIALOG :
  86.          //lRegen_InitDialogBegin
  87.          /*
  88.           *  Get text from the current entity.
  89.           */
  90.          if(idoGetCurrentEntity(GetActiveIDO(), &entity))
  91.          {
  92.             SetDlgItemText(hWnd, IDC_TEXT, idoEntityGetText(&entity));
  93.          }
  94.  
  95.          //lRegen_InitDialogBegin
  96.          //Regen_WM_InitDialog
  97.          //Regen_WM_InitDialog
  98.          return TRUE;
  99.  
  100.       case WM_COMMAND :
  101.       #ifdef WIN32
  102.          CtlId  = LOWORD(wParam);
  103.          Notify = HIWORD(wParam);
  104.          CtlWnd = (HWND)lParam;
  105.       #else
  106.          CtlId  = wParam;
  107.          Notify = HIWORD(lParam);
  108.          CtlWnd = (HWND)LOWORD(lParam);
  109.       #endif
  110.          switch(CtlId)
  111.          {
  112.             case IDC_TEXT :
  113.                //Regen_IDC_TEXT
  114.                //Regen_IDC_TEXT
  115.                break;
  116.  
  117.             case IDOK :
  118.                //Regen_IDOK
  119.                {
  120.                   GetDlgItemText(hWnd, IDC_TEXT, szText, 100);
  121.  
  122.                   /*
  123.                    *  Set text on the current entity.
  124.                    */
  125.                   if(idoGetCurrentEntity(GetActiveIDO(), &entity))
  126.                   {
  127.                      idoEntitySetText(&entity, szText);
  128.                      idoEntityRepaint(&entity);
  129. //                     InvalidateRect(GetActiveIDO(), NULL, FALSE);
  130. //                     UpdateWindow(GetActiveIDO());
  131.                   }
  132.                }
  133.                //Regen_IDOK
  134.                break;
  135.  
  136.             case IDCANCEL :
  137.                //Regen_IDCANCEL
  138.                //Regen_IDCANCEL
  139.                break;
  140.  
  141.             //lRegen_CustomCommand
  142.             //lRegen_CustomCommand
  143.             }
  144.             break;
  145.  
  146.       case WM_DESTROY :
  147.         //Regen_WM_Destroy
  148.         //Regen_WM_Destroy
  149.          break;
  150.    }
  151.    return DefViewProc(hWnd, uMessage, wParam, lParam);
  152. }
  153.  
  154. //Regen_CustomCode
  155. //Regen_CustomCode
  156.