Click to See Complete Forum and Search --> : Scrollable window in the dialog based app.


SoftBug
September 12th, 1999, 02:34 AM
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

Sameer Pise
September 12th, 1999, 07:27 AM
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

SoftBug
September 15th, 1999, 10:33 PM
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