Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- SuperLib 3.50 - function ifmousehd() *new* http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 FUNCTION IFMOUSEHD()             *new*

  Short:
  ------
  IFMOUSEHD() Checks if mouse held down,evals codeblock while it is

  Returns:
  --------
  NIL

  Syntax:
  -------
  IFMOUSEHD(bBlock, [oTbrowse])

  Description:
  ------------
  You'll often want to hold the left mouse button down on a hot object
  in order to cause an action to repeat rapidly over and over. An
  example would be on an up or down arrow that caused a tbrowse object
  to go up or down. Rather than go click-release-click-release-click..etc,
  you prefer to just hold the mouse down.

  If you detect the mouse has been pressed and you then want to check
  if its held down and perform an action repetetively while it is,
  you can use this function.

  <bBlock> is the code block to be evaluated continuously while the mouse
  is held down. (there is a .01 second delay between iterations).

  [oTbrowse] is an optional Tbrowse object that you wish to be refreshed
  during the evaluation of the block. (otherwise, you could hold the mouse
  button down continuously and not se anything happen. You could have
  your codeblock refresh the Tbrowse, of course. Its just easier this
  way.


  Examples:
  ---------
  // this code is taken from SMALLS(), our lookup table popup

  case ISMOUSEAT(nMouseR, nMouseC, nBot+2, nLeft, nBot+2, nLeft+2)
      oTb:up()
      IFMOUSEHD({||oTb:up()},oTb)
  case ISMOUSEAT(nMouseR, nMouseC, nBot+2, nLeft+3, nBot+2, nLeft+5)
      oTb:down()
      IFMOUSEHD({||oTb:down()},oTb)

  Source:
  -------
  S_MOOSE.PRG

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson