Transfering text into a WxMemo control Topic is solved

If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
Post Reply
djsbriscoe
In need of some credit
In need of some credit
Posts: 3
Joined: Mon Mar 24, 2008 3:12 pm
Location: London,UK

Transfering text into a WxMemo control

Post by djsbriscoe » Mon Mar 24, 2008 3:43 pm

Hi,
I'm newcomer to this forum as well as c++ programming and wxwidgets. My aim is to learn a bit by writing a small application.
I have a form with a 2 page WxNotebook on the left and a WxMemo
on the right, seperated by a splitter window.
On the first page of the WxNotebook is a single line edit box.
I would like to be able to enter some text into the edit box and on pressing enter have the same line of text appear in the WxMemo control (as a first step).
I'm using Wx-Devcpp as my development tool. So far I have suceeded in opening a text file in the memo window and saving as well.
Iv'e tried to use GetValue() and WriteText() but so far have only managed to crash my program.
Can anyone give me any nudges in the right direction (eg example code).
Thank you.

David. :?

JimFairway
wxWorld Domination!
wxWorld Domination!
Posts: 1059
Joined: Sun Dec 30, 2007 6:40 pm
Location: Canada

Post by JimFairway » Mon Mar 24, 2008 8:06 pm

Hi David,

Best if you can post some of the code that is crashing. You'll most likely get some guidance on what is causing it, and how to avoid it.

Jim
OS: Vista SP1, wxWidgets 2.8.7.

Sof_T
Can't get richer than this
Can't get richer than this
Posts: 864
Joined: Thu Jul 28, 2005 9:48 pm
Location: New Forest, United Kingdom
Contact:

Post by Sof_T » Tue Mar 25, 2008 8:56 am

You need to set the wxTE_PROCESS_ENTER style for the edit control and then catch the enter event. I have attached a sample project.

For non wxDev-C++ users an edit control is a single line text control and a memo control is a multiline text control.

Sof.T
Attachments
djsbriscoe.zip
Sample project to take text from an edit control and append to a memo control.
(8.49 KiB) Downloaded 31 times
The home of Sof.T http://www.sof-t.site88.net/
Author of Programming with wxDevC++
http://sourceforge.net/projects/wxdevcpp-book/

djsbriscoe
In need of some credit
In need of some credit
Posts: 3
Joined: Mon Mar 24, 2008 3:12 pm
Location: London,UK

Post by djsbriscoe » Wed Mar 26, 2008 11:58 am

Hi,
Thanks Sof_T that is exactly what I needed.
Now Ive got a bit of a start I can learn where I went wrong with the code that I tried.
Oh and thanks Jim for your reply.

David

Post Reply