Post Reply 
DRAWMENU function.
02-11-2014, 06:17 PM
Post: #6
RE: DRAWMENU function.
(02-11-2014 07:14 AM)Giancarlo Wrote:  
Code:

   local l:=WAIT(-1), m; // wait for a user input
   IF TYPE(l)=6 and l(1)=#0 THEN // verify that we have a list corresponding to a

Here is where you are guaranteed to run into issues. You cannot use an AND statement because the local variable l may OR MAY NOT be a list. If the WAIT(-1) command returns a mouse event, l is a list, and the AND statement works. But if WAIT(-1) times out or is returns a keyboard even, then l is a numeric value (not a list) and l(1) produces an error.

Separate your code into two blocks: one that handles mouse events and the other to handle keyboard events. I recommend:

Code:

  local l:=WAIT(-1);
  IF TYPE(l)==6 THEN doMouseEvent(); ELSE doKeyboardEvent(); END;

Graph 3D | QPI | SolveSys
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
DRAWMENU function. - veeblefester - 02-07-2014, 11:10 AM
RE: DRAWMENU function. - Marcus von Cube - 02-09-2014, 02:49 PM
RE: DRAWMENU function. - dg1969 - 02-09-2014, 06:31 PM
RE: DRAWMENU function. - Giancarlo - 02-11-2014, 07:14 AM
RE: DRAWMENU function. - Han - 02-11-2014 06:17 PM
RE: DRAWMENU function. - Damien - 02-11-2014, 02:50 PM
RE: DRAWMENU function. - Giancarlo - 02-11-2014, 08:40 PM



User(s) browsing this thread: 1 Guest(s)