| 1 | unit SetSelU; | 
|---|
| 2 | (* | 
|---|
| 3 | WorldVistA Configuration Utility | 
|---|
| 4 | (c) 8/2008 Kevin Toppenberg | 
|---|
| 5 | Programmed by Kevin Toppenberg, Eddie Hagood | 
|---|
| 6 |  | 
|---|
| 7 | Family Physicians of Greeneville, PC | 
|---|
| 8 | 1410 Tusculum Blvd, Suite 2600 | 
|---|
| 9 | Greeneville, TN 37745 | 
|---|
| 10 | kdtop@yahoo.com | 
|---|
| 11 |  | 
|---|
| 12 | This library is free software; you can redistribute it and/or | 
|---|
| 13 | modify it under the terms of the GNU Lesser General Public | 
|---|
| 14 | License as published by the Free Software Foundation; either | 
|---|
| 15 | version 2.1 of the License, or (at your option) any later version. | 
|---|
| 16 |  | 
|---|
| 17 | This library is distributed in the hope that it will be useful, | 
|---|
| 18 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 
|---|
| 19 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU | 
|---|
| 20 | Lesser General Public License for more details. | 
|---|
| 21 |  | 
|---|
| 22 | You should have received a copy of the GNU Lesser General Public | 
|---|
| 23 | License along with this library; if not, write to the Free Software | 
|---|
| 24 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA | 
|---|
| 25 | *) | 
|---|
| 26 |  | 
|---|
| 27 | interface | 
|---|
| 28 |  | 
|---|
| 29 | uses | 
|---|
| 30 | Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, | 
|---|
| 31 | Dialogs, StdCtrls, Buttons, | 
|---|
| 32 | ORNet, ORFn, ComCtrls, ToolWin, Grids, ORCtrls; | 
|---|
| 33 |  | 
|---|
| 34 | type | 
|---|
| 35 | TSetSelForm = class(TForm) | 
|---|
| 36 | ComboBox: TComboBox; | 
|---|
| 37 | CancelBtn: TBitBtn; | 
|---|
| 38 | OKBtn: TBitBtn; | 
|---|
| 39 | procedure FormShow(Sender: TObject); | 
|---|
| 40 | private | 
|---|
| 41 | { Private declarations } | 
|---|
| 42 | public | 
|---|
| 43 | { Public declarations } | 
|---|
| 44 | procedure PrepForm(setDef : string); | 
|---|
| 45 | end; | 
|---|
| 46 |  | 
|---|
| 47 | var | 
|---|
| 48 | SetSelForm: TSetSelForm; | 
|---|
| 49 |  | 
|---|
| 50 | implementation | 
|---|
| 51 | {$R *.dfm} | 
|---|
| 52 |  | 
|---|
| 53 | procedure TSetSelForm.PrepForm(setDef : string); | 
|---|
| 54 | var  oneOption : string; | 
|---|
| 55 | begin | 
|---|
| 56 | ComboBox.Items.Clear; | 
|---|
| 57 | ComboBox.Text := ''; | 
|---|
| 58 | oneOption := 'x'; | 
|---|
| 59 | while (setDef <> '') and (oneOption <> '') do begin | 
|---|
| 60 | oneOption := piece(setDef,';',1); | 
|---|
| 61 | setDef := pieces(setDef,';',2,32); | 
|---|
| 62 | oneOption := piece(oneOption,':',2); | 
|---|
| 63 | if oneOption <> '' then begin | 
|---|
| 64 | ComboBox.Items.Add(oneOption); | 
|---|
| 65 | end; | 
|---|
| 66 | end; | 
|---|
| 67 | if ComboBox.Items.Count > 0 then begin | 
|---|
| 68 | //      ComboBox.Text := ComboBox.Items[0]; | 
|---|
| 69 | ComboBox.SelText := ComboBox.Items[0]; | 
|---|
| 70 | end else begin | 
|---|
| 71 | ComboBox.Text := '(none defined)'; | 
|---|
| 72 | end; | 
|---|
| 73 | end; | 
|---|
| 74 |  | 
|---|
| 75 |  | 
|---|
| 76 | procedure TSetSelForm.FormShow(Sender: TObject); | 
|---|
| 77 | var mousePos : TPoint; | 
|---|
| 78 | begin | 
|---|
| 79 | GetCursorPos(mousePos); | 
|---|
| 80 | with SetSelForm do begin | 
|---|
| 81 | Top := mousePos.Y - 39; | 
|---|
| 82 | Left := mousePos.X - 15; | 
|---|
| 83 | if Left + Width > Screen.DesktopWidth then begin | 
|---|
| 84 | Left := Screen.DesktopWidth - Width; | 
|---|
| 85 | end; | 
|---|
| 86 | end; | 
|---|
| 87 | end; | 
|---|
| 88 |  | 
|---|
| 89 | end. | 
|---|
| 90 |  | 
|---|