Print Page | Close Window

TaskPanel XTP_TPN_DBLCLICK and CLICK Msgs

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=2723
Printed Date: 08 November 2025 at 9:02pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: TaskPanel XTP_TPN_DBLCLICK and CLICK Msgs
Posted By: Hazelnut
Subject: TaskPanel XTP_TPN_DBLCLICK and CLICK Msgs
Date 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!

 




Replies:
Posted By: Oleg
Date 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


Posted By: Hazelnut
Date 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);

}



Posted By: Oleg
Date 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


Posted By: Hazelnut
Date 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...

 




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