You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
122 lines
2.3 KiB
122 lines
2.3 KiB
unit umstMaster;
|
|
|
|
interface
|
|
|
|
uses
|
|
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
|
|
Grids, DBGrids, StdCtrls, DBCtrls, ExtCtrls, Buttons, ComCtrls, DB, ImgList,
|
|
Menus, CheckLst;
|
|
|
|
type
|
|
TmstMaster = class(TForm)
|
|
stbStatus: TStatusBar;
|
|
procedure FormClose(Sender: TObject; var Action: TCloseAction);
|
|
procedure FormActivate(Sender: TObject);
|
|
procedure FormKeyDown(Sender: TObject; var Key: Word;
|
|
Shift: TShiftState);
|
|
procedure FormCreate(Sender: TObject);
|
|
private
|
|
{ Private declarations }
|
|
public
|
|
function Selecionados(CheckListBox: TCheckListBox; Dataset: TDataset; Field: String):String;overload;virtual;
|
|
{ Public declarations }
|
|
end;
|
|
|
|
var
|
|
mstMaster: TmstMaster;
|
|
|
|
implementation
|
|
|
|
uses udtmSystem;
|
|
|
|
{$R *.DFM}
|
|
|
|
function TmstMaster.Selecionados(CheckListBox: TCheckListBox; Dataset: TDataset; Field: String):String;
|
|
// Funcao para obter multi-selecao
|
|
begin
|
|
|
|
with TStringList.Create do
|
|
begin
|
|
Dataset.First;
|
|
|
|
while not Dataset.Eof do
|
|
begin
|
|
|
|
if CheckListBox.Checked[Dataset.RecNo - 1] then
|
|
Add(Dataset.FieldByName(Field).AsString);
|
|
|
|
Dataset.Next;
|
|
|
|
end;
|
|
|
|
Result := DelimitedText;
|
|
|
|
Free;
|
|
|
|
end;
|
|
|
|
end;
|
|
|
|
procedure TmstMaster.FormActivate(Sender: TObject);
|
|
begin
|
|
Screen.Cursor := crDefault;
|
|
end;
|
|
|
|
procedure TmstMaster.FormKeyDown(Sender: TObject; var Key: Word;
|
|
Shift: TShiftState);
|
|
begin
|
|
|
|
if (ActiveControl is TDBGrid) or
|
|
//((ActiveControl is TDBLookupCombo) and (ActiveControl.Tag = 1)) or
|
|
((ActiveControl is TDBComboBox) and (ActiveControl.Tag = 1)) or
|
|
//((ActiveControl is TDBDateTimePicker) and (ActiveControl.Tag = 1)) or
|
|
((ActiveControl is TDBEdit) and (ActiveControl.Tag = 1)) or
|
|
(ActiveControl is TDBMemo) or
|
|
(ActiveControl is TDBRichEdit) or (ActiveControl is TMemo)
|
|
then exit;
|
|
|
|
case Key of
|
|
|
|
VK_RETURN:
|
|
begin
|
|
SelectNext(ActiveControl as tWinControl, True, True );
|
|
Key := 0;
|
|
end;
|
|
|
|
VK_ESCAPE:
|
|
begin
|
|
Key := 0;
|
|
Close;
|
|
end;
|
|
|
|
end;
|
|
|
|
end;
|
|
|
|
procedure TmstMaster.FormClose(Sender: TObject; var Action: TCloseAction);
|
|
begin
|
|
|
|
// Volta o cursor para o estado normal
|
|
|
|
Screen.Cursor := crDefault;
|
|
|
|
// Libera a memória
|
|
|
|
Action := caFree;
|
|
|
|
end;
|
|
|
|
procedure TmstMaster.FormCreate(Sender: TObject);
|
|
begin
|
|
|
|
dtmSystem.tx_formulario := TForm(Sender).Name;
|
|
|
|
end;
|
|
|
|
end.
|
|
|
|
|
|
|
|
|
|
|
|
|