Print Page | Close Window

CXTPStatusBar indicatioproblem in modalless dialog

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Toolkit Pro
Forum Description: Topics Related to Codejock Toolkit Pro
URL: http://forum.codejock.com/forum_posts.asp?TID=6745
Printed Date: 21 December 2024 at 9:42pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: CXTPStatusBar indicatioproblem in modalless dialog
Posted By: lajbr
Subject: CXTPStatusBar indicatioproblem in modalless dialog
Date Posted: 27 March 2007 at 3:12pm
Hi,
I have problem with CXTPStatusBar in my application. My application is SDI with statusbar. There is a typical content i.e. status message on the left side and status keys (NUM, CAPS, SCRL) indication on the right side. The trouble is that I need to run modalless dialogs with statusbar and same indication too. If these dialogs were in separate (dialog based) application everything was ok. But from specific reasons I need to use this dialog directly from my application and it doesn't work. The big problem is, that status keys (NUM, CAPS, SCRL) indication doesn't work properly but status message works nearly fine (status message is successfully changing but it isn't filled when the dialog is started). I use the same code so I don't know what's wrong. My dialog is based on CXTPDialogBase<CXTResizeDialog>.

I have defined static UINT indicators[] =
{
    ID_SEPARATOR,           // status line indicator
    ID_INDICATOR_CAPS,
    ID_INDICATOR_NUM,
    ID_INDICATOR_SCRL,
};

I create statusbar in OnInitDialog() by:
if (!m_wndStatusBar.Create(this) || !m_wndStatusBar.SetIndicators(indicators, sizeof(indicators)/sizeof(UINT)))
    {
        TRACE0("Failed to create status bar\n");
        return -1;      // fail to create
    }

and use m_wndStatusBar.SetPaneInfo(0, ID_SEPARATOR, SBPS_STRETCH, 100); in OnInitDialog() too.

I use the connection in messagemap:
ON_UPDATE_COMMAND_UI(ID_INDICATOR_CAPS, OnUpdateKeyIndicator)
ON_UPDATE_COMMAND_UI(ID_INDICATOR_NUM, OnUpdateKeyIndicator)
ON_UPDATE_COMMAND_UI(ID_INDICATOR_SCRL, OnUpdateKeyIndicator)

and the update routine:
void CMyDlg::OnUpdateKeyIndicator(CCmdUI* pCmdUI)
{
    UINT nVK;
    UINT flag = 0x0001;

    switch (pCmdUI->m_nID)
    {
    case ID_INDICATOR_CAPS:
        nVK = VK_CAPITAL;
        break;

    case ID_INDICATOR_NUM:
        nVK = VK_NUMLOCK;
        break;

    case ID_INDICATOR_SCRL:
        nVK = VK_SCROLL;
        break;

    default:
        TRACE1("Warning: OnUpdateKeyIndicator - unknown indicator 0x%04X.\n",
            pCmdUI->m_nID);
        pCmdUI->ContinueRouting();
        return; // not for us
    }

    pCmdUI->Enable(::GetKeyState(nVK) & flag);
        // enable static text based on toggled key state
    ASSERT(pCmdUI->m_bEnableChanged);
}

I don't see something missing or extraordinary but OnUpdateKeyIndicator() isn't called. I tried to off the status key indication in the main application but without effect in this dialog... Can you help me please?

Thank you beforehand for each suggestion.

Lajbr

P.S.: I don't know if it's important but I use Codejock v10.4 and VS2005.



Replies:
Posted By: mgampi
Date Posted: 27 March 2007 at 6:00pm
Hi;
did you also implement a WM_KICKIDLE message handler? You have to send a WM_IDLEUPDATECMDUI message to your statusbar within the WM_KICKIDLE message handler.
Try to search for WM_KICKIDLE in toolkit samples - I believe the DialogPanes sample shows how to implement this.


-------------
Martin

Product: Xtreme Toolkit v 22.1.0, new Projects v 24.0.0
Platform: Windows 10 v 22H2 (64bit)
Language: VC++ 2022


Posted By: Oleg
Date Posted: 28 March 2007 at 1:02am
Hi,
 
WM_KICKIDLE  is sent only for modal dialogs.
 
you have to catch WM_IDLEUPDATECMDUI  in mainframe and send such message to your dialog.


-------------
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS


Posted By: lajbr
Date Posted: 28 March 2007 at 8:19am
Hi,
your solutin seems very good, but I tried it and it doesn't work. I use this part of code in the mainframe:
LRESULT CMainFrame::OnIdleUpdateCmdUI(WPARAM wParam, LPARAM lParam)
{   
    CTestEmailDlg* ptr = NULL;
    if(m_ctrlTestDlgList.size() > 0)
    {
        T_TESTDLG_LIST_ITER iter =  m_ctrlTestDlgList.begin();
        for(iter; iter != m_ctrlTestDlgList.end(); iter++)
        {
            ptr = *iter;
            if(!ptr)
                continue;

            if(ptr->IsActive())
            {               
                ptr->SendMessage(WM_IDLEUPDATECMDUI, wParam, lParam);   
                TRACE("send WM_IDLEUPDATECMDUI to the modalless dialog\n");
            }
        }
    }           
    return 0L;
}

and I joined this function in message map: ON_MESSAGE(WM_IDLEUPDATECMDUI, OnIdleUpdateCmdUI)

In the function I have a list of modalless dialogs, so I go throw the list and if the dialog is active then send this message to it. I see the TRACE info in output, so this functionality is successfully used, but it doesn't invoke the OnUpdateKeyIndicator() method in the dialog as you think. Isn't it connected rigth or did I make some mistake in the solution of your idea?

Thank you for help beforehand.

Lajbr


Posted By: mgampi
Date Posted: 29 March 2007 at 2:43am
Hi Lajbr;
 
Did you forward the WM_IDLEUPDATECMDUI message also to the integrated statusbar of your non modal dialog?
 
m_wndStatusBar.SendMessage(WM_IDLEUPDATECMDUI);
 
 


-------------
Martin

Product: Xtreme Toolkit v 22.1.0, new Projects v 24.0.0
Platform: Windows 10 v 22H2 (64bit)
Language: VC++ 2022


Posted By: lajbr
Date Posted: 29 March 2007 at 3:49am
Hi Mgampi;

yes, you are right, I forget at it of course. When I bind it with this message so it works fine.

I have found the solution of the minority problem with unfilled status after application startup too. It's neccessary to set the AFX_IDS_IDLEMESSAGE  text in OnInitDialog() by:

CString csText;
csText.LoadString(AFX_IDS_IDLEMESSAGE);

m_wndStatusBar.SetPaneText(0, csText);

Now it works fine.

Lajbr



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net