GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

No menu could be recovered. Follow the blue links in the page.

This view

  • Original page
  • New address

GeezerVison is showing hackfox.github.io — Move

Move

This method lets you move an object. You can resize it at the same time.

Usage

oObject.Move( nLeft [, nTop [, nWidth [, nHeight ] ] ] )

The parameters are the new values for the specified properties. We can think of some fun things to do with movable controls. (Imagine a button that jumps away when the user clicks on it. Or don’t just imagine it—see the example.)

Example

* This might be the Click for a command button.
This.Move(This.Left + This.Width/4, ;
          This.Top - 50, This.Width / 2, This.Height * 3 / 2)
=inkey(.1)  && stop and let the user see
This.Move(This.Left - This.Width / 2, ;
          This.Top + 50, This.Width * 2, This.Height * 2 / 3)

The example points out that moving an object relative to its position, or sizing it relative to its size, is something of a pain. For an object that needed to do this a lot, we’d be inclined to create a custom method RelativeMove that would understand its parameters as relative to current position and size. Here’s the code:

* RelativeMove - a custom method
* Pass positive values to move right and down and to make object larger
* Pass negative values to move left and up and to make object smaller
LPARAMETERS nLeft, nTop, nWidth, nHeight
LOCAL nNewLeft, nNewTop, nNewWidth, nNewHeight
 
nNewLeft   = IIF( VARTYPE('nLeft')="N", This.Left + nLeft, This.Left)
nNewTop    = IIF( VARTYPE('nTop')="N", This.Top + nTop, This.Top)
nNewWidth  = IIF( VARTYPE('nWidth')="N", This.Width + nWidth, This.Width)
nNewHeight = IIF( VARTYPE('nHeight')="N", This.Height + nHeight, This.Height)
 
This.Move(nNewLeft, nNewTop, nNewWidth, nNewHeight)
 
ENDPROC

See Also

Moved, Resize

You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.