MouseHit()

Just starting out? Need help? Post your questions and find answers here.
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by Pupil.
Originally posted by merendo

@Pupil: OK!!! Thanks, I guess I have to say: procedurereturn result$ and only change the vari result$ :wink:
Just to get everything straight.
It's perfectly legal to have several ProcedureReturn statements
in a procedure, but you have to separate them with condition code
(i.e. If, Else, ElseIf ...) and everything you want done before
returning from the procedure must be done before the ProcedureReturn
is executed. It's possible, if wanted or needed, to have only one
ProcedureReturn in the end of the procedure like in the code below,
by storing the return data in a temporary variable(like you said in
your post). Sometimes it's best to have only one procedurereturn statement
and other times you get much cleaner code by having serveral, it's all up
to you to choose what suits you best...

Code: Select all

Procedure.s TestProc(foo.l)
  if foo > 10 and foo  100 and foo  ""
    result$ = "The number given to this procedure was " + result$
  else
    result$ = "The number provided isn't in a predefined span"
  endif
  ProcedureReturn result$
EndProcedure
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by chr1sb.

The GetAsyncKeysState API function can be used to test for each push of the mousebutton:

Code: Select all

mb_left.l=getasynckeystate_(1)
mb_right.l=getasynckeystate_(2)


If mb_left=-32767
   ;left button press
EndIf

If mb_right=-32767
   ;right button press
EndIf

chr1sb
Post Reply