Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- FUNCky - <b>name:</b> <b>m_activate() - let mouse activate gets</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
  Name:    m_activate() - let mouse activate gets
  Usage:   [<logical>] = m_activate()
  Params:  none
  Returns: logical .T. if a get was activated, .F. if no gets were
           in the defined areas.

 ---------------------------------- Example ---------------------------------

                   Cname    = space(20)
                   CAddress = space(30)
                   CCity    = space(20)
                   CState   = space(2)
                   CZip     = space(5)

                   cls()
                   box(10,4,17,60)

                   print(12,06,"Company...:")
                   print(13,06,"Address...:")
                   print(15,06,"City......:")
                   print(15,39,"State:")
                   print(15,49,"Zip:")

                   box(18,32,20,47,m_frame(),standard())
                   print(19,33,"    ESCape    ")

                   m_csrput(10,40)
                   m_csron()

                   * set up the stack based on the PROMPTS. This
                   * makes the user click on the prompt, not the
                   * get. When clicking on a get, when the get is
                   * activated it will overwrite the mouse cursor
                   * so don't make the user click on the field area,
                   * make them click on the prompt.
                   *************************************************
                   m_stacknew()

                   m_stack(1, 12, 06, 12, 17)  && Company
                   m_stack(2, 13, 06, 13, 17)  && Address
                   m_stack(3, 15, 06, 15, 17)  && City
                   m_stack(4, 15, 39, 15, 45)  && State
                   m_stack(5, 15, 49, 15, 53)  && Zip

                   * set a key to a popup. We like to use ALT/=
                   * since it is hard to do with the keyboard
                   *********************************************
                   set key 387 to CLICKGETS

                   * point the left button to the set key value
                   ********************************************
                   mousetrap(0,387)
                   m_trapset()

                   @ 12,18 get Cname
                   @ 13,18 get CAddress
                   @ 15,18 get CCity
                   @ 15,46 get CState    picture "!!"
                   @ 15,54 get CZip      picture "#####"

                   read
                   quit

           PROC CLICKGETS
           para d1,d2,d3

                   * to have the mouse activate a get, just call
                   * m_activate(). If it returns .T., you can just
                   * return and the specified get will be activated.
                   * if it returns .F., the get was not activated, you
                   * can then process some other area of the screen.
                   * Remember you shouldn't stuff keys after the
                   * m_activate() function, you should return
                   * immediately.
                   *************************************************
                   if (m_activate())
                           return
                   elseif (m_region(18,32,20,47))
                           m_csroff()
                           box(18,32,20,47,m_frame(),enhanced())
                           m_csron()
                           m_wait(0)
                           m_csroff()
                           box(18,32,20,47,m_frame(),standard())
                           m_csron()
                           keyboard chr(27)
                           return
                   else
                           m_squeak()
                           return
                   endif

  Note:     Never make them click on a field area in a get. Since the
            get area will be overwritten when the field is displayed,
            the mouse cursor will disappear. Since you are locked into
            a get, there is no way to turn the cursor back on. It also
            may leave a 'hole' in the field on the screen if the user
            moves the mouse and the mouse driver restores what was there
            before the get was displayed. Make them click on the prompt
            and m_stack() will work quite well. If you need to 'skip'
            over a get declaration, just set it's values to those that
            can not possibly be obtained by the mouse, such as row 100,
            col 100, row2 100, col2 100. the maximum number of gets you
            can define at one time with m_stack() is 75. Also, m_stack()
            initializes all gets not in use to -1 (255). If you specify
            and row or col as 255 or -1, then m_stack() will believe it
            has found the end of the list and return .F. Always make sure
            your m_stack() get list corresponds 1 to 1 with the order of
            the gets in your program. If you do not issue an m_stacknew()
            and write new values into the m_stack(), there exists a
            possibility that some older values may still be left in the
            stack and acted on improperly for that sequence of gets.

            To achieve reactivation of a get on a mouse click, some
            keys are stuffed into the keyboard buffer so you should not
            stuff the keyboard at all after you issue an m_activate().
            If you stuff keys into the buffer, then the special keys that
            m_activate() stuffs into the buffer will be cleared away
            thereby causing the reactivation to possibly fail in some way.
            If you do stuff keys, during the reactivation the contents
            of the get are restored so the keys you stuff into the buffer
            will simply be ignored anyway.


See Also: m_stack() active() activate() m_stackget()

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