charles
as i say there is no need for 0-550
TCN_SELCHANGE is -551
ok
but i think that is problem in notification message.
Eros give me thinBasic example but nothing..
also i have found C example but i don't know how to properly translate this code to
oxygen...here is ..
#include <windows.h>
#include <commctrl.h>
#include <stdio.h>
HWND hwndMain;
HWND hwndTab;
HWND hwnd0;
HWND hwnd1;
HWND hwnd2;
HWND hwnd3;
HINSTANCE hinst;
LRESULT CALLBACK ChildrenProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
switch(msg)
{
case WM_CLOSE:
DestroyWindow(hwnd);
break;
default:
return DefWindowProc(hwnd, msg, wParam, lParam);
}
return 0;
}
void CloseWindows()
{
DestroyWindow( hwnd0 );
DestroyWindow( hwnd1 );
DestroyWindow( hwnd2 );
DestroyWindow( hwnd3 );
}
void MakeWindow(int num)
{
if(num==0)
{
hwnd0=CreateWindowEx(0,
"TabChild",
"",
WS_CHILD|WS_VISIBLE|WS_CLIPSIBLINGS,
0, 0,
300, 300,
hwndMain,
NULL,
hinst,
NULL);
HWND hwnd01=CreateWindow(
"EDIT",
"Just",
WS_VISIBLE | WS_CHILD | WS_TABSTOP | WS_BORDER,
0, 50, 100, 25,
hwnd0,
NULL,
hinst,
NULL);
SetWindowPos(hwnd0,HWND_BOTTOM, 0, 0, 0, 0, SWP_NOSIZE|SWP_NOMOVE);
SetWindowPos(hwnd01,HWND_TOP, 0, 0, 0, 0, SWP_NOSIZE|SWP_NOMOVE|SWP_SHOWWINDOW);
}
}
LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
switch(msg)
{
case WM_CLOSE:
DestroyWindow(hwnd);
break;
case WM_DESTROY:
PostQuitMessage(0);
break;
case WM_NOTIFY:
switch (((LPNMHDR)lParam)->code)
{
case TCN_SELCHANGE:
{
int iPage = TabCtrl_GetCurSel(hwndTab);
CloseWindows();
if(iPage == 0)
MakeWindow(0);
if(iPage == 1)
MakeWindow(1);
if(iPage == 2)
MakeWindow(2);
if(iPage == 3)
MakeWindow(3);
break;
}
}
break;
default:
return DefWindowProc(hwnd, msg, wParam, lParam);
}
return 0;
}
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
LPSTR lpCmdLine, int nCmdShow)
{
WNDCLASSEX wc;
HWND hwnd;
MSG Msg;
hinst=hInstance;
wc.cbSize = sizeof(WNDCLASSEX);
wc.style = 0;
wc.lpfnWndProc = WndProc;
wc.cbClsExtra = 0;
wc.cbWndExtra = 0;
wc.hInstance = hInstance;
wc.hIcon = LoadIcon(NULL, IDI_APPLICATION);
wc.hCursor = LoadCursor(NULL, IDC_ARROW);
wc.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
wc.lpszMenuName = NULL;
wc.lpszClassName = "myWindowClass";
wc.hIconSm = LoadIcon(NULL, IDI_APPLICATION);
RegisterClassEx(&wc);
hwndMain = CreateWindowEx(
WS_EX_CLIENTEDGE,
"myWindowClass",
"The title of my window",
WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT, CW_USEDEFAULT, 350, 300,
NULL, NULL, hInstance, NULL);
ShowWindow(hwndMain, nCmdShow);
UpdateWindow(hwndMain);
InitCommonControls();
hwndTab=CreateWindowEx(0,
"SysTabControl32",
"",
WS_CHILD|WS_CLIPSIBLINGS|WS_VISIBLE,
0, 0,
300, 250,
hwndMain,
NULL,
hInstance,
NULL);
TCITEM tie;
tie.mask = TCIF_TEXT;
tie.pszText = "Hi1";
TabCtrl_InsertItem(hwndTab, 0, &tie);
tie.mask = TCIF_TEXT;
tie.pszText = "Hi2";
TabCtrl_InsertItem(hwndTab, 1, &tie);
tie.mask = TCIF_TEXT;
tie.pszText = "Hi3";
TabCtrl_InsertItem(hwndTab, 2, &tie);
tie.mask = TCIF_TEXT;
tie.pszText = "Hi4";
TabCtrl_InsertItem(hwndTab, 3, &tie);
TabCtrl_SetCurSel(hwndTab, 1);
ShowWindow(hwndTab, SW_SHOW);
UpdateWindow(hwndTab);
WNDCLASSEX wcx;
wcx.cbSize = sizeof(WNDCLASSEX);
wcx.style = 0;
wcx.lpfnWndProc = ChildrenProc;
wcx.cbClsExtra = 0;
wcx.cbWndExtra = 0;
wcx.hInstance = hInstance;
wcx.hIcon = LoadIcon(NULL, IDI_APPLICATION);
wcx.hCursor = LoadCursor(NULL, IDC_ARROW);
wcx.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
wcx.lpszMenuName = NULL;
wcx.lpszClassName = "TabChild";
wcx.hIconSm = LoadIcon(NULL, IDI_APPLICATION);
RegisterClassEx(&wcx);
while(GetMessage(&Msg, NULL, 0, 0) > 0)
{
TranslateMessage(&Msg);
DispatchMessage(&Msg);
}
return Msg.wParam;
}
in DLib structure viewer i have found that NMHDR is this
Type NMHDR
hwndFrom as INT
idFrom as INT
code as INT
End Type
what you think?