home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #18 / NN_1992_18.iso / spool / comp / os / mswindo / programm / misc / 1434 < prev    next >
Encoding:
Internet Message Format  |  1992-08-21  |  2.2 KB

  1. Path: sparky!uunet!ogicse!plains!news.u.washington.edu!milton!bytor
  2. From: bytor@milton.u.washington.edu (Jill Patterson)
  3. Newsgroups: comp.os.ms-windows.programmer.misc
  4. Subject: Re: BC++ OWL TEdit Questions
  5. Message-ID: <bytor.714417962@milton>
  6. Date: 21 Aug 92 17:26:02 GMT
  7. Article-I.D.: milton.bytor.714417962
  8. References: <bytor.714343854@milton>
  9. Sender: news@u.washington.edu (USENET News System)
  10. Organization: University of Washington
  11. Lines: 71
  12.  
  13. bytor@milton.u.washington.edu (Jill Patterson) writes:
  14.  
  15. >  /* Cleanup */
  16. >  SelectObject(ps.hdc, hOldPen);
  17. >  DeleteObject(hDkGrayPen);
  18. >  DeleteObject(hBrFrame);
  19. >  EndPaint(HWindow, &ps);
  20.  
  21.    I have added the following two lines and it seems to work OK!
  22.  
  23.    // Get The Rectangle Just Inside The Frame
  24.    InflateRect(&rc, -1, -1);
  25.  
  26.    // Invalidate The Region
  27.    InvalidateRegion(ps.hdc, &rc, TRUE);
  28. n
  29. >}
  30.  
  31.  I now have another question.  How Do I get To change the foreground,
  32. and background colors of the edit control.  I have tried trapping the
  33. WM_CTLCOLOR Message in the the TMainWindow::WMCtlColor function but it
  34. doesn't seem to be working.  Here's My Code:
  35.  
  36. /*
  37. ** TMainWnd::WMCtlColor()
  38. */
  39. DWORD TMainWnd::WMCtlColor(RTMessage Msg)
  40. {
  41.   HDC    hDC;
  42.   WORD   wChildType;
  43.   WORD   wChildId;
  44.  
  45.   wChildType = HIWORD(Msg.LParam);
  46.   wChildId   = GetWindowWord(LOWORD(Msg.LParam), GWW_ID);
  47.  
  48.   UnrealizeObject(hBrushRed);
  49.   SetBrushOrg(LOWORD(Msg.LParam), 0, 0);
  50.  
  51.   switch(wChildType)
  52.   {
  53.     case CTLCOLOR_EDIT:
  54.       switch(wChildId)
  55.       {
  56.         case 101:
  57.           SetTextColor(Msg.WParam, RGB(255, 0, 0));
  58.           return (DWORD)hBrushRed;
  59.  
  60.         default:
  61.           SetTextColor(Msg.WParam, RGB(0, 0, 255));
  62.           return (DWORD)hBrushRed;
  63.       };
  64.  
  65.    default:
  66.       SetTextColor(Msg.WParam, RGB(0, 255, 0));
  67.       return (DWORD)hBrushRed;
  68.   };
  69. }
  70.  
  71. Does This Look Right, I use CreateSolidBrush in TMainWnd::Setup to create
  72. the hBrushRed, and I delete it at CloseWindow;
  73.  
  74. I don't get any compile errors, is the prototype correct?
  75.  
  76. DWORD TMainWnd::WMCtlColor(RTMessage Msg) = [WM_FIRST + WM_CTLCOLOR];
  77.  
  78. I know its getting there because I had message boxes in telling me
  79. where I was, and I also looked at it with the debugger.  Does anybody 
  80. have any sample code using OWL for this?????
  81.  
  82. THX
  83.     bytor@milton.u.washington.edu
  84.