FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Tooltips

 
Post new topic   Reply to topic     Forum Index -> DFL
View previous topic :: View next topic  
Author Message
rhosking



Joined: 21 Aug 2006
Posts: 14
Location: UK

PostPosted: Fri Oct 06, 2006 9:13 am    Post subject: Tooltips Reply with quote

Me again Smile

I have a application message filter (Application.addMessageFilter) listening to wm_mousemove and wm_mousewheel messages.

When I add a tooltip to the application I no longer get these messages.

I think this is down to another message filter registered (before mine) by the form class which returns true and thus blocks any other message filters from running.

Could the gotMessage method in Application be modified so it always processes all message filters regardless of their return value then process the 'true' part if any of the message filters returned true. ie....

Code:

IMessageFilter[] local = filters;
            
bool filterstop = false;            
foreach(IMessageFilter mf; local)
{
   // Returning true prevents dispatching.
   if(mf.preFilterMessage(msg)) {
      filterstop = true;
   }
}
            
if (filterstop) {
   Control ctrl;
   ctrl = lookupHwnd(msg.hWnd);
   if(ctrl)
      ctrl.mustWndProc(msg);
   return;
}
Back to top
View user's profile Send private message
Chris Miller



Joined: 27 Mar 2004
Posts: 514
Location: The Internet

PostPosted: Fri Oct 06, 2006 11:54 am    Post subject: Re: Tooltips Reply with quote

The Windows tooltips must be blocking those messages at some other level because DFL doesn't add one of those filters for tooltips.
Back to top
View user's profile Send private message
rhosking



Joined: 21 Aug 2006
Posts: 14
Location: UK

PostPosted: Fri Oct 06, 2006 3:21 pm    Post subject: Reply with quote

The Form class which does have a message filter tests isDialogMessage (line 2216 in form.d) which when a tooltip is used in the application the filter returns true. If no tooltip is present it returns false.

Since the form's message filter just happens to be the first in the applications filter list it prevents other filters running if it returns true.
Back to top
View user's profile Send private message
Chris Miller



Joined: 27 Mar 2004
Posts: 514
Location: The Internet

PostPosted: Sun Oct 08, 2006 6:43 am    Post subject: Reply with quote

I'm not sure I want to do what you're proposing, but here is a way to achieve what you want:
Code:
bool delegate(inout Message)[] msgHandlers;

private class MsgFilterer: IMessageFilter
{
   bool preFilterMessage(inout Message m)
   {
      bool result = false;
      foreach(handler; msgHandlers)
      {
         if(handler(m))
            result = true;
      }
      return result;
   }
}

static this()
{
   Application.addMessageFilter(new MsgFilterer);
}

Now handlers should always be called first, even if a message is filtered out.
Back to top
View user's profile Send private message
rhosking



Joined: 21 Aug 2006
Posts: 14
Location: UK

PostPosted: Sun Oct 08, 2006 6:53 am    Post subject: Reply with quote

Ah yes that workaround should do the trick. Many thanks!
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic     Forum Index -> DFL All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group