Taken from the config.txt file in mame
Controls whether or not MAME makes use of mouse controllers. When
   this is enabled, you will likely be unable to use your mouse for other
   purposes until you exit or pause the game. The default is OFF
   (-nomouse).
In the mame.ini file I changed the mouse to 1 and now everything works.
#
# CORE INPUT OPTIONS
#
coin_lockout              1
ctrlr                     
mouse                     1
joystick                  1
lightgun                  0
multikeyboard             0
multimouse                0
steadykey                 0
offscreen_reload          0
joystick_map              auto
joystick_deadzone         0.3
joystick_saturation       0.85
natural                   0
joystick_contradictory    0
coin_impulse              0
#