Announcement

Collapse
No announcement yet.

Mouse sensitivity, mouseptr

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Mouse sensitivity, mouseptr

    How can I change the mousepointer when the mouse is
    over a certain region of my child dialog?

    The following works, but only for very gross mouse
    movements and then the new pointer usually reverts back
    to the default.

    Also, is there a way to make the mouse into a html-like hyperlink
    hand. The region contains a list of files. Clicks on a file name
    shell out to notepad.

    Thanks.

    Code:
      CASE %WM_MOUSEMOVE
              LOCAL ztext AS STRING, x&
              x&=LOWRD(CBLPARAM)
              IF x&>22 AND x&<200 THEN
                MOUSEPTR 10
                zText = "Mouse Position:" + STR$(LOWRD(CBLPARAM)) + ","+STR$(HIWRD(CBLPARAM))
              ELSE
                 ztext="Not hot"
                 MOUSEPTR 1
              END IF
              SetWindowText hdlg, BYCOPY zText
              FUNCTION = 0
              EXIT FUNCTION

    ------------------


    ------------------

  • #2
    Regarding the Hand cursor, doing it manually by monitoring the position
    of the mouse if it falls within your desired Rectangle...
    Code:
    Call SetCursor(LoadCursor(%NULL,ByVal %IDC_HAND))
     
    'To restore it, or as soon as you jump out of you Rect into the client area
    'it will automatically do it for you anyway...
    Call SetCursor(LoadCursor(%NULL,ByVal %IDC_ARROW))
    Or you can do it by means of changing the window class cursor.

    HTH
    Regards,
    Jules
    Best regards
    Jules
    www.rpmarchildon.com

    Comment


    • #3
      The SetCursor() API should be used in the WM_SETCURSOR message...

      The reason YOUR MousePtr is removed is because the windowclass get's another (unhandled) WM_SETCURSOR message and then uses the windowclass's cursor handle.
      (Forget the VB method(on/off))

      ------------------
      hellobasic

      Comment


      • #4
        Larry,

        Expanding on what Jules just said:

        Assuming this is one of the standard controls, just superclass
        the control and change the cursor in the window class structure.

        Cheers,
        Cecil

        ------------------

        Comment


        • #5
          larry;

          also see this link if it is still valid, or do a topic search...

          http://www.powerbasic.com/support/pb...ad.php?t=22523

          'message http://www.powerbasic.com/support/pb...ad.php?t=22523
          'forum: source code
          'topic: pbdll32: a url custom control
          'name: dave navarro, member
          'date: april 03, 1999 12:37 am

          regards,
          jules
          Best regards
          Jules
          www.rpmarchildon.com

          Comment


          • #6
            What a wonderful community. Thank you everyone. This forum has been
            sooo helpful as I learn winapi

            I now see that the problem is caused by %SS_NOTIFY CALL CBF_SHOWFILE
            at the end of CONTROL ADD LABEL. Without the notify, the mouse
            hand and arrow work fine. With the call back function, the WM_MOUSEMOVE
            is only occassionally triggered. I need the notify so I can SHELL.

            Is there a different style or extended style I should be using? Is there a
            call back message for a label I can use?



            [This message has been edited by Larry Rudner (edited June 20, 2001).]

            Comment


            • #7
              Larry,

              It is difficult to say exactly, do you have a compilable code snippet
              I can try? I don't use DDT that often, but if you post your DDT code I
              can make some sense of it for you. Static Labels generally don't do much
              in the way of notifications, you may need to sublcass it instead and
              trap some messages, that's easy enough and I can show you how to do
              it if you like.

              Regards,
              Jules

              Best regards
              Jules
              www.rpmarchildon.com

              Comment


              • #8
                Got it. This was hard for me. The goal was to have the cursor change into a hand
                when over a list of files. By using SetClassLong I was able to set the cursor to
                a hand when the mouse is over the specified control. I solved the
                mouse location problem using WM_setCursor, but anchoring the cursor to
                the control is a far better solution.


                Code:
                for i=1 to n
                 CONTROL ADD LABEL, CBHNDL,  2000+i,  "h:\file"+TRIM$(STR$(i)), 10, 18+12*i, 92, 10, %SS_NOTIFY  CALL cbf_file
                 SetClassLong GetDlgItem(CBHNDL, 2000+i), %GCL_HCURSOR, LoadCursor (BYVAL 0&, BYVAL %IDC_HAND)
                next i


                ------------------

                Comment


                • #9
                  > but anchoring the cursor to the control is a far better solution.
                  Wrong
                  You changed it for ALL statics now



                  ------------------
                  hellobasic

                  Comment

                  Working...
                  X