langs a-z
This commit is contained in:
parent
db842d013d
commit
d066446780
11389 changed files with 98361 additions and 1020 deletions
24
Task/Mouse-position/OCaml/mouse-position.ocaml
Normal file
24
Task/Mouse-position/OCaml/mouse-position.ocaml
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
open Xlib
|
||||
|
||||
let () =
|
||||
let d = xOpenDisplay "" in
|
||||
|
||||
(* ask for active window (no error check);
|
||||
the client must be freedesktop compliant *)
|
||||
let _, _, _, _, props =
|
||||
xGetWindowProperty_window d
|
||||
(xDefaultRootWindow d)
|
||||
(xInternAtom d "_NET_ACTIVE_WINDOW" true)
|
||||
0 1 false AnyPropertyType
|
||||
in
|
||||
|
||||
let _, _, _, child, _ = xQueryPointer d props in
|
||||
begin match child with
|
||||
| Some(_, childx, childy) ->
|
||||
Printf.printf "relative to active window: %d,%d\n%!" childx childy;
|
||||
| None ->
|
||||
print_endline "the pointer is not on the same screen as the specified window"
|
||||
end;
|
||||
|
||||
xCloseDisplay d;
|
||||
;;
|
||||
1
Task/Mouse-position/Octave/mouse-position.octave
Normal file
1
Task/Mouse-position/Octave/mouse-position.octave
Normal file
|
|
@ -0,0 +1 @@
|
|||
[X, Y, BUTTONS] = ginput(N);
|
||||
21
Task/Mouse-position/Oz/mouse-position.oz
Normal file
21
Task/Mouse-position/Oz/mouse-position.oz
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
declare
|
||||
[QTk] = {Module.link ['x-oz://system/wp/QTk.ozf']}
|
||||
WindowClosed = {NewCell false}
|
||||
Label
|
||||
Window = {QTk.build
|
||||
td(action:proc {$} WindowClosed := true {Window close} end
|
||||
label(text:"" handle:Label))}
|
||||
in
|
||||
{Window show}
|
||||
|
||||
for while:{Not @WindowClosed} do
|
||||
TopmostWindow = {List.last {String.tokens {Tk.return wm(stackorder '.')} & }}
|
||||
Winfo = {Record.mapInd winfo(rootx:_ rooty:_ pointerx:_ pointery:_)
|
||||
fun {$ I _}
|
||||
{Tk.returnInt winfo(I TopmostWindow)}
|
||||
end}
|
||||
in
|
||||
{Label set(text:"x: "#(Winfo.pointerx - Winfo.rootx)
|
||||
#", y: "#(Winfo.pointery - Winfo.rooty))}
|
||||
{Delay 250}
|
||||
end
|
||||
2
Task/Mouse-position/PureBasic/mouse-position-1.purebasic
Normal file
2
Task/Mouse-position/PureBasic/mouse-position-1.purebasic
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
x = WindowMouseX(#MyWindow)
|
||||
y = WindowMouseY(#MyWindow)
|
||||
20
Task/Mouse-position/PureBasic/mouse-position-2.purebasic
Normal file
20
Task/Mouse-position/PureBasic/mouse-position-2.purebasic
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
#MyWindow = 0
|
||||
#Label_txt = 0
|
||||
#MousePos_txt = 1
|
||||
If OpenWindow(#MyWindow,0,0,200,200,"Test",#PB_Window_SystemMenu)
|
||||
TextGadget(#Label_txt,0,0,100,20,"Mouse Position (x,y):",#PB_Text_Right)
|
||||
TextGadget(#MousePos_txt,120,0,60,20,"()")
|
||||
|
||||
Repeat
|
||||
Repeat
|
||||
event = WaitWindowEvent(10)
|
||||
If event = #PB_Event_CloseWindow
|
||||
Break 2 ;exit program
|
||||
EndIf
|
||||
Until event = 0
|
||||
|
||||
x = WindowMouseX(#MyWindow)
|
||||
y = WindowMouseY(#MyWindow)
|
||||
SetGadgetText(#MousePos_txt,"(" + Str(x) + "," + Str(y) + ")")
|
||||
ForEver
|
||||
EndIf
|
||||
2
Task/Mouse-position/Retro/mouse-position.retro
Normal file
2
Task/Mouse-position/Retro/mouse-position.retro
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
needs canvas'
|
||||
^canvas'mouse
|
||||
2
Task/Mouse-position/Seed7/mouse-position.seed7
Normal file
2
Task/Mouse-position/Seed7/mouse-position.seed7
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
xPos := pointerXPos(curr_win);
|
||||
yPos := pointerYPos(curr_win);
|
||||
5
Task/Mouse-position/Visual-Basic/mouse-position-1.vb
Normal file
5
Task/Mouse-position/Visual-Basic/mouse-position-1.vb
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
|
||||
'X and Y are in "twips" -- 15 twips per pixel
|
||||
Me.Print "X:" & X
|
||||
Me.Print "Y:" & Y
|
||||
End Sub
|
||||
16
Task/Mouse-position/Visual-Basic/mouse-position-2.vb
Normal file
16
Task/Mouse-position/Visual-Basic/mouse-position-2.vb
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
Private Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long
|
||||
|
||||
Private Type POINTAPI
|
||||
'X and Y are in pixels, with (0,0) being the top left corner of the primary display
|
||||
X As Long
|
||||
Y As Long
|
||||
End Type
|
||||
|
||||
Private Pt As POINTAPI
|
||||
|
||||
Private Sub Timer1_Timer()
|
||||
GetCursorPos Pt
|
||||
Me.Cls
|
||||
Me.Print "X:" & Pt.X
|
||||
Me.Print "Y:" & Pt.Y
|
||||
End Sub
|
||||
6
Task/Mouse-position/XPL0/mouse-position.xpl0
Normal file
6
Task/Mouse-position/XPL0/mouse-position.xpl0
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
include c:\cxpl\stdlib;
|
||||
if not OpenMouse then Text(0, "A mouse is required")
|
||||
else [ShowMouse(true);
|
||||
IntOut(0, GetMousePosition(0)); ChOut(0, ^,);
|
||||
IntOut(0, GetMousePosition(1)); CrLf(0);
|
||||
]
|
||||
Loading…
Add table
Add a link
Reference in a new issue