CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 7 of 7
  1. #1
    Join Date
    Sep 2004
    Posts
    6

    Question help on a label MouseIcon property

    Hi everybody!

    I'm developping an application using VB5 (SP3) on a NT4 SP6 PC.
    Here's my problem : i have a label on a form. Clicking on this label loads a form. OK, it's pretty simple. This label has its MousePointer set to value "99-custom" and its MouseIcon set to some pointer.ico file.
    At runtime, when the mouse pointer is on the label, and it's the pointer.ico i have defined for it. Then i click on the label, loads the other form and then go back to the first form => the mouse pointer on the label is the default one and not the pointer.ico one as it should be!

    when i try to debug this, i can see that the label MousePointer is still set to value "99" but the hPal property of the Picture defined for the label MouseIcon is set to "Error Automation"...
    I have no idea what to do? If anybody can give me a hint please?

    Err, maybe my problem's too simple, but really, i'm a beginner coder... maybe i missed something?

    I've read some posts about the change of mouse cursors when moving over over controls... and it works just fine, well, before i click on the label...
    after that, the cursor is set on default cursor, for all the labels that are normally set to a customized cursor...
    Attached Images Attached Images  
    Last edited by nekosan; September 21st, 2004 at 11:01 AM.

  2. #2
    Join Date
    Sep 2004
    Posts
    6

    Unhappy Re: help on a label MouseIcon property

    can't anyone help? at least to give me an idea of how to debug this?

  3. #3
    Join Date
    Dec 2001
    Posts
    6,332

    Re: help on a label MouseIcon property

    When the label is clicked, try loading a blank form instead and see if it's ok. If the problem still occurs, then perhaps a control on a loaded form is causing it. If it's ok, then perhaps a control on the form being loaded when the label is clicked is causing the problem. Other than that, make sure you are using Option Explicit at the top of your forms.

    Let us know what you find.
    Please remember to rate the posts and threads that you find useful.
    How can something be both new and improved at the same time?

  4. #4
    Join Date
    Sep 2004
    Posts
    6

    Talking Re: help on a label MouseIcon property

    ok, the problem doesn't occur when i load a blank form with a click on the label... I know where to look now, on the form being loaded by the label click...
    I still don't know what to do, but it's a start!

    thanks!

    PS : i already use the option Explicit on all my forms...
    Last edited by nekosan; September 22nd, 2004 at 07:28 AM.

  5. #5
    Join Date
    Sep 2004
    Posts
    6

    Smile Re: help on a label MouseIcon property

    OK, here's what happening :

    Clicking on the label with the custom cursor loads a modal form.
    When the user closes this form, the following lines of code (on the modal form) are executed :

    Unload Me
    Screen.MousePointer = 1

    => So setting the mousepointer property of the object Screen to the Arrow cursor value makes the cursor look like an arrow no matter where the mouse is, even when the mouse is over my label, which was set at design time to a custom cursor???

    I've learnt something there...

  6. #6
    Join Date
    Dec 2001
    Posts
    6,332

    Re: help on a label MouseIcon property

    I'd set the cursor before unloading, but that's probably not effecting anything.

    What happens when you use a value of zero instead? Also, Me.MousePointer will only effect the one form, not all of them.
    Last edited by WizBang; September 23rd, 2004 at 04:08 PM.
    Please remember to rate the posts and threads that you find useful.
    How can something be both new and improved at the same time?

  7. #7
    Join Date
    Sep 2004
    Posts
    6

    Lightbulb Re: help on a label MouseIcon property

    Setting the cursor before unloadind doesn't change the problem.

    Setting Screen.MousePointer = 0 does the trick!

    it works now, thanks a lot!!!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured