CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 9 of 9
  1. #1
    Join Date
    May 2003
    Location
    Jodhpur -> Rajasthan -> INDIA
    Posts
    453

    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
    Leave Your Mark Wherever You Go
    http://www.danasoft.com/sig/d0153030Sig.jpg

  2. #2
    Join Date
    Dec 1999
    Location
    North Sydney, NS
    Posts
    445

    Re: communication between different views and WM_CHAR handling

    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?

    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).
    I know how to build. What to build is a completely different story.

  3. #3
    Join Date
    Jun 2005
    Location
    The Netherlands
    Posts
    185

    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);

  4. #4
    Join Date
    May 1999
    Location
    ALABAMA, USA
    Posts
    9,917

    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.


    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.
    Attached Files Attached Files
    There are only 10 types of people in the world:
    Those who understand binary and those who do not.

  5. #5
    Join Date
    Jul 2003
    Posts
    731

    Re: communication between different views and WM_CHAR handling

    Quote Originally Posted by JohnCz


    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.
    Good Answers, Good Points.

  6. #6
    Join Date
    Feb 2000
    Location
    San Diego, CA
    Posts
    10,354

    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/

  7. #7
    Join Date
    May 1999
    Location
    ALABAMA, USA
    Posts
    9,917

    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.
    Attached Files Attached Files
    There are only 10 types of people in the world:
    Those who understand binary and those who do not.

  8. #8
    Join Date
    Jul 2003
    Posts
    731

    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
    Good Answers, Good Points.

  9. #9
    Join Date
    May 1999
    Location
    ALABAMA, USA
    Posts
    9,917

    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.
    There are only 10 types of people in the world:
    Those who understand binary and those who do not.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured