i have remote access similar team view software , want change mouse cursor ( on "controler" part, server side in other words ) according icon of mouse of "controled" part, done in team view software.
my software using tpaintbox
because need make others thing necessary tpaintbox
work fine.
tpaintbox
has crdefault
default cursor. how can change ( on "controler" part ) while mouse inside tpaintbox
?
here code used capture icon of mouse in "controled" part ( client side ).
and here code until trying change icon of mouse in "controler" part ( server side ):
//pbrec name of tpaintbox used procedure tform2.pbrecmousemove(sender: tobject; shift: tshiftstate; x, y: integer); begin if form2.lblpoint.caption = 'ocr_normal' pbrec.cursor := crdefault else if form2.lblpoint.caption = 'ocr_hand' pbrec.cursor := crhandpoint else if form2.lblpoint.caption = 'ocr_ibeam' pbrec.cursor := cribeam; end;
all suggestions welcome.
if want change cursor in code following work.
//context: timer.interval = 50; :-) procedure tform57.timer1timer(sender: tobject); var p: tpoint; begin if ord(paintbox1.cursor) < ord(crsizeall) paintbox1.cursor:= crarrow else paintbox1.cursor:= pred(paintbox1.cursor); //force windows change cursor sending wm_setcursor message. paintbox1.parent.perform(wm_setcursor, paintbox1.parent.handle, makelparam(htclient, wm_mousemove)); (** //if you're viewing using slow remote connection make need this: //wiggle mouse force cursor change. getcursorpos(p); setcursorpos(p.x-1, p.y); sleep(100); //needed on slow remote connection. setcursorpos(p.x, p.y); (**) end;
if you're going change cursor based on context every time mouse enters paintbox it's rather wasteful in mousemove event.
change in onmouseenter
event instead.
procedure tform57.paintbox1mouseenter(sender: tobject); begin if .... paintbox1.cursor:= cribeam else if ..... paintbox1.parent.perform(wm_setcursor, paintbox1.parent.handle, makelparam(htclient, wm_mousemove)); end;
if you're on remote connection client remote-side may cache cursor. in case may need wiggle 1 side, sleep(100)
, wiggle client software detect mouse move , force cursor refresh.
if want cursor inside paintbox
static, different rest of app works fine:
Comments
Post a Comment