Results 1 to 8 of 8

Thread: Class Object Events

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 1999
    Location
    ma,usa
    Posts
    485

    Class Object Events

    Hi

    I made a class that selects an area with a rubberband. This gives me the left and top and the right and bottom to work with. My problem is once I get this info I want this area to live on it's own with events such as myArea_click(x as single,y as single). How do I create and get this type of event to completely ignore the button down event of the form without using a conditional in the button down event.

    In other words - How do I make this area a completely independent object such as a picturebox?

  2. #2

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 1999
    Location
    ma,usa
    Posts
    485

    Is this fact?

    Thanks but I can't accept that. There is always a way. Even if I gotta jump through hoops and stand on my ear I wanna know how I can make this happen. Anyone?

  3. #3
    Zaei
    Guest
    You COULD create a child window of the form or picture box, using pure API, and write a message handling function, but then you simply delegate the need to loop (to find the correct event to run) to a Window Message Procedure. You would also have to add functionality to Blt the area being covered by the new window to the window to make it seamless.

    You could also create a custom control, instead of a class. This would be about the same amount of work as the method I first put forward, and much easier then the second, but you seemed to want a class...

    Z.

  4. #4
    Good Ol' Platypus Sastraxi's Avatar
    Join Date
    Jan 2000
    Location
    Ontario, Canada
    Posts
    5,134
    For the click event, you could (possibly) find the form's RECT, get the top and left of your "area", and make a rectangle out of it's width, offsetting it from the left and top of the form. Then, you can check to see if the mouse is in your area when you check it.
    All contents of the above post that aren't somebody elses are mine, not the property of some media corporation.
    (Just a heads-up)

  5. #5
    Zaei
    Guest
    That was my first Idea =). He didnt like it though.

    Z.

  6. #6

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 1999
    Location
    ma,usa
    Posts
    485
    Thanks for all the help. Looks like it's going to be a usercontrol then. I only thought class so I could have code in one place. Control will give me events I need too outside of main code.

    Question: Will I get the same performance using a user control as I would if the code were all in one big spegetti app?

  7. #7
    Good Ol' Platypus Sastraxi's Avatar
    Join Date
    Jan 2000
    Location
    Ontario, Canada
    Posts
    5,134
    I think it would be slower if you had it in an OCX (i think).
    All contents of the above post that aren't somebody elses are mine, not the property of some media corporation.
    (Just a heads-up)

  8. #8
    Zaei
    Guest
    OCX = Class.

    At least in practice. Both end up as COM objects, the only real difference is that an OCX is a separate component.

    Z.

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