home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #27 / NN_1992_27.iso / spool / comp / os / mswindo / programm / misc / 3444 < prev    next >
Encoding:
Text File  |  1992-11-15  |  4.5 KB  |  190 lines

  1. Newsgroups: comp.os.ms-windows.programmer.misc
  2. Path: sparky!uunet!ornl!rsg1.er.usgs.gov!darwin.sura.net!wupost!gumby!destroyer!sol.ctr.columbia.edu!eff!news.oc.com!mercury.unt.edu!sol!anto
  3. From: anto@sol.acs.unt.edu (Anto Prijosoesilo)
  4. Subject: Help: OWL problem
  5. Message-ID: <anto.721868459@sol>
  6. Summary: Dialogs with ComboBox causes hangs
  7. Keywords: borland c++ owl combobox
  8. Sender: usenet@mercury.unt.edu (UNT USENet Adminstrator)
  9. Organization: University of North Texas
  10. Date: Sun, 15 Nov 1992 23:00:59 GMT
  11. Lines: 177
  12.  
  13. Hi netters,
  14.  
  15. Can somebody tell me what I did wrong here? In this test app (an extremely
  16. condensed form of an app I'm writing which still exhibits the problem)
  17. I can choose File|New Dialog... to show the dialog. If I select OK the
  18. dialog disappears and reappears (it's meant to do that). All is well up to
  19. here. If I change the selection in the combobox, however, I can select OK
  20. once and the second time it hangs my machine.
  21.  
  22. So, these work:
  23.  
  24. File|New Dialog, Cancel
  25. File|New Dialog, OK
  26. File|New Dialog, Change ComboBox' Selection, OK, Cancel
  27.  
  28. But this doesn't:
  29.  
  30. File|New Dialog, Change ComboBox' Selection, OK, OK
  31.  
  32. nor does this:
  33.  
  34. File|New Dialog, Change ComboBox' Selection, OK, Change ComboBox' Selection, OK
  35.  
  36. I'm including the source files below.
  37.  
  38. My compiler settings are:
  39. Precompiled headers turned on,
  40. Large memory model,
  41. Smart callback,
  42. All libraries are linked as DLL.
  43.  
  44. Thanks for any clues & help anybody can give me..
  45.  
  46. Desperately seeking, :-)
  47.  
  48. Anto.
  49.  
  50. <Included: CBoxTest.h>
  51. #define CM_TestDlg    101
  52. #define ID_TestCBox    101
  53.  
  54. <Included: CBoxTest.cpp>
  55. // CBoxTest.cpp
  56.  
  57. // Test file for testing ComboBox transfer to/from a dialog
  58.  
  59. #define WIN31
  60. #define STRICT
  61. #define _CLASSDLL
  62.  
  63. #include <owl.h>
  64. #include <combobox.h>
  65. #include "cboxtest.h"
  66.  
  67. _CLASSDEF (TTestApp)
  68. class TTestApp: public TApplication
  69. {
  70. public:
  71.   TTestApp (HINSTANCE, HINSTANCE, LPSTR, int);
  72.   virtual void InitMainWindow ();
  73. };
  74.  
  75. _CLASSDEF (TTestFrame)
  76. class TTestFrame: public TMDIFrame
  77. {
  78. public:
  79.   TTestFrame (PTModule = NULL);
  80.   virtual void CMTestDlg (RTMessage) = [CM_FIRST + CM_TestDlg];
  81. };
  82.  
  83. _CLASSDEF (TTestDlg)
  84. class TTestDlg: public TDialog
  85. {
  86. public:
  87.   TTestDlg (PTWindowsObject, PTModule = NULL);
  88. };
  89.  
  90. // TTestApp's member functions
  91.  
  92. TTestApp::TTestApp (HINSTANCE AnInstance, HINSTANCE APrevInstance, 
  93.                     LPSTR ACmdLine, int ACmdShow):
  94.   TApplication ("Test App", AnInstance, APrevInstance, ACmdLine, ACmdShow)
  95. {
  96. }
  97.  
  98. void TTestApp::InitMainWindow ()
  99. {
  100.   MainWindow = new TTestFrame;
  101. }
  102.  
  103. // TTestFrame's member functions
  104.  
  105. TTestFrame::TTestFrame (PTModule AModule):
  106.   TMDIFrame ("Test MDI App", "TestMenu", AModule)
  107. {  
  108. }
  109.  
  110. void TTestFrame::CMTestDlg (RTMessage)
  111. {
  112.   struct
  113.   {
  114.     PTComboBoxData CBxData;
  115.   } XferBuf;
  116.  
  117.   XferBuf.CBxData = new TComboBoxData;
  118.  
  119.   XferBuf.CBxData -> AddString ("First String");
  120.   XferBuf.CBxData -> AddString ("Second String");
  121.   XferBuf.CBxData -> AddString ("Third String");
  122.   XferBuf.CBxData -> AddString ("Fourth String");
  123.   XferBuf.CBxData -> AddString ("Fifth String");
  124.  
  125.   PTTestDlg TheDlg;
  126.   do
  127.   {
  128.     TheDlg = new TTestDlg (this);
  129.  
  130.     TheDlg -> SetTransferBuffer (& XferBuf);
  131.  
  132.   } while ((GetApplication () -> ExecDialog (TheDlg)) == IDOK);
  133.  
  134.   delete XferBuf.CBxData;
  135. }
  136.  
  137. // TTestDlg's member function
  138.  
  139. TTestDlg::TTestDlg (PTWindowsObject AParent, PTModule AModule):
  140.   TDialog (AParent, "TestDlg", AModule)
  141. {
  142.   new TComboBox (this, ID_TestCBox, 24, AModule);
  143. }
  144.  
  145. int PASCAL WinMain (HINSTANCE AnInstance, HINSTANCE APrevInstance, 
  146.                     LPSTR ACmdLine, int ACmdShow)
  147. {
  148.   TTestApp TestApp (AnInstance, APrevInstance, ACmdLine, ACmdShow);
  149.  
  150.   TestApp.Run ();
  151.  
  152.   return TestApp.Status;
  153. }
  154.  
  155. <Included: CBoxTest.rc>
  156. #include "windows.h"
  157. #include "owlrc.h"
  158. #include "cboxtest.h"
  159.  
  160. TestMenu MENU 
  161. BEGIN
  162.     POPUP "&File"
  163.     BEGIN
  164.         MENUITEM "&Test Dialog...", CM_TestDlg
  165.         MENUITEM SEPARATOR
  166.         MENUITEM "E&xit\tAlt+F4", CM_EXIT
  167.     END
  168.  
  169. END
  170.  
  171.  
  172. TestDlg DIALOG 18, 18, 102, 43
  173. STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
  174. CAPTION "Test Dialog"
  175. BEGIN
  176.     CONTROL "", ID_TestCBox, "COMBOBOX", CBS_DROPDOWNLIST | CBS_SORT | WS_CHILD | WS_VISIBLE | WS_GROUP | WS_TABSTOP, 6, 17, 49, 57
  177.     CONTROL "OK", IDOK, "BUTTON", BS_DEFPUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_GROUP | WS_TABSTOP, 64, 6, 32, 14
  178.     CONTROL "Cancel", IDCANCEL, "BUTTON", BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_GROUP | WS_TABSTOP, 64, 23, 32, 14
  179.     LTEXT "&Test List", -1, 6, 6, 49, 8, WS_CHILD | WS_VISIBLE | WS_GROUP
  180. END
  181.  
  182. <Included: CBoxTest.def>
  183. EXETYPE WINDOWS
  184. CODE PRELOAD MOVEABLE DISCARDABLE
  185. DATA PRELOAD MOVEABLE MULTIPLE
  186. HEAPSIZE 4096
  187. STACKSIZE 5120
  188.  
  189. <End of included files>
  190.