Browse Subversion Repository
Contents of /locatech.pas
Parent Directory
| Revision Log
Revision 1 -
( show annotations)
( download)
( as text)
Mon Nov 7 12:03:00 2011 UTC
(12 years, 4 months ago)
by shiraishikazuo
File MIME type: text/x-pascal
File size: 1527 byte(s)
| 1 |
unit locatech; |
| 2 |
|
| 3 |
{$MODE Delphi} |
| 4 |
|
| 5 |
interface |
| 6 |
|
| 7 |
uses |
| 8 |
Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, |
| 9 |
Dialogs, StdCtrls, ExtCtrls; |
| 10 |
|
| 11 |
type |
| 12 |
TLocateChoiceForm = class(TForm) |
| 13 |
OkBtn: TButton; |
| 14 |
ListBox1: TListBox; |
| 15 |
procedure OkBtnClick(Sender: TObject); |
| 16 |
procedure FormClose(Sender: TObject; var Action: TCloseAction); |
| 17 |
private |
| 18 |
exIndex:integer; |
| 19 |
Button:integer; |
| 20 |
public |
| 21 |
function choice(dev0,ini0:integer; Capts:TstringList):integer; |
| 22 |
end; |
| 23 |
|
| 24 |
var |
| 25 |
LocateChoiceForm: TLocateChoiceForm; |
| 26 |
|
| 27 |
implementation |
| 28 |
|
| 29 |
{$R *.lfm} |
| 30 |
|
| 31 |
function TLocateChoiceForm.choice(dev0,ini0:integer;Capts:TstringList):integer; |
| 32 |
begin |
| 33 |
Button:=0; |
| 34 |
Visible:=true; |
| 35 |
with Listbox1 do |
| 36 |
begin |
| 37 |
items.assign(Capts); |
| 38 |
if ini0=0 then |
| 39 |
ItemIndex:=exIndex |
| 40 |
else |
| 41 |
ItemIndex:=ini0-1; |
| 42 |
Height:=Items.Count*itemHeight+4; |
| 43 |
end; |
| 44 |
ClientHeight:=ListBox1.Height+ OkBtn.Height ; |
| 45 |
OkBtn.enabled:=true; |
| 46 |
BringToFront; |
| 47 |
repeat |
| 48 |
sleep(20); |
| 49 |
application.ProcessMessages; |
| 50 |
until Button<>0; |
| 51 |
with ListBox1 do |
| 52 |
begin |
| 53 |
if Button=1 then |
| 54 |
result := ItemIndex + 1 |
| 55 |
else |
| 56 |
result := 0; |
| 57 |
exIndex:=ItemIndex; |
| 58 |
end; |
| 59 |
OkBtn.enabled:=false; |
| 60 |
end; |
| 61 |
|
| 62 |
procedure TLocateChoiceForm.OkBtnClick(Sender: TObject); |
| 63 |
begin |
| 64 |
Button:=1; |
| 65 |
end; |
| 66 |
|
| 67 |
procedure TLocateChoiceForm.FormClose(Sender: TObject; var Action: TCloseAction); |
| 68 |
begin |
| 69 |
Button:=-1; |
| 70 |
end; |
| 71 |
|
| 72 |
end. |
| |