Mouse position: Difference between revisions

Content added Content deleted
m (Phix/pGUI)
Line 935: Line 935:
Note that canvasmotion coordinates are relative to the top left of the canvas, whereas the other two are absolute.
Note that canvasmotion coordinates are relative to the top left of the canvas, whereas the other two are absolute.
{{libheader|Phix/pGUI}}
{{libheader|Phix/pGUI}}
<lang Phix>--
<lang Phix>-- demo\rosetta\Mouse_position.exw
-- demo\rosetta\Mouse_position.exw
--
include pGUI.e
include pGUI.e


Line 956: Line 954:
IupSetStrAttribute(timer_lbl,"TITLE","timer %d, %d",{x,y})
IupSetStrAttribute(timer_lbl,"TITLE","timer %d, %d",{x,y})
return IUP_IGNORE
return IUP_IGNORE
end function

function esc_close(Ihandle /*ih*/, atom c)
return iff(c=K_ESC?IUP_CLOSE:IUP_CONTINUE)
end function
end function


Line 988: Line 982:
dialog = IupDialog(IupHbox({frame_1,frame_2}, "MARGIN=5x5, GAP=5"))
dialog = IupDialog(IupHbox({frame_1,frame_2}, "MARGIN=5x5, GAP=5"))
IupSetAttribute(dialog,"TITLE","Mouse motion");
IupSetAttribute(dialog,"TITLE","Mouse motion");
IupCloseOnEscape(dialog)
IupSetCallback(dialog, "K_ANY", Icallback("esc_close"));


IupSetGlobal("INPUTCALLBACKS", "Yes");
IupSetGlobal("INPUTCALLBACKS", "Yes");