12345678910111213141516171819202122232425262728293031323334353637383940414243444546 |
- program gpmex;
- {
- Example program to demonstrate the use of the gpm unit.
- }
- uses gpm;
- var
- connect : TGPMConnect;
- event : tgpmevent;
-
- begin
- connect.EventMask:=GPM_MOVE or GPM_DRAG or GPM_DOWN or GPM_UP;
- connect.DefaultMask:=0;
- connect.MinMod:=0;
- connect.MaxMod:=0;
- if Gpm_Open(connect,0)=-1 then
- begin
- Writeln('No mouse handler present.');
- Halt(1);
- end;
- Writeln('Click right button to end.');
- Repeat
- gpm_getevent(Event);
- With Event do
- begin
- Write('Pos = (',X,',',Y,') Buttons : (');
- if (buttons and Gpm_b_left)<>0 then
- write('left ');
- if (buttons and Gpm_b_right)<>0 then
- write('right ');
- if (buttons and Gpm_b_middle)<>0 then
- Write('middle ');
- Write(') Event : ');
- Case EventType and $F of
- GPM_MOVE: write('Move');
- GPM_DRAG: write('Drag');
- GPM_DOWN: write('Down');
- GPM_UP: write('Up');
- end;
- Writeln;
- end;
- Until (Event.Buttons and gpm_b_right)<>0;
- gpm_close;
- end.
|