+ Reply to Thread
Results 1 to 3 of 3

MouseClick Event

  1. #1
    Registered User
    Join Date
    01-19-2011
    Location
    Brazil
    MS-Off Ver
    Excel 2007
    Posts
    26

    MouseClick Event

    Hi everybody

    I have created sort of a different userform which is not an actual userform, but shapes and textboxes placed in an specific draworder that makes the whole thing looks like an userform buf with a different look (let's just say that I wanted to change the looks on the usual userforms).

    Instead of userform.show I change the visible property on the shapes to make it looks like an userform poping out.

    I have made everything works on it so far, and it's looking great. The last implementation I wan't to do is to make it movable. To that, something like this is needed:

    left button down event {
    capture cursor position
    compare with the shape area pixels
    case intersected store old cursor position
    }

    left button release event {
    if variable with old cursor position is set then {
    capture cursor position on releas mouse button
    compare new cursor position with stored old cursor position and do the whole position change
    }}


    Is there any way to do that (btw, the whole algorythm above is just some random idea I had, maybe it's just bullshit. Feel free to change it to the right way, or the easy way.)

    Later I might create some cool stuff such as making the whole "userform" invisible and create a temporary semi transparent shape that follows the mouse while left mouse button is down to simulate the drag window effect.

    Thanks for your attention.

  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: MouseClick Event

    Hello bagulhodoido,

    Shapes don't have events with the exception of a Click event to run an attached macro. These objects do not have a window procedure which is necessary for an object to process Windows system messages.

    You seem to going through a lot of trouble to mimic something that is already available to you. If you are going to this level of detail, why not use a UserForm? There is a lot you can do with it since it is a real window. The Windows API can change the shape of UserForm. You should Google "change UserForm shape". There are many examples.
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  3. #3
    Registered User
    Join Date
    01-19-2011
    Location
    Brazil
    MS-Off Ver
    Excel 2007
    Posts
    26

    Re: MouseClick Event

    Quote Originally Posted by Leith Ross View Post
    Hello bagulhodoido,

    Shapes don't have events with the exception of a Click event to run an attached macro. These objects do not have a window procedure which is necessary for an object to process Windows system messages.

    You seem to going through a lot of trouble to mimic something that is already available to you. If you are going to this level of detail, why not use a UserForm? There is a lot you can do with it since it is a real window. The Windows API can change the shape of UserForm. You should Google "change UserForm shape". There are many examples.
    I realize that shapes do not have events. I was thinking about simulating an event by comparing the shape area and the coordinates of the mouse click.

    I know pretty much nothing about windows API, which makes it harder than just working with shapes and stuff. Anyway, one can always learn right? Any suggestion on API tutorial or something like that?

    Thanks for your attention.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1