hometoolsscriptstipslinksproductsservicesprojects
 
     
nav_panel.gif
Home
E-mail
Image Processing Libraries
16/32 bit compatibility

Untitled Document


 

Real-time mouse

How to use mouse in real-time
simulations

May,1 2000

Problem
There is one fundamental "feature" of ToolBook that makes the creation of the real-time apllication with mouse control rather painfull. ToolBook suspends execution of all script when user presses mouse button. The execution resumes only when mouse button is released.
Solution
Possible solution of this problem is the complete rejection from standard mouse events handling procedures built in ToolBook with using of OpenScript code for handling this events. Intercepting WM_LBUTTONDOWN and WM_LBUTTONUP sent by operating system to toolbook window you can simulate generation of standard buttonClick, buttonDown, buttonUp and buttonStillDown messages.
Sample Script
Usually use a shared script of some transparent object that can receive notifyBefore and notifyAfter messages. You can use, for example, transparent rectangle for this purpose. Below is the shared script that simulates only left mouse buton messages, but you can expand expand on other mouse events. Note, thta this script doesn't support standard toolbook buttons, but you can modify it to control invert property of the target object. In the same manner you may check Ctrl and Shift keys state, that has not been done yet.
notifyBefore Author
  send unprocessButton
end

notifyBefore Reader
  send processButton
end

notifyBefore enterPage
  if sysLevel="Author"
    send unprocessButton
  else
    send processButton
  end
end

to handle leavePage
  send unprocessButton
end

to handle unprocessButton
  untranslateAllWindowMessages for (clientHandle of targetWindow)
end

to handle processButton
system WM_Object, WM_Viewer
  WM_Viewer=targetWindow
  translateWindowMessage for (clientHandle of WM_Viewer)
    on 0x0201 get WM_LBUTTONDOWN of self return word
    on 0x0202 get WM_LBUTTONUP of self return word
  end
  WM_Object=null
end

to get WM_LBUTTONDOWN hwnd, wmsg, wp, lplo, lphi
system WM_Object, WM_Timer, WM_Viewer
  loc=clientToPageUnits(lplo&","&lphi)
  in WM_Viewer
    get objectFromPoint(loc)
    if WM_Object<>null
      WM_Object=null; return 0
    end
    if it<>null
      WM_Object=it
    else
      WM_Object=this page
    end
    send buttonClick loc to WM_Object
    send buttonDown loc to WM_Object
  end
  WM_Timer=timerStart("periodic",100,100,self)
  return 0
end

to handle timerNotify
system WM_Object, WM_Timer, WM_Viewer
  if WM_Object is null
    get timerStop(WM_Timer); break
  end
  in WM_Viewer
    send buttonStillDown (mousePosition of WM_Viewer) to WM_Object
  end
end

to get WM_LBUTTONUP hwnd, wmsg, wp, lplo, lphi
system WM_Object, WM_Viewer, WM_Timer
  get timerStop(WM_Timer)
  loc=clientToPageUnits(lplo&","&lphi)
  in WM_Viewer
    if WM_Object<>null
      send buttonUp loc to WM_Object
    end
  end
  WM_Object=null
  return 0
end

     
   

HomeToolsScriptsTipsLinksProductsServicesProjects

This page was created by ESD Multimedia
Copyright © 2003 ESD Multimedia

Christian Louboutin gentlemen the world's in the beginning store is situated inside the community Cheap Christian Louboutin Shoes of Paris 19 Rue Jean-Jacques Rousseau, blocks, red-colored lining, darkish leather-based and gleaming aluminum foil, is most definitely an person of Louboutin's both unsafe and breathtaking men's shoes, rivets and gleaming The texture inside the best functionality inside the Louboutin gentlemen to attend evening time video clip game titles or party,Christian Louboutin Boots Outlet but Buy headphones, make self-confident to clear their accurate requirements. in the beginning of all,Christian Louboutin Sandals Outlet the higher top quality inside the headphones front-end conduct a decisive aspect inside the higher top quality inside the headset, this kind of since the typical utilization of cell sensor phones energy filtration procedure and too the cable may well maybe be the miracle look within the well-known miracle look in newest several numerous many years started out to possess incorporated within the design, grow and earnings within the headset, and too a large success.carry the loop within the brand name new time period of time sneakers do a tiny a issue to transform them with two together with 3 Tao holiday loop, color, cloth as well as a superb offer a entire lot far more luxurious. Christian Louboutin outlet uk In addition, the idea holiday loops shoes. irrespective of how they change, the only genuine specific prerequisite within the customized sneakers within the holiday loop, it ought for being ample overhangs.