CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Aug 1999
    Posts
    26

    Scrollable window in the dialog based app.

    In the dialogbased aplication i want a window to dipplay certain textlines

    Now i have displayed the lines But,
    How can i get keys or mouse click in the window ?

    OR more specifically window is to behave like a Scrolable view where user can read text and
    move up-down if contents are larger ot fit in the window.

    What i have done is
    (i can display text on certain event )


    //CWind wind ; is defined in the .h file

    BOOL CMyDlg::OnInitDialog()
    {
    .
    .
    .
    wind.CreateEx(WS_EX_CLIENTEDGE | WS_EX_STATICEDGE,
    className, NULL, WS_VISIBLE | WS_CHILD,
    rect.left, rect.top, rect.right, rect.bottom,
    this->GetSafeHwnd(), (HMENU) 100, NULL);
    wind.ShowWindow(SW_SHOW);
    CRect rcRight;
    wind.GetClientRect(rcRight);
    CDC *pDC;
    pDC = wind.GetDC();
    pDC->TextOut(rcRight.left, rcRight.top, "HELLO", 5);

    ...
    }





    Thanks

    SoftBug


  2. #2
    Join Date
    Jul 1999
    Location
    B'lore India
    Posts
    9

    Re: Scrollable window in the dialog based app.

    Hi softbug,

    what u can do is Add a Text Box which is read only
    in your application Dialog Box , and set the the text box properties to have a vertical scroll bar

    Sam



  3. #3
    Join Date
    Aug 1999
    Posts
    26

    Re: Scrollable window in the dialog based app.

    Hi,

    Thanks for your help;

    But will you tell me exactly what should i do?

    Cause, i have tried it by pasting the read-only editor from the resources.

    It didn't work. it simply skips the extra lines if i used TextOut function.
    Means i don't get the VScrol.

    I have used following code display the text in the edit box.
    May be something is wrong with that.

    I want the text lines to be display at certain pos. in the window. these lines are records from a file



    .
    .
    .
    CRect rect();
    CWnd *pWnd = GetDlgItem(IDC_MYEDIT);
    pWnd->GetClientRect(rect);
    CDC *pDC;
    pDC = pWnd->GetDC();
    pDC->TextOut(...);
    .
    .
    .





    Thanks

    SoftBug


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