home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #19 / NN_1992_19.iso / spool / comp / os / mswindo / programm / misc / 1641 < prev    next >
Encoding:
Text File  |  1992-09-02  |  3.1 KB  |  100 lines

  1. Newsgroups: comp.os.ms-windows.programmer.misc
  2. Path: sparky!uunet!world!yon
  3. From: yon@world.std.com (David A Yon)
  4. Subject: EnableKBHandler in TPW?  Help!
  5. Message-ID: <BtyA7F.E7w@world.std.com>
  6. Followup-To: comp.os.ms-windows.programmer.misc
  7. Organization: The World Public Access UNIX, Brookline, MA
  8. Date: Wed, 2 Sep 1992 12:18:50 GMT
  9. Lines: 89
  10.  
  11. I'm running TPW 1.5 under Win 3.1, and can't seem to get the
  12. ObjectWindows EnableKBHandler feature to work.  I've got a resizable
  13. window under MDI where I have two comboboxes, a single-line edit, and
  14. a multi-line edit control.  I've tried calling EnableKBHandler in both
  15. the Init and SetupWindow methods, all to no avail.  Anytime I hit
  16. <tab> in the window the computer just beeps.  I realize the that the
  17. multi-line edit is a wrench in the works, but I don't really care
  18. whether or not you can tab out of that control anyway.  I just want to
  19. be able to traverse the other controls.  Any help appreciated!
  20.  
  21. David Yon
  22. yon@world.std.com
  23.  
  24. The Init and SetupWindow methods follow.  Note that I am specifying
  25. ws_TabStop and ws_Group for the four controls that I want to traverse:
  26.  
  27.  
  28. {**
  29.  ** Init -- This method initializes each instance of the
  30.  **         TLetterEditor class.
  31.  **}
  32. constructor TLetterEditor.Init(AParent: PWindowsObject; 
  33.                  owner: PLetter);
  34. const
  35.     LineHeight = 30;
  36.  
  37. begin
  38.     TLetterWindow.Init(AParent,owner);
  39.     EnableKBHandler;
  40.     Contents^.Attr.Style := Contents^.Attr.Style and
  41.                 not (es_AutoHScroll or ws_HScroll);
  42.  
  43.     EnableTransfer;
  44.  
  45.     {--- Set up Controls ---}
  46.     with DestinationSize do
  47.         Destination := New(PComboBox, Init(@Self,
  48.                     id_LetterEditorDestination, X,Y,W,H,
  49.         cbs_DropDown or cbs_HasStrings or cbs_AutoHScroll, 81));
  50.     Destination^.Attr.Style := Destination^.Attr.Style or 
  51.                    ws_TabStop or ws_Group;
  52.     with InfoDestSize do
  53.         InfoDest := New(PComboBox, Init(@Self, 
  54.              id_LetterEditorServ,X,Y,W,H,
  55.                         cbs_DropDownList or cbs_HasStrings or cbs_AutoHScroll, 81));
  56.     InfoDest^.Attr.Style := InfoDest^.Attr.Style or 
  57.                 ws_TabStop or ws_Group;
  58.     with SubjectSize do
  59.         Subject := New(PEdit, Init(@Self, id_LetterEditorSubject,
  60.                '',X,Y,W,H, 40, False));
  61.     Subject^.Attr.Style := Subject^.Attr.Style or 
  62.                ws_TabStop or ws_Group;
  63. end;
  64.  
  65.  
  66. {**
  67.  ** SetupWindow -- This method installs widgets for the Lettor Editor;
  68.  **}
  69. procedure TLetterEditor.SetupWindow;
  70. var
  71.      Msg: TMessage;
  72. begin
  73.     EnableKBHandler;
  74.     Dirty := False;
  75.  
  76.     {--- Enable transferring of Data to and from the Destination,
  77.          Subject, and Contents ---}
  78.     Destination^.EnableTransfer;
  79.     InfoDest^.EnableTransfer;
  80.     Subject^.EnableTransfer;
  81.     TLetterWindow.SetupWindow;
  82.  
  83.     {--- Enable Soft Line-Breaks ---}
  84.     SendMessage(Contents^.HWindow,em_GetRect,0,Longint(@FmtRect));
  85.     with FmtRect do
  86.          begin
  87.          Left := 0; Top := 0;
  88.          end;
  89.     SendMessage(Contents^.HWindow,wm_SetFont,
  90.         GetStockObject(SYSTEM_FIXED_FONT),0);
  91.     SendMessage(Subject^.HWindow,wm_SetFont,
  92.         GetStockObject(SYSTEM_FIXED_FONT),0);
  93.     Contents^.SetText(ownedBy^.GetBody);
  94.     SetFocus(Destination^.HWindow);
  95. end;
  96.  
  97.  
  98.  
  99.  
  100.