No announcement yet.

Moving controls in a running program using the mouse

  • Filter
  • Time
  • Show
Clear All
new posts

  • Moving controls in a running program using the mouse

    I'd like to offer in our new look a feel rewrite the ability for a customer to set at run time their preferences for the location of data fields on their screen. Some like a windowed look, others full screen and of course a couple of different font sizes.

    I've figured out how to allow moving a textbox around by superclassing it and trapping ctrl-r,u,d,l keys and Control set loc, then saving the preference for that user when the program ends or a right-click popup menu.

    Having some trouble with using the mouse to click and drag a control to a new position. When the mouse is captured by the control, I get one set of x,y values and when it's on the parent window I get another. Is there a way to do this with a mouse.

    I was thinking of just clicking a field to set focus, then clicking where I want it to go using the %WM_MOUSEMOVE event. That would be easy, but I would like to have them click and drag a textbox since this is more the norm.

    Of course I would limit this functionality to admin level user and turn it on or off using a context menu.

    Bob Mechler

  • #2
    This is older than me, but it should point you in the right direction...

    'FORUM: Source Code
    'TOPIC: Enhanced Moveable/Resizable Control
    'NAME: Jules Marchildon, Member
    'DATE: October 21, 1999 09:26 AM


    • #3
      Well now that we know Jules is less than 10yrs advice...follow the next generation

      Sorry Jules, I just HAD to pick up and run with that one
      Engineer's Motto: If it aint broke take it apart and fix it

      "If at 1st you don't succeed... call it version 1.0"

      "Half of Programming is coding"....."The other 90% is DEBUGGING"

      "Document my code????" .... "WHYYY??? do you think they call it CODE? "


      • #4
        Thanks Jules,

        Also found this one by you. Between the two, I should be able to do what I'd like.



        • #5
          If you are using DDT then as an alternative to subclassing you can also put each of these controls on its own dialog and drag/resize that.