C++ program with blank UI with GTK+ 2.0 - c++

I wrote a C++ software using GTK library (2.0 version) for UI.
The compilation (with makefile) gave no errors but when I execute the program the window appears empty.
I think I've done some error in the code that create the interface.
In particular I have some doubts about the widgets positioning and sizing.
The .h interface file is composed from the declaration of the struct widgets_t (that contains all the pointers to widgets of the interface) and the declaration of the function build_interface (that create and initialize the UI).
the .cpp interface file is
#include <gtk/gtk.h>
#include "interface.h"
void build_interface (widgets_t *widgets)
{
//window
widgets->W = gtk_window_new(GTK_WINDOW_TOPLEVEL);
gtk_window_set_title(GTK_WINDOW(widgets->W), "myNavigator");
gtk_window_set_default_size(GTK_WINDOW(widgets->W),800,600);
gtk_window_set_position(GTK_WINDOW(widgets->W), GTK_WIN_POS_NONE);
//menu bar
widgets->MB = gtk_menu_bar_new();
widgets->IF = gtk_menu_item_new_with_mnemonic("File");
gtk_menu_bar_append(GTK_MENU_BAR(widgets->MB), widgets->IF);
widgets->MF = gtk_menu_new();
gtk_menu_item_set_submenu(GTK_MENU_ITEM(widgets->IF), widgets->MF);
widgets->IQ = gtk_menu_item_new_with_mnemonic("Close");
gtk_menu_shell_append (GTK_MENU_SHELL (widgets->MF), widgets->IQ);
widgets->IM = gtk_menu_item_new_with_mnemonic("Map");
gtk_menu_bar_append(GTK_MENU_BAR(widgets->MB), widgets->IM);
widgets->MM = gtk_menu_new();
gtk_menu_item_set_submenu(GTK_MENU_ITEM(widgets->IM), widgets->MM);
widgets->ILM = gtk_menu_item_new_with_mnemonic("Load");
gtk_menu_shell_append (GTK_MENU_SHELL (widgets->MM), widgets->ILM);
widgets->IP = gtk_menu_item_new_with_mnemonic("Path");
gtk_menu_bar_append(GTK_MENU_BAR(widgets->MB), widgets->IP);
widgets->MP = gtk_menu_new();
gtk_menu_item_set_submenu(GTK_MENU_ITEM(widgets->IP), widgets->MP);
widgets->ICP = gtk_menu_item_new_with_mnemonic("Calculate");
gtk_menu_shell_append (GTK_MENU_SHELL (widgets->MP), widgets->ICP);
//image to display a map
widgets->I = gtk_image_new();
//widgets for input
widgets->LF = gtk_label_new("Origin:");
widgets->SBF = gtk_spin_button_new_with_range(0,0,1);
widgets->LT = gtk_label_new("Destination:");
widgets->SBT = gtk_spin_button_new_with_range(0,0,1);
//button to perform software elaboration
widgets->BCP = gtk_button_new_with_mnemonic("Calculate Path");
//containers
//vertical box
widgets->VB = gtk_vbox_new(false, 0);
gtk_box_pack_start(GTK_BOX(widgets->VB), widgets->LF, FALSE, FALSE, 0);
gtk_box_pack_start(GTK_BOX(widgets->VB), widgets->SBF, FALSE, FALSE, 0);
gtk_box_pack_start(GTK_BOX(widgets->VB), widgets->LT, FALSE, FALSE, 0);
gtk_box_pack_start(GTK_BOX(widgets->VB), widgets->SBT, FALSE, FALSE, 0);
gtk_box_pack_start(GTK_BOX(widgets->VB), widgets->BCP, FALSE, FALSE, 0);
//horizontal box
widgets->HB = gtk_hbox_new(false, 0);
gtk_box_pack_start(GTK_BOX(widgets->HB), widgets->MB, FALSE, FALSE, 0);
gtk_box_pack_start(GTK_BOX(widgets->HB), widgets->I, FALSE, FALSE, 0);
gtk_box_pack_start(GTK_BOX(widgets->HB), widgets->VB, FALSE, FALSE, 0);
//add vertical box to the window
gtk_container_add(GTK_CONTAINER(widgets->W), widgets->VB);
//display widgets
gtk_widget_show_all(widgets->W);
}
someone sees something wrong and helps me to appear the UI? :)
thank you all in advance!

As the comment says you failed parenting the widgets:
widgets->W should contain widgets->HB and not widgets->VB.
If you can run your program from a terminal (if you are on windows "cmd" should work), GTK should have warned you about wrong parenting when you added "VB" to "W".
Note also that you may want to use local declaration for intermediate objects like "vboxes", and also for objects that will not change during your program execution.
Also note that you can build the interface also in XML using glade or by hand through the GtkBuilder Interface.
IMHO programmatically built GUIs should be used only when the interface will need to change dinamically during the program execution.

Related

Get WId of active window with XCB

What would be the proper way to get the active window (the one with input focus) with XCB?
reply = xcb_get_input_focus_reply(connection, xcb_get_input_focus(connection), nullptr);
std::cout << "WId: " << reply->focus;
This seems to be work sometimes and sometimes not.
I also saw someone mentioned querying _NET_ACTIVE_WINDOW root window property but I can't figure out how that is done and is it always supported with XCB?
Edit: The approach above with xcb_get_input_focus is only one part, after getting the reply->focus, you need to follow up the parent windows via xcb_query_tree.
As far as I know, EWMH-compliant window managers are expected to set _NET_ACTIVE_WINDOW attribute of root window to the window ID of the currently active window.
In order to get it,
Use xcb_intern_atom to get the atom value for _NET_ACTIVE_WINDOW
Get the root window ID, e.g. using xcb_setup_roots_iterator(xcb_get_setup(connection)).data->root
Use xcb_get_property, xcb_get_property_reply, and xcb_get_property_value to get the value of the attribute of the root window.
_NET_ACTIVE_WINDOW has type of CARDINAL, which, for XCB purposes, has size of 32 bits.
Or you could use libxcb-ewmh which wraps this task into xcb_ewmh_get_active_window function.
This solution works for me, it's more or less migration from some X11 code to XCB. Basically get the focus window and follow up the the path of the parent window until the window id is equal to parent or root id, this is then the top level window.
WId ImageGrabber::getActiveWindow()
{
xcb_connection_t* connection = QX11Info::connection();
xcb_get_input_focus_reply_t* focusReply;
xcb_query_tree_cookie_t treeCookie;
xcb_query_tree_reply_t* treeReply;
focusReply = xcb_get_input_focus_reply(connection, xcb_get_input_focus(connection), nullptr);
xcb_window_t window = focusReply->focus;
while (1) {
treeCookie = xcb_query_tree(connection, window);
treeReply = xcb_query_tree_reply(connection, treeCookie, nullptr);
if (!treeReply) {
window = 0;
break;
}
if (window == treeReply->root || treeReply->parent == treeReply->root) {
break;
} else {
window = treeReply->parent;
}
free(treeReply);
}
free(treeReply);
return window;
}

How to allign text on ribbon button?

as adding a ribbon button, I am also supplying the name for it. It is performing its desired action, but placement of string is absurd. It should not be over the image, but under it. Any suggestions please. Adding code snippet and screenshot.
RibbonButtonProp* mRibbonProperties;
bool m_bsetlargeimage = FALSE;
if (ButtonProp.Lookup(m_nMenuItemID, mRibbonProperties) != 0)
{
if (ButtonProp[m_nMenuItemID]->m_bIfSmallButton == FALSE)
{
m_PanelImage.SetImageSize(CSize(32, 32));
m_PanelImage.Load(ButtonProp[m_nMenuItemID]->m_nImageResourceId);
m_bsetlargeimage = TRUE;
}
else
{
m_PanelImage.SetImageSize(CSize(16, 16));
m_PanelImage.Load(ButtonProp[m_nMenuItemID]->m_nImageResourceId);
m_bsetlargeimage = FALSE;
}
pRibbonButton = new CMFCRibbonButton(m_nMenuItemID, m_strMenuItemName, m_PanelImage.ExtractIcon(ButtonProp[m_nMenuItemID]->m_nImageIndex));
pRibbonButton->SetAlwaysLargeImage(m_bsetlargeimage);
Print should be just under the image
There is no way to change this. This is the way ribbons are shown and drawn.
A button text in "large-mode" is always drawn below the icon. I see nothing in the code to change this behavior AND I would never change this, because it is the default behavior people want/expect to see in a standard ribbon.
Earlier
AddCategory(m_strMenuName, NULL, NULL, NULL, NULL, i, NULL);
Now
AddCategory(m_strMenuName, NULL, NULL, CSize(16,16), CSize(32, 32), i, NULL);
Explanation: It was placing the text assuming that all the image size is small only as it was not defined already while calling create.

Parse Issue - expected unqualified id

Hey guys this is my code and i am relatively new to C++ and even coding really dont know why i am getting a parse error
though i as per my understanding i have placed the parenthesis properly anyone please suggest if i am missing anything here.
i am getting error at this line
class getProcessor()->RequestUIUpdate()// UI update must be done each time a new editor is constructed
Full Code:
StereoWidthCtrlAudioProcessorEditor::StereoWidthCtrlAudioProcessorEditor (StereoWidthCtrlAudioProcessor* ownerFilter)
: AudioProcessorEditor(ownerFilter)
{
addAndMakeVisible (WidthCtrlSld = new Slider ("Width Factor Slider"));
WidthCtrlSld->setRange (0, 5, 0.1);
WidthCtrlSld->setSliderStyle (Slider::LinearHorizontal);
WidthCtrlSld->setTextBoxStyle (Slider::TextBoxLeft, false, 80, 20);
WidthCtrlSld->addListener (this);
addAndMakeVisible (BypassBtn = new TextButton ("Bypass Button"));
BypassBtn->setButtonText (TRANS("Bypass"));
BypassBtn->addListener (this);
addAndMakeVisible (label = new Label ("new label",
TRANS("Stereo Width Factor:")));
label->setFont (Font (15.00f, Font::plain));
label->setJustificationType (Justification::centredLeft);
label->setEditable (false, false, false);
label->setColour (Label::textColourId, Colour (0xffa34747));
label->setColour (TextEditor::textColourId, Colours::black);
label->setColour (TextEditor::backgroundColourId, Colour (0x00000000));
//[UserPreSize]
//[/UserPreSize]
setSize (600, 400);
//[Constructor] You can add your own custom stuff here..
class getProcessor()->RequestUIUpdate()// UI update must be done each time a new editor is constructed
startTimer(200)//starts timer with interval of 200mS
BypassBtn->setClickingTogglesState(true);
//[/Constructor]
}
StereoWidthCtrlAudioProcessorEditor::~StereoWidthCtrlAudioProcessorEditor()
{
//[Destructor_pre]. You can add your own custom destruction code here..
//[/Destructor_pre]
WidthCtrlSld = nullptr;
BypassBtn = nullptr;
label = nullptr;
//[Destructor]. You can add your own custom destruction code here..
//[/Destructor]enter code here
}
class is a keyword mainly used in declarations. You probably meant:
getProcessor()->RequestUIUpdate();

Using Qt control panel function in OpenCV error NULL pointer

I tried to google my question in several website but it still no answer.
My problem is look like this http://opencv-users.1802565.n2.nabble.com/Runtime-error-for-createTrackbar-in-control-panel-td7550203.html
I tried to create the control panel in OpenCV window using Qt integration as show in an example of OpenCV Document: http://docs.opencv.org/modules/highgui/doc/qt_new_functions.html
By this function, it should be separate between image window (with 'imshow()') and control panel (with in other window, called control panel).
However, it is not work when run to the code 'createTrackbar(num1, NULL, &val1 , 255, NULL);' the error message 'Null pointer' is shown. However, if I change the parameter to the window name it is work!.
My code is like this:
#include <...opencv.hpp>
#include <...highgui.hpp>
char* num1 = "testTrack";
int val1 = 100;
const string mainwin = "show";
int main()
{
while (true)
{
frame = capture();
createTrackbar(num1, NULL, &val1 , 255, NULL);
process_frame = image_processing(frame);
imshow(mainwin, process_frame);
// [Exit the system]
if (condition)
break;
}
}
Do you have any idea?
I don't know if this answer is useful after all this time, but you need to use an empty string instead of a null pointer.
Try with:
createTrackbar(num1, "", &val1 , 255, NULL);

My MFC Application Freezes if I Switch to Another App

Commence V 2.0 of this question.
My VC++ MFC application compiles and runs just fine. That is, until I switch to another window. As soon as my program loses focus, it freezes; I cannot switch back to it and if I move a window that is in front of it, my app window displays white in the space that the other window was covering.
Since I first posted this question I have been able to pinpoint what portion of my program is causing this behavior, but I still don't know what lines of code are wrong or why.
The main dialog of my MFC application contains a CTabCtrl called m_MainTabControl. This main tab control holds onto two tabs labeled "Basic Design" and "Advanced Design", each of which are tied to their own dialogs. Both dialogs contain a CTabCtrl with several tabs. And thus my problem is born.
When I first created this tab-within-tab structure, I was having problems with my program freezing up when I tried to switch between inner tabs. Needless to say I was puzzled by this, until I noticed that if I first clicked on a control on one of the inner tabs I could then switch tabs just fine. So without fully understanding what the problem was, I set the focus to the first inner tab of the first inner tab on program startup. Problem half solved. When I ran the program I could click around on the first set of inner tabs just fine; if I switched to the second outer tab and tried clicking around its inner tabs without first clicking on a dialog control, it would freeze again. So I made a Focus function to focus the currently selected inner tab of the currently selected outer tab and called that in my tab change event (the one that goes off when you click on another tab).
That is how I got to the point I was at when I first asked this question. I thought my program was working just fine, until I played around with it a bit more and noticed it wasn't playing nicely when I flipped back and forth between it and another window or program. More specifically, as soon as my program goes out of focus some process goes haywire and takes up an entire CPU's worth of processing.
And now, the reason I explained my little tab structure and focus problems in such great detail: after much experimentation, I found that if I commented out the second tab on my outer tab structure (i.e. the "Advanced Design" dialog and all of its little children tabs) the remaining bit of my program runs fine, and I can switch to another window and back without a fight. "Great," I thought, "that's only about 90% of my program that I just commented out to get this working. Let's try and pare it down further." I put the "Advanced Design" tabbed dialog back in, but commented out the tabbed dialogs created by the tab control within "Advanced Design" and everything still worked fine. One by one I put back the tabbed dialogs belonging to "Advanced Design"'s tab control and every time I reintroduced The Error regardless of what tab I uncommented. I should also point out that one of the first tabs I tried putting back in (alone, of course) was my "Margins" tab, which is a MarginDlg class that I ALSO USE UNDER MY "Basic Design" TAB WITHOUT TROUBLE. This leads me to believe that there is something specific I have to do when creating tabbed dialogs within tabbed dialogs that I am not doing, or am doing incorrectly, kind of like how I had to mess with focusing to make it work at first.
I would be EXTREMELY grateful for any light that can be shed on the situation. I am including what I think are relevant snippets of code; as always, let me know if more is needed.
variable declarations from main dialog's .h file:
//tab stuff
CTabCtrl m_MainTabControl;
vector<CDialog*> m_tabPages;
SimpDesDlg* simpDesDlg;
AdvDesDlg* advDesDlg;
When my application starts up, it creates my main dialog, and the OnInitDialog() is called:
(everything above the TODO: comment is default VS stuff dealing with the stupid about dialog)
BOOL CspAceDlg::OnInitDialog()
{
CDialog::OnInitDialog();
// Add "About..." menu item to system menu.
// IDM_ABOUTBOX must be in the system command range.
ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);
ASSERT(IDM_ABOUTBOX < 0xF000);
CMenu* pSysMenu = GetSystemMenu(FALSE);
if (pSysMenu != NULL)
{
CString strAboutMenu;
strAboutMenu.LoadString(IDS_ABOUTBOX);
if (!strAboutMenu.IsEmpty())
{
pSysMenu->AppendMenu(MF_SEPARATOR);
pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);
}
}
// Set the icon for this dialog. The framework does this automatically
// when the application's main window is not a dialog
SetIcon(m_hIcon, TRUE); // Set big icon
SetIcon(m_hIcon, FALSE); // Set small icon
// TODO: Add extra initialization here
///////////////////////////////////////
DrawResultsArea();
DrawTabs();
theApp.Calculate();
Focus();
//simpDesDlg->Focus();
//DrawToolbar();
return FALSE; // return TRUE unless you set the focus to a control
}
DrawTabs() is where I create the tabs for my outer tab control:
void CspAceDlg::DrawTabs()
{
simpDesDlg = new SimpDesDlg;
m_tabPages.push_back(simpDesDlg);
advDesDlg = new AdvDesDlg;
m_tabPages.push_back(advDesDlg);
// create a tcItem to hold the name of each tab during creation
// and then get inserted, and arrays holding the tab names and IDs of
// the dialogs they refer to
TC_ITEM tcItem;
PSTR pszTabNames[] = {"Basic Design", "Advanced Design"};
UINT pszTabItems[] = {IDD_SIMPLEDESIGNTAB, IDD_ADVANCEDDESIGNTAB};
//every member of m_tabPages[] will become a tab
for (int i = 0; i < int(m_tabPages.size()); i++)
{
//set up the tab name
tcItem.mask = TCIF_TEXT;
tcItem.pszText = pszTabNames[i];
tcItem.cchTextMax = int(strlen(pszTabNames[i]));
//insert the new tab into the tab control and create the dialog window
m_MainTabControl.InsertItem(i, &tcItem);
m_tabPages[i]->Create(pszTabItems[i], &m_MainTabControl);
}
//redraw so that the dialogs don't appear in upper left corner and cover the tabs
CRect tabRect, itemRect;
int nX, nY, nXc, nYc;
m_MainTabControl.GetClientRect(&tabRect);
m_MainTabControl.GetItemRect(0, &itemRect);
nX=itemRect.left;
nY=itemRect.bottom+1;
nXc=tabRect.right-itemRect.left-1;
nYc=tabRect.bottom-nY-1;
m_tabPages[0]->SetWindowPos(&wndTop, nX, nY, nXc, nYc, SWP_SHOWWINDOW);
for(int nCount=1; nCount < int(m_tabPages.size()); nCount++){
m_tabPages[nCount]->SetWindowPos(&wndTop, nX, nY, nXc, nYc, SWP_HIDEWINDOW);
}
}
Main dialog's Focus() method:
void CspAceDlg::Focus()
{
int curSel = m_MainTabControl.GetCurSel();
m_tabPages[curSel]->SetFocus();
//if it's the basic design, we need to focus its first tab
if (curSel == 0)
{
simpDesDlg->Focus();
}
//if it's the advanced design, we need to focus its first tab
else if (curSel == 1)
{
advDesDlg->Focus();
}
}
code for m_MainTabControl's tab selection change event:
void CspAceDlg::OnTcnSelchangeBuildtabs(NMHDR *pNMHDR, LRESULT *pResult)
{
for (int i = 0; i < int(m_tabPages.size()); i++)
{
m_tabPages[i]->ShowWindow(m_MainTabControl.GetCurSel() == i ? SW_SHOW :
SW_HIDE);
}
Focus();
*pResult = 0;
}
SimpDesDlg and AdvDesDlg's tabs use identical code except for tab initialization (just creating different tabs for each) so here's the code for AdvDesDlg:
OnInitDialog():
BOOL AdvDesDlg::OnInitDialog()
{
CDialog::OnInitDialog();
DrawTabs();
return false;
}
adding in the tabbed dialogs:
void AdvDesDlg::DrawTabs()
{
//Make the dialogs for the tabs
antennaDlg = new AntennaDlg;
commSEDlg = new CommSEDlg;
encryptorDlg = new EncryptorDlg;
marginDlg = new MarginDlg;
miscDlg = new MiscDlg;
transRecDlg = new TransRecDlg;
//add them all to the tabPages vector
m_tabPages.push_back(antennaDlg);
m_tabPages.push_back(commSEDlg);
m_tabPages.push_back(encryptorDlg);
m_tabPages.push_back(marginDlg);
m_tabPages.push_back(miscDlg);
m_tabPages.push_back(transRecDlg);
//m_tabPages[0] = new AntennaDlg;
//m_tabPages[1] = new CommSEDlg;
//m_tabPages[2] = new EncryptorDlg;
//m_tabPages[3] = new MarginDlg;
//m_tabPages[4] = new MiscDlg;
//m_tabPages[5] = new TransRecDlg;
//antennaDlg = (AntennaDlg*) m_tabPages[0];
//commSEDlg = (CommSEDlg*) m_tabPages[1];
//encryptorDlg = (EncryptorDlg*) m_tabPages[2];
//marginDlg = (MarginDlg*) m_tabPages[3];
//miscDlg = (MiscDlg*) m_tabPages[4];
//transRecDlg = (TransRecDlg*) m_tabPages[5];
// create a tcItem to hold the name of each tab during creation
// and then get inserted, and arrays holding the tab names and IDs of
// the dialogs they refer to
TC_ITEM tcItem;
PSTR pszTabNames[] = {"Antenna", "Comm Support", "Encryptor", "Margins", "Misc", "Trasmitter/Receiver"};
UINT pszTabItems[] = {IDD_ANTENNATAB, IDD_COMMSETAB, IDD_ENCRYPTORTAB, IDD_MARGINTAB, IDD_MISCTAB, IDD_TRANSRECTAB};
//every member of m_tabPages[] will become a tab
for (int i = 0; i < int(m_tabPages.size())/*(sizeof(m_tabPages)/sizeof(m_tabPages[0]))*/; i++)
{
//set up the tab name
tcItem.mask = TCIF_TEXT;
tcItem.pszText = pszTabNames[i];
tcItem.cchTextMax = int(strlen(pszTabNames[i]));
//insert the new tab into the tab control and create the dialog window
advTab.InsertItem(i, &tcItem);
m_tabPages[i]->Create(pszTabItems[i], &advTab);
}
//redraw so that the dialogs don't appear in upper left corner and cover the tabs
CRect tabRect, itemRect;
int nX, nY, nXc, nYc;
advTab.GetClientRect(&tabRect);
advTab.GetItemRect(0, &itemRect);
nX=itemRect.left;
nY=itemRect.bottom+1;
nXc=tabRect.right-itemRect.left-1;
nYc=tabRect.bottom-nY-1;
//m_tabPages[0]->SetWindowPos(&wndTop, nX, nY, nXc, nYc, SWP_SHOWWINDOW);
for(int nCount=/*1*/0; nCount < int(m_tabPages.size())/*(sizeof(m_tabPages)/sizeof(m_tabPages[0]))*/; nCount++){
m_tabPages[nCount]->SetWindowPos(&wndTop, nX, nY, nXc, nYc, SWP_HIDEWINDOW);
}
}
And the Focus() and tab changing:
void AdvDesDlg::Focus()
{
this->SetFocus();
for (int i = 0; i < int(m_tabPages.size())/*(sizeof(m_tabPages)/sizeof(m_tabPages[0]))*/; i++)
{
m_tabPages[i]->ShowWindow(advTab.GetCurSel() == i ? SW_SHOW :
SW_HIDE);
}
int curSel = advTab.GetCurSel();
m_tabPages[curSel]->SetFocus();
}
void AdvDesDlg::OnTcnSelchangeAdvDesign(NMHDR *pNMHDR, LRESULT *pResult)
{
for (int i = 0; i < int(m_tabPages.size())/*(sizeof(m_tabPages)/sizeof(m_tabPages[0]))*/; i++)
{
m_tabPages[i]->ShowWindow(advTab.GetCurSel() == i ? SW_SHOW :
SW_HIDE);
}
int curSel = advTab.GetCurSel();
m_tabPages[curSel]->SetFocus();
*pResult = 0;
}
Debug your app, get it into this state, then go Debug / Break All. Find the main thread in the Threads window, then look at the call stack. Somewhere in the call stack will be your code that's causing the hang.
Note that in order to get a sensible call stack you'll need to point Visual Studio at Microsoft's symbol servers; see http://msdn.microsoft.com/en-us/library/b8ttk8zy.aspx
The behavior you describe usually occurs when you are running some process without allowing the message pump to run.
What does your app do? I assume you start it, and then either hit a button or select a menu item to start some process.
If the program behaves normally when you first start it (before you click to start your processing), but then behaves as you describe after starting the process, then that's your problem.
You'll have to move that processing into another thread to allow the MFC GUI to remain responsive.
I just stumbled about a very similar situation. My setup:
A CPropertySheet containing several CPropertyPages
A CTabCtrl inside one CPropertyPage
Several CDialogs as part of the CTabCtrl
Using a control in one specific CDialog and then switching to another application (e.g. Visual Studio via a hit breakpoint) will stall my application (the respective CPU core ends up at 100% load)
Using a control in the same specific CDialog but then switching to another CPropertyPage before switching to another application will not result in any problems
After some research I found this Knowledge Base article which hinted me to a solution. The specific CDialog which triggered the stall had the line EXSTYLE WS_EX_CONTROLPARENT in its resource definition. Removing the line solved the problem.
This prevents being able to tab into the CDialog, but that problem is slightly less serious and I might come back to it another day.
I had a similar issue. I had multiple nested windows, some with the WS_EX_CONTROLPARENT style, some not. The thing is: Either all inner windows have to have this style, or none of them (at least apparently).