Tab control with DDT ?

Started by docroger, July 30, 2025, 06:11:07 AM

Previous topic - Next topic

docroger

Hello José,

Is it possible to have tab control, like in Powerbasic ?

I find control add tab, but next ?
Like Tab insert page ?

An example ?

If you have time...
Thanx.

José Roca

I plan to implement it for CWindow. With DDT everything becomes complicated because of the limitations of the dialog engine. It does not like to have controls that are children of other controls.

José Roca

#2
Tab control with CWindow.

https://github.com/JoseRoca/AfxNova/blob/main/SDK%20Templates/CW_TabCtrl_01.bas

I wil try to get to work with DDT, but I have not much hope.

Attached a compiled example.

docroger

Thanx José.
I switch to cwindow...
Thanx for your effort.

José Roca

#4
I have got it working with DDT.
See: https://github.com/JoseRoca/AfxNova/blob/main/DDT%20Templates/EX_DDT_TabCtrl_01.bas

It seems that I have found the solution to the repaintig problems with dialogs, While with CWindow is not needed to process WM_PAINT when resizing, with dialogs I have to do:

CASE WM_PAINT
   DIM hTab AS HWND = ControlHandle(hDlg, IDC_TAB)
   SetWindowPos hTab, NULL, 0, 0, 0, 0, SWP_NOZORDER OR SWP_NOMOVE OR SWP_NOSIZE OR SWP_DRAWFRAME

These repainting problems happen when there are controls that are children of another control instead of the dialog.

docroger

Very good news !

I have tested the code (DDT with tab) and it work fine with latest version of afxnova.
My codes work also without any problems.

Cool !

I continue using DDT (simple for me) and test AFxNova.

José Roca

But the code uses an hybrid approach. It uses CWindows, not dialogs, for the tab pages. I wanted to discover why I was having repainting problems when using dialogs. The main problem is that the Windows Dialog Engine is a black box (no source code available) and we don't know what exactly does under the hood. It would be possible to use dialogs for the tab pages, but having to duplicate everything for CWindow and CDialog is too much work.