Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Toolkit Pro
  New Posts New Posts RSS Feed - CXTPStatusBar indicatioproblem in modalless dialog
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

CXTPStatusBar indicatioproblem in modalless dialog

 Post Reply Post Reply
Author
Message
lajbr View Drop Down
Newbie
Newbie


Joined: 20 April 2005
Location: Czech Republic
Status: Offline
Points: 12
Post Options Post Options   Thanks (0) Thanks(0)   Quote lajbr Quote  Post ReplyReply Direct Link To This Post Topic: CXTPStatusBar indicatioproblem in modalless dialog
    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.
Back to Top
mgampi View Drop Down
Senior Member
Senior Member
Avatar

Joined: 14 July 2003
Status: Offline
Points: 1201
Post Options Post Options   Thanks (0) Thanks(0)   Quote mgampi Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
lajbr View Drop Down
Newbie
Newbie


Joined: 20 April 2005
Location: Czech Republic
Status: Offline
Points: 12
Post Options Post Options   Thanks (0) Thanks(0)   Quote lajbr Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
mgampi View Drop Down
Senior Member
Senior Member
Avatar

Joined: 14 July 2003
Status: Offline
Points: 1201
Post Options Post Options   Thanks (0) Thanks(0)   Quote mgampi Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
lajbr View Drop Down
Newbie
Newbie


Joined: 20 April 2005
Location: Czech Republic
Status: Offline
Points: 12
Post Options Post Options   Thanks (0) Thanks(0)   Quote lajbr Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.203 seconds.