communication between different views and WM_CHAR handling
Hello
I had send previous posts related to bits or parts of my project. Well adding one more bit/ query to get solution from you experts..
My application is SDI - Multiview application
On UI there are three views seperated by Splitter windows in three rows.
1.0 View is my Class view
2.0 CListView
3.0 CEditview
My problem is
1.0 To get the TEXT entered in CEditView i.e. thirdview at bottom in my window ,, after user press OK and then make the content of CEditView as blank/clear.
2.0 Can i restrict no. of lines of text to be entered in ceditview to be "1"
3.0 Once user enters text in Ceditview and press Enter, the same text has to be appended to my Clistview
4.0 And in addition to step 3.0 I must be able to notify my main view i.e. View no. 1 that some command has been entered. So that my main view (no. 1) can be updated.
How to do this??
Sandeep Arya
Re: communication between different views and WM_CHAR handling
Quote:
2.0 Can i restrict no. of lines of text to be entered in ceditview to be "1"
Why not make the view a FormView and add an edit box without the multiline capability?
Quote:
3.0 Once user enters text in Ceditview and press Enter, the same text has to be appended to my Clistview
In the Enter message handler I'd store the data in the Document. Then I'd call UpdateAllViews. In the Clistview I'd handle the OnUpdate(?) message where I'd then get the data from the document and display it (or do whatever with it).
Re: communication between different views and WM_CHAR handling
use the window procedure to catch OK or enter event then sue GetWindowText with GetWindowTextLenght to get the caption.
Code:
int Size = GetWindowTextLength(this->hWnd);
char* Buffer = new char[Size + 1];
memset(&Buffer, 0, sizeof(char) * (Size + 1));
GetWindowText(this->hWnd, Buffer, Size);
MesageBox(NULL, Buffer, "caption", MB_OK);
1 Attachment(s)
Re: communication between different views and WM_CHAR handling
Quote:
Originally Posted by Kanker Noob
use the window procedure to catch OK or enter event then sue GetWindowText with GetWindowTextLenght to get the caption.
:confused: :confused: :confused:
Paul Rice is right. Use UpdateAllViews to utilize data stored in a document.
As for single line edit control you would have to set proper style. I do not understand a part about OK button.
See sample showing how it can be done.
Re: communication between different views and WM_CHAR handling
Quote:
Originally Posted by JohnCz
:confused: :confused: :confused:
Paul Rice is right. Use UpdateAllViews to utilize data stored in a document.
As for single line edit control you would have to set proper style. I do not understand a part about OK button.
See sample showing how it can be done.
JohnCz,
On a seperate question, how can we make the top view in this example as non-sizable (fixed size).
Thanks.
Re: communication between different views and WM_CHAR handling
retry,
ideas in this article might help you if I understand you correctly..
http://www.codeguru.com/Cpp/W-D/spli...cle.php/c4707/
1 Attachment(s)
Re: communication between different views and WM_CHAR handling
Well, this is higher level of customization; question for a 1000 points.
How splitter knows that cursor is over splitter bar?
It has HitTest function that check where cursor hit.
It is even virtual; therefore the solution is to override HitTest.
For this I have derived new class from CSplitterWnd and did just that, fooling splitter into thinking that hit is nowhere when cursor is over first row.
Attached is modified sample.
Re: communication between different views and WM_CHAR handling
Awesome!!!
I couldn't even figure out that HitTest() is the hierarchy and its virtual function? At least no mention in the MSDN. The solution works super.
Thanks a lot JohnCz.
p.s I like to give points for good replies, but it says spread the point before giving to Johcz again. Anyways :thumb:
Re: communication between different views and WM_CHAR handling
Quote:
Originally Posted by retry
At least no mention in the MSDN.
There are many things that are not mention anywhere not only MSDN.
Quote:
Originally Posted by retry
p.s I like to give points for good replies, but it says spread the point before giving to Johcz again.
The spirit is what counts. You must have rated my post recently, without giving much rating afterwards.