Article View: comp.os.ms-windows.programmer.tools
Article #621OWL & transfer to Combobox
From: Martin Hagelin
Date: Mon, 14 Dec 1992 13:10
Date: Mon, 14 Dec 1992 13:10
79 lines
2376 bytes
2376 bytes
Hello everybody !
I have a problem with OWL and transfer to/from Comboboxes in a dialog.
I try to display a combobox in a dialog and fill it with information
but somehow the Gods aren't with me. I'm running BC++ v3.1 with OWL.
The code looks like this:
struct TMyTransferStruct {
...
PTComboBoxData pcbxdata;
...
};
class TMyWindow : public TWindow
{
...
TMyTransferStruct MyTransferStruct;
...
};
TMyWindow::DoTheBox()
{
MyTransferStruct.pcbxdata = new TComboBoxData();
// Fill the list
MyTransferStruct.pcbxdata->AddString("bla bla");
...
// Create the dialog and it's components
PTDialog MyDialog = new TDialog(this, ID_MYDIALOG);
...
new TComboBox(MyDialog, ID_MYCOMBOBOX);
...
// Set the TransferBuffer to my transferstruct
MyDialog->SetTransferBuffer(&MyTransferStruct);
// Do the dialog
if ( GetApplication()->ExecDialog(MyDialog) == MB_OK ) {
strcpy(answer, MyTransferStruct.pcbxdata->Selection);
...
}
// problem statement
delete MyTransferStruct.pcbxdata;
}
Because I create a TComboBoxData with new, I must delete it
afterwards. But if I do this, everything crashes the second time I run
DoTheBox(), and if I omit the delete statement everything works fine
for maybe 10 or 20 times then it crashes (probably because more and
memory is taken by the TComboBoxData:s).
The manual is not very informative about transfering and especially
not to/from comboboxes. Am I doing this totally backwards ?
From what I believe (not that I havn't studied the manuals), manages
the ExecDialog() the deletion of the dialogbox and it's children when
the routine is finished.
I'd sure appriciate some help on this subject, or some other solutions
on how to get your transfer to/from dialog boxes to work.
/Martin
--
--------
Martin Hagelin
hagelin@elixir.e.kth.se
Technical Details
Message-ID:
<HAGELIN.92Dec14141029@elixir.elixir.e.kth.se>Path:
arc1-ca.pugleaf.net!sparky!uunet!enterpoop.mit.edu!eru.mt.luth.se!kth.se!news.kth.se!hagelinShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!enterpoop.mit.edu!eru.mt.luth.se!kth.se!news.kth.se!hagelin From: hagelin@elixir.e.kth.se (Martin Hagelin) Newsgroups: comp.os.ms-windows.programmer.tools Subject: OWL & transfer to Combobox Message-ID: <HAGELIN.92Dec14141029@elixir.elixir.e.kth.se> Date: 14 Dec 92 13:10:29 GMT Sender: usenet@kth.se (Usenet) Distribution: comp Organization: School of EE, Royal Institute of Technology, Sweden Lines: 79 Nntp-Posting-Host: elixir.e.kth.se