i want to code my first tab controls. but i am very frustrated cause the child windows isnt shown correctly in the SysTabControl32.

it looks like its shown in the frame dialog. see picture in attachment

here is some code i used:



DialogFrame proc hwnd:HWND,message:UINT,wParam:WPARAM,lParam:LPARAM
pushad

mov eax,message
.if eax==WM_INITDIALOG

push hwnd ;save handle of this dialog
pop handle

;-----------------------------------------------------------------------------------
;-- Insert the tabs in the tab control.
invoke GetDlgItem, handle, 2050
mov hTabControl, eax

MOV TCI.iImage,0 ; index to tab control's image
MOV TCI.lParam,0 ; Extra info

mov TCI.imask, TCIF_TEXT
mov TCI.pszText,CTXT ("Tab 1")
MOV TCI.cchTextMax,14
invoke SendMessage, hTabControl, TCM_INSERTITEM, 0, OFFSET TCI ;Search and Replace TAB

;-----------------------------------------------------------------------------------
;-- Create the dialogs for both tabs.

invoke CreateDialogParam, hInstance, 55, hTabControl, addr ChildDlgProc, NULL

;-----------------------------------------------------------------------------------
;-- Show the dialog with the tabular representation.
mov hCurrentDialog, eax
invoke ShowWindow, eax, SW_SHOW

;-----------------------------------------------------------------------------------
;-- Let Windows assign the default keyboard focus.
popad
mov eax, TRUE
ret

.ELSEIF eax == WM_NOTIFY
mov eax, lParam
mov ecx, (NMHDR ptr [eax]).code
.IF ecx == TCN_SELCHANGE
; Hide the currently shown dialog.
invoke ShowWindow, hCurrentDialog, SW_HIDE

;-------------------------------------------------------------------------------
;-- Show the other dialog.
mov eax, hCurrentDialog

.IF eax == hDialogTab2
mov eax, hDialogTab1
.ELSE
mov eax, hDialogTab2
.ENDIF

;-------------------------------------------------------------------------------
;-- Show the dialog.
mov hCurrentDialog, eax
invoke ShowWindow, eax, SW_SHOW
.ENDIF

.ELSEIF eax == WM_NCACTIVATE
cmp wParam, FALSE
je @Return

invoke UpdateWindow, handle

.ELSEIF eax == WM_CLOSE
@Exit:
invoke EndDialog, handle, 0
.ENDIF

@Return:

popad
xor eax,eax
ret
DialogFrame endp


ChildDlgProc PROC SmallhWnd:HWND, uMsg:UINT, wParam:WPARAM, lParam:LPARAM
XOR EAX,EAX
RET
ChildDlgProc ENDP


;/// RESOURCE INFO OF THE CHILD DIALOG///
55 DIALOG 0, 0, 200, 160
STYLE WS_CHILD
EXSTYLE WS_EX_CONTROLPARENT
CAPTION ""
LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
FONT 8, "MS SANS SERIF"
{
CONTROL "OK", 400, BUTTON, BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 138, 143, 60, 14 , 0x00020000
CONTROL "Cancel", 401, BUTTON, BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 76, 142, 60, 14 , 0x00020000
}


;/// RESOURCE INFO OF THE FRAME DIALOG///
4 DIALOG 40, 70, 329, 268
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "i want tabs"
LANGUAGE LANG_SPANISH, 0xB
FONT 8, "MS Sans Serif"
{
CONTROL "Tab1", 2050, "SysTabControl32", TCS_TABS | WS_CHILD | WS_VISIBLE, 0, 0, 328, 266
}


or maybe anybody has a short masm example for tab controls (not the one from latigo)?
Posted on 2004-07-13 12:52:18 by diablo2oo2
Hi....


If you want a good example go to this link...

http://pageperso.aol.fr/GerardChap/Start.html

and downlaod the following example...

http://pageperso.aol.fr/gerardchap/TaskVersion1.zip

Good enjoy...

Gerard...
----
Posted on 2004-07-13 13:09:46 by gerard
Posted on 2004-07-13 16:51:08 by cakmak
ok i got the error. it was in the resource:
the x,y position of the child dialog was 0,0.

he is it right:
;/// RESOURCE INFO OF THE CHILD DIALOG///
55 DIALOG 20,20 , 200, 160
STYLE WS_CHILD
EXSTYLE WS_EX_CONTROLPARENT
CAPTION ""
LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
FONT 8, "MS SANS SERIF"
{
CONTROL "OK", 400, BUTTON, BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 138, 143, 60, 14 , 0x00020000
CONTROL "Cancel", 401, BUTTON, BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 76, 142, 60, 14 , 0x00020000
}
Posted on 2004-07-17 11:51:35 by diablo2oo2
Hi...

Yes...you have made an error in ressource file...you have forgotten the size of the "tab"...

For that it exists message TCM_GETITEMRECT and by using SendMessage one can retrieve the exact size then change the dimension of "DialogBox"...after its creation...

SendMessage

I am happy that you found your error...

For a full utilization of all possibilities of TabControl go to TabControl ....

Good enjoy...

Gerard...
-----
Posted on 2004-07-17 12:07:28 by gerard