Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Toolkit Pro
  New Posts New Posts RSS Feed - TaskPanel XTP_TPN_DBLCLICK and CLICK Msgs
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

TaskPanel XTP_TPN_DBLCLICK and CLICK Msgs

 Post Reply Post Reply
Author
Message
Hazelnut View Drop Down
Groupie
Groupie
Avatar

Joined: 22 July 2005
Location: United States
Status: Offline
Points: 18
Post Options Post Options   Thanks (0) Thanks(0)   Quote Hazelnut Quote  Post ReplyReply Direct Link To This Post Topic: TaskPanel XTP_TPN_DBLCLICK and CLICK Msgs
    Posted: 15 August 2005 at 12:25pm

Hi All,

Is there any way to ensure that when a user double clicks on a Task Panel Item, only the XTP_TPN_DBLCLICK message is sent? Right now, double clicking on an item sends both the XTP_TPN_CLICK and XTP_TPN_DBLCLICK messages which really messes up the logic in my application based on the two different messages.

Here is part of the switch statement code...

case XTP_TPN_DBLCLICK:

{

   if(theApp.m_bOkToCreateNewTestViewOnDbleClick)

   {

      if((((CMainFrame *) AfxGetMainWnd())->m_TestViewEntries.GetNumberOfOpenTestViews() < MAX_OPEN_TESTS))

      {

         theApp.OnFileNewDevice(); // double click creates a new test view

// Device selection changed, tell mainframe to relay this to active child frame...

         CXTPTaskPanelGroupItem* pItem = (CXTPTaskPanelGroupItem*)lParam;

         AfxGetMainWnd()->SendMessage(WCTMSG_DEVICE_SETTINGS_CHANGED, pItem->GetID(), 0L);

         }

      }

      return TRUE;

   }

break;

case XTP_TPN_CLICK:

{

   // Device selection changed, tell mainframe to relay this to active child frame...

   CXTPTaskPanelGroupItem* pItem = (CXTPTaskPanelGroupItem*)lParam;

   AfxGetMainWnd()->SendMessage(WCTMSG_DEVICE_SETTINGS_CHANGED, pItem->GetID(), 0L);

   return TRUE;

   }

break;

Thanks!

 



Edited by Hazelnut
Back to Top
Oleg View Drop Down
Senior Member
Senior Member


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: 16 August 2005 at 2:39am

 

Hi,

How do you see this? Task Panel must read mind of user after first click to know if he want to click again for Double click ?

 

i'm serious :)

Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
Hazelnut View Drop Down
Groupie
Groupie
Avatar

Joined: 22 July 2005
Location: United States
Status: Offline
Points: 18
Post Options Post Options   Thanks (0) Thanks(0)   Quote Hazelnut Quote  Post ReplyReply Direct Link To This Post Posted: 16 August 2005 at 10:09am

Hi Oleg,

 

No, I don't expect TP to see the future, but I do expect it to remember the past!

Here is how I got around it.  It may not be the best solution, but it does work for my application. Thanks for the response!

/// Member vars....

UINT m_nTimerEvent;

int m_nClicks;

UINT m_uTimer;

LONG m_lTemp;

 

CDeviceView::CDeviceView()

{

   m_nTimerEvent = 0x1234;

   m_nClicks = 0;

   m_uTimer = 0;

}

 

LRESULT CDeviceView::OnOutbarNotify(WPARAM wParam, LPARAM lParam)

{

   switch (wParam)

   {

      case XTP_TPN_DBLCLICK:

     {

      if(m_uTimer == 0)

      {

         m_uTimer = SetTimer(m_nTimerEvent, 300, NULL);

      }

      m_nClicks += 2;

      m_lTemp = lParam;

      return TRUE;

   }

   break;

   case XTP_TPN_CLICK:

   {

        if(m_uTimer == 0)

        {

             m_uTimer = SetTimer(m_nTimerEvent, 300, NULL);

         }

         m_nClicks++;

         m_lTemp = lParam;

         return TRUE;

      }

      break;

   }

   return 0;

}

 

void CDeviceView::OnTimer(UINT nIDEvent)

{

   if(nIDEvent == m_nTimerEvent)

   {

      LONG lParam = m_lTemp;

      KillTimer(nIDEvent);

      m_uTimer = 0;

      if(m_nClicks == 1)

      {

         m_nClicks = 0;

         // Device selection changed, tell mainframe to relay this to active child frame...

        CXTPTaskPanelGroupItem* pItem = (CXTPTaskPanelGroupItem*)lParam;

        AfxGetMainWnd()->SendMessage(WCTMSG_LOCALDEVICE_SETTINGS_CHANGE,pItem->GetID(), 0L);

        TRACE("Single Click Only\n");

     }

     else if(m_nClicks >= 2)

   {

      m_nClicks = 0;

      if(theApp.m_bOkToCreateNewTestViewOnDbleClick)

      {

          if((((CMainFrame *) AfxGetMainWnd())->m_TestViewEntries.GetNumberOfOpenTestViews() < MAX_OPEN_TESTS))

         {

             theApp.OnFileNewDevice(); // double click creates a new test view

             // Device selection changed, tell mainframe to relay this to active child frame...

             CXTPTaskPanelGroupItem* pItem = (CXTPTaskPanelGroupItem*)lParam;

             AfxGetMainWnd()->SendMessage(WCTMSG_LOCALDEVICE_SETTINGS_CHANGE,pItem->GetID(), 0L);

          }

        }

      TRACE("Double Click Only\n");

      }

   }

   CWnd::OnTimer(nIDEvent);

}

Back to Top
Oleg View Drop Down
Senior Member
Senior Member


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: 17 August 2005 at 7:47am

scare code.

is it great prodlem to send both WCTMSG_LOCALDEVICE_SETTINGS_CHANGE for click and doubl click insterad this huge workaround?

 

Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
Hazelnut View Drop Down
Groupie
Groupie
Avatar

Joined: 22 July 2005
Location: United States
Status: Offline
Points: 18
Post Options Post Options   Thanks (0) Thanks(0)   Quote Hazelnut Quote  Post ReplyReply Direct Link To This Post Posted: 17 August 2005 at 12:04pm

>> scare code. <<

Hi Oleg,

The WCTMSG_LOCALDEVICE_SETTINGS_CHANGE is a message I use to indicate that a new device has been selected. My Task bar is a list of devices such as printer models.  A single click simply sends the message to the current active child frame so that it can update some internal data.  A double click opens a new document (and childframe) then sends the message.  Since the new child is now the active frame, it gets the device change message only and updates it's internal data ...the other frames do not get the notification unless they are reactivated.

It was important in my application to tell the difference between a click and a double click.  Without this workaround, the current frame would get the notification first then a new frame would be created getting the second message as well ...when the user doubleclicked.  The end result was that the new document and the old document selected the same device if it was a double click.  I wanted the old document to remain unchanged when a new document was created with a double click. As much as it is scare code, it was the only way I could think of doing it.  It's working quite well, but we'll see...

Thanks!

Paul...

 

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.047 seconds.