Murdocki
Gebruiker
- Lid geworden
- 7 jun 2007
- Berichten
- 449
wat ik wil doen is dat ik twee vensters heb waar ik tekst in kan schrijven in 1 applicatie, de tekst moet scrollable zijn maar naar mijn weten kan je alleen een scherm scrollable maken. wat ik dus gedaan heb is het volgende:
1 hoofdscherm gemaakt
2 child windows gemaakt (style: WS_CHILD | WS_SIZEBOX | WS_VSCROLL )
als ik dit doe dan krijg ik twee mooie childs met beide een scroll bar maar deze balk werkt niet. in zo'n zin dat als ik zeg dat maximale data 10 lijnen is en dat hij 10 lijnen per keer laat zien hij niet onscrollbaar wordt maar altijd een blokje laat zien
code zegt meer:
heeft iemand dit probleem eerder gehad of zie ik iets over het hoofd?
edit:
zie ik een memleak in m'n paint? zal nog ff kijken.
1 hoofdscherm gemaakt
2 child windows gemaakt (style: WS_CHILD | WS_SIZEBOX | WS_VSCROLL )
als ik dit doe dan krijg ik twee mooie childs met beide een scroll bar maar deze balk werkt niet. in zo'n zin dat als ik zeg dat maximale data 10 lijnen is en dat hij 10 lijnen per keer laat zien hij niet onscrollbaar wordt maar altijd een blokje laat zien
code zegt meer:
Code:
LRESULT CALLBACK WindProcedure3(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam);
void tsks_makewnd( HINSTANCE hInstance, WNDCLASSEX &WndCls )
{
tsks_hInst = hInstance;
WndCls.cbSize = sizeof(WndCls);
WndCls.style = CS_VREDRAW | CS_HREDRAW;
WndCls.lpfnWndProc = WindProcedure3;
WndCls.cbClsExtra = 0;
WndCls.cbWndExtra = 0;
WndCls.hInstance = tsks_hInst;
WndCls.hIcon = LoadIcon(NULL, IDI_APPLICATION);
WndCls.hCursor = LoadCursor(NULL, IDC_ARROW);
WndCls.hbrBackground = (HBRUSH)GetStockObject( WHITE_BRUSH );
WndCls.lpszMenuName = NULL;
WndCls.lpszClassName = "Tasks";
WndCls.hIconSm = LoadIcon(NULL, IDI_APPLICATION);
RegisterClassEx(&WndCls);
tsks_hWnd = CreateWindowEx( WS_EX_NOINHERITLAYOUT,
"Tasks",
"Tasks",
WS_CHILD | WS_SIZEBOX | WS_VSCROLL ,
5+width/3+5,//(GetSystemMetrics(SM_CXSCREEN)-width)/2,
5,//(GetSystemMetrics(SM_CYSCREEN)-height)/2,
width/3*2-9-5-9+1,
height-4-10-50,
hWnd,
NULL,
hInstance,
NULL );
ShowWindow( tsks_hWnd, SW_SHOWNORMAL ); // Laat het window zien.
UpdateWindow( tsks_hWnd ); // Update het window!
}
LRESULT CALLBACK WindProcedure3( HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam )
{
switch(Msg)
{
case WM_CREATE:
{
}
break;
case WM_ACTIVATE:
{
SCROLLINFO si = { sizeof(si) };
si.fMask = SIF_POS | SIF_PAGE | SIF_RANGE | SIF_DISABLENOSCROLL;
si.nPos = 0; // scrollbar thumb position
si.nPage = 10; // number of lines in a page (i.e. rows of text in window)
si.nMin = 0;
si.nMax = 10 - 1; // total number of lines in file (i.e. total scroll range)
SetScrollInfo( hWnd, SB_VERT, &si, TRUE );
}
break;
case WM_PAINT:
{
PAINTSTRUCT ps;
HDC hdc;
hdc = BeginPaint( hWnd, &ps );
HFONT font;
font = CreateFont( 15,//The nHeight argument is the height applied to the text.
10,//The nWidth value is the desired width that will be applied on the text.
0,//The nEscapement is the angle used to orient the text. The angle is calculated as a multiple of 0.1 and oriented counterclockwise.
45,//The nOrientation is the angular orientation of the text with regards to the horizontal axis.
FW_NORMAL,
FALSE,//The bItalic specifies whether the font will be italicized (TRUE) or not (FALSE).
FALSE,//The bUnderline is used to underline (TRUE) or not underline (FALSE) the text.
FALSE,//The cStrikeOut is specifies whether the text should be stroke out (TRUE) or not (FALSE) with a line.
ANSI_CHARSET,
OUT_DEFAULT_PRECIS,
CLIP_DEFAULT_PRECIS,
DEFAULT_QUALITY,
DEFAULT_PITCH | FF_ROMAN,
"Lucidia Console");
SelectObject( hdc, font );
SetBkMode( hdc, TRANSPARENT );
SetTextColor( hdc, RGB( 255, 0, 0 ) );
//TextOut( hdc, 0, 0, "testing", strlen( "testing" ) );
POINT pnt;
GetCursorPos(&pnt);
char buffer [50];
sprintf( buffer, "%d%s%d", static_cast<int>(pnt.x - ((GetSystemMetrics(SM_CXSCREEN)-width)/2)), ",", static_cast<int>(pnt.y - ((GetSystemMetrics(SM_CYSCREEN)-height)/2)) );
/*
PaintText( 0, 0, 640, 480, RGB(255,255,255),
buffer, width/3+10, 1, TRANSPARENT, 15, 15,
"Lucidia Console" );
*/
TextOut( hdc, 0, 0, buffer, strlen( buffer ) );
DeleteObject(font);
EndPaint( hWnd, &ps );
ValidateRect( hWnd, NULL);
}
break;
case WM_DESTROY:
{
PostQuitMessage(WM_QUIT);
}
break;
case WM_TIMER:
{
//InvalidateRect(hWnd, NULL, 1);
}
break;
case WM_MOUSEMOVE:
{
InvalidateRect( hWnd, NULL, 1 );
}
break;
default:
{
return DefWindowProc(hWnd, Msg, wParam, lParam);
}
}
return 0;
}
heeft iemand dit probleem eerder gehad of zie ik iets over het hoofd?
edit:
zie ik een memleak in m'n paint? zal nog ff kijken.
Laatst bewerkt: