🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: borland.public.cppbuilder.nativeapi
8 messages
8 total messages Started by CapStick Sat, 12 Apr 2003 15:57
Doubleclick
#16981
Author: CapStick
Date: Sat, 12 Apr 2003 15:57
21 lines
1498 bytes
I would be grateful for help with the following

IDC EXAMPLE is a static control (child window)
not in a dialog box but in a main window

which gets a reaction from one left click

I would like it to react to a doubleclick only

case WM_COMMAND:
    switch(LOWORD(wParam))
        {
              case IDC_EXAMPLE:
          // do something here only on doubleclick
         // currently does something on single left click


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.463 / Virus Database: 262 - Release Date: 17/03/2003
Re: Doubleclick
#16983
Author: Remy Lebeau (TeamB)
Date: Sat, 12 Apr 2003 20:09
15 lines
1524 bytes
"CapStick" <lol@ljones81.fsnet.co.uk> wrote in message
news:3e9836ec@newsgroups.borland.com...

> IDC EXAMPLE is a static control (child window)
> not in a dialog box but in a main window
>
> which gets a reaction from one left click

You're testing for WM_COMMAND, which has nothing to do with mouse clicks.
There are separate, more specialized, messages for handling that, such as
WM_LBUTTONDBLCLICK.  So, why not just test for that instead?


Gambit
Re: Doubleclick
#16984
Author: CapStick
Date: Sat, 12 Apr 2003 22:22
52 lines
2436 bytes
"Remy Lebeau (TeamB)" <gambit47@yahoo.com> wrote in message
news:3e987243$1@newsgroups.borland.com...
>
> "CapStick" <lol@ljones81.fsnet.co.uk> wrote in message
> news:3e9836ec@newsgroups.borland.com...
>
> > IDC EXAMPLE is a static control (child window)
> > not in a dialog box but in a main window
> >
> > which gets a reaction from one left click
>
> You're testing for WM_COMMAND, which has nothing to do with mouse clicks.
> There are separate, more specialized, messages for handling that, such as
> WM_LBUTTONDBLCLICK.  So, why not just test for that instead?
>
>
> Gambit
>
>
When testing for mouse click
By using
case WM_COMMAND:
    switch(LOWORD(wParam))
        {
 case  ID_CONTROL_1:  do this

 case   ID_CONTROL_2:  do that
I am able to identify and get action from
each control from its id

Am i missing the point here should i be carrying out some sort of hit test
with mouse parameters

Because Just Putting
case WM_LBUTTONDBLCLK
is only recognised if i double click in
 main window client area

Not if i doubleclick in child windows
i only need one of my controls to accept a double click
Main window is set to CS_DBLCKLS
and registered with  WS_CLIPCHILDREN
USING WIN32 API free Borland Compiler




---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.463 / Virus Database: 262 - Release Date: 17/03/2003
Re: Doubleclick
#16985
Author: Remy Lebeau (TeamB)
Date: Sat, 12 Apr 2003 22:27
45 lines
2884 bytes
"CapStick" <lol@ljones81.fsnet.co.uk> wrote in message
news:3e98910e$1@newsgroups.borland.com...

> I am able to identify and get action from
> each control from its id

WM_COMMAND itself does not indicate mouse clicks.  In order to use
WM_COMMAND for anything meaningful, you must test it for specify
notification codes in the HIWORD(lParam).  You do not show your code doing
that at all.

However, as I said earlier, mouse clicks specifically do not use WM_COMMAND
to begin with, thus you are testing for the wrong message to begin with.
Not only that, but WM_COMMAND is sent to a given window's parent, not to the
window itself directly.  Unlike mouse messages such as WM_LBUTTONDBLCLICK,
which is sent to the window directly.  That is the message you should be
using for what you're asking for.  You're not currently doing that at all

> Am i missing the point here should i be carrying out
> some sort of hit test with mouse parameters

No, you should be using completely different messages to begin with.
WM_COMMAND is not the correct message to use for this situation.

> Because Just Putting
> case WM_LBUTTONDBLCLK
> is only recognised if i double click in
>  main window client area
> Not if i doubleclick in child windows

Correct, because it appears that you are catching messages on the main
window level, and WM_LBUTTONDBLCLICK messages are sent to the actual window
clicked on, not the parent window as with WM_COMMAND.  To catch the message
for a particular child window, you would have to catch the message at the
child window level instead.

> i only need one of my controls to accept a double click

All the more reason to use WM_LBUTTONDBLBLICK on the child window level
instead.  Subclass that particular child window directly, then you can
intercept WM_LBUTTONDBLBLICK directly for that child window itself.


Gambit
Re: Doubleclick
#16986
Author: CapStick
Date: Sat, 12 Apr 2003 23:10
64 lines
2636 bytes
Thank you for your answers Remy

I can see from win32 help that this
case WM_COMMAND:
    switch(LOWORD(wParam))
is not a standard call in mouse messages
I learnt this
_____________________________________________________________
case WM_COMMAND:
    switch(LOWORD(wParam))
        {
              case IDC_EXAMPLE:

______________________________________________________
from a tutorial on line.


__________________________________________________________
the following is a line from the tutorial

case WM_COMMAND:
   switch(LOWORD(wParam))
   {
    case IDC_ADD:
    {
     // When somebody clicks the Add button, first we get the number of
     // they entered
etc etc
_____________________________________________________


My Child Windows are All set to SS_NOTIFY

Whilst my child windows are not buttons but static controls.
I am wondering what other method  i can use to identify when each child
window is clicked in
*Even once* without subclassing it.

You see the method of using WM_COMMAND
then
switch(LOWORD(wParam))
is already working fine for single mouseclicks

so i am now extremely confused.

I am using windows ME

I am hoping that my app will work under other platforms

So Given a main Window
and say three child windows with SS_NOTIFY
What would be the standard
way of identifying
when the left mouse button was clicked on any of the three windows.





---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.463 / Virus Database: 262 - Release Date: 17/03/2003
Re: Doubleclick
#16987
Author: user
Date: Sun, 13 Apr 2003 00:18
14 lines
1978 bytes
If I understand it correctly, the default behavior of a Windows control 
for a left mouse click is to send a WM_COMMAND message to its parent, 
along with some appropriate parameters. Because of this, you (usually) 
only need to handle the messages sent to the parent window, which is 
what you have learned and are doing. Since the control ignores double 
clicks by default, however, your parent window won't be getting any 
appropriate messages for you to handle.

To get the effect you want, you can subclass the control to make respond 
to double clicks, as has been suggested. Alternatively, you could set up 
a handler in the parent window that calculates, based on the mouse 
coordinates when the event occurred, whether the double click occurred 
while your label control was under the pointer, and respond 
appropriately. A little easier, a little uglier.
Re: Doubleclick
#16988
Author: Remy Lebeau (TeamB)
Date: Sun, 13 Apr 2003 01:25
27 lines
1970 bytes
"CapStick" <lol@ljones81.fsnet.co.uk> wrote in message
news:3e989c62@newsgroups.borland.com...

> I can see from win32 help that this
> case WM_COMMAND:
>     switch(LOWORD(wParam))
> is not a standard call in mouse messages

Correct, because mouse events do not use WM_COMMAND at all.

> My Child Windows are All set to SS_NOTIFY

SS_NOTIFY only applies to STATIC controls, not buttons.  If you are, in
fact, using STATIC controls and want to catch their double-clicks, then
fine, WM_COMMAND is what to use.  But you still must test the HIWORD(wParam)
before you can process the rest of the message data correctly.  That is
definately something your original code is missing.  For example:

    case WM_COMMAND:
        if( (HIWORD(wParam) == STN_DBLCLK) && (LOWORD(wParam) ==
IDC_EXAMPLE) )
        {
          // do something here only on doubleclick


Gambit
Re: Doubleclick
#16993
Author: CapStick
Date: Sun, 13 Apr 2003 12:42
9 lines
1343 bytes
Big Thanks To Remy and to UserDomain
Re The Double Click



---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.463 / Virus Database: 262 - Release Date: 17/03/2003
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads