Fórum Solução de Interface-Gerar SubGrupos de Grupos grandes #295944
17/09/2005
0
Ola pessoal,
Estou fazendo uma aplicação comercial em que surgiu a seguinte necessidade:
[b:ba2b3eccab]Me ajudem com uma solução de interface que permita ao usuário gerar subgrupos de um grupo grande(uns 3.000.000). [/b:ba2b3eccab]
O problema todo esta no fato de que não estou conseguindo encontrar boas soluções de interfaces que sejam práticas e ao mesmo tempo atraentes para o cliente?
A única solução de interface que eu conheço para esse problema é uma oferecida pelo delphi em: File->new->Other->Forms->Dual list Box.
Eu botei o Código abaixo para quem não conhece e não achou:
PAS:
DFM:
Se eu utiliza-se esta solução eu teria que fazer algumas alterações. Uma que acho pertinente informar, até para que vocês possam me ajudar, é botar filtros no list source para que os registros sejam encontrados pelo cliente. Lembrem-se que o correspondente list source na minha aplicação é muito grande.
Esta é a única solução que me vem a cabeça!!!Mas eu não gostei dessa solução. Será que esta é a única solução para este problema? Será que alguém resolve de outra forma?
Alguém teria alguma outra solução de interface para esse problema?
Me ajudem. Qualquer duvida é só postar.
Desde já obrigado.
Estou fazendo uma aplicação comercial em que surgiu a seguinte necessidade:
[b:ba2b3eccab]Me ajudem com uma solução de interface que permita ao usuário gerar subgrupos de um grupo grande(uns 3.000.000). [/b:ba2b3eccab]
O problema todo esta no fato de que não estou conseguindo encontrar boas soluções de interfaces que sejam práticas e ao mesmo tempo atraentes para o cliente?
A única solução de interface que eu conheço para esse problema é uma oferecida pelo delphi em: File->new->Other->Forms->Dual list Box.
Eu botei o Código abaixo para quem não conhece e não achou:
PAS:
unit Unit2;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Forms, Dialogs, Controls, StdCtrls,
Buttons;
type
TDualListDlg = class(TForm)
OKBtn: TButton;
CancelBtn: TButton;
HelpBtn: TButton;
SrcList: TListBox;
DstList: TListBox;
SrcLabel: TLabel;
DstLabel: TLabel;
IncludeBtn: TSpeedButton;
IncAllBtn: TSpeedButton;
ExcludeBtn: TSpeedButton;
ExAllBtn: TSpeedButton;
procedure IncludeBtnClick(Sender: TObject);
procedure ExcludeBtnClick(Sender: TObject);
procedure IncAllBtnClick(Sender: TObject);
procedure ExcAllBtnClick(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
procedure MoveSelected(List: TCustomListBox; Items: TStrings);
procedure SetItem(List: TListBox; Index: Integer);
function GetFirstSelection(List: TCustomListBox): Integer;
procedure SetButtons;
end;
var
DualListDlg: TDualListDlg;
implementation
{$R *.dfm}
procedure TDualListDlg.IncludeBtnClick(Sender: TObject);
var
Index: Integer;
begin
Index := GetFirstSelection(SrcList);
MoveSelected(SrcList, DstList.Items);
SetItem(SrcList, Index);
end;
procedure TDualListDlg.ExcludeBtnClick(Sender: TObject);
var
Index: Integer;
begin
Index := GetFirstSelection(DstList);
MoveSelected(DstList, SrcList.Items);
SetItem(DstList, Index);
end;
procedure TDualListDlg.IncAllBtnClick(Sender: TObject);
var
I: Integer;
begin
for I := 0 to SrcList.Items.Count - 1 do
DstList.Items.AddObject(SrcList.Items[I],
SrcList.Items.Objects[I]);
SrcList.Items.Clear;
SetItem(SrcList, 0);
end;
procedure TDualListDlg.ExcAllBtnClick(Sender: TObject);
var
I: Integer;
begin
for I := 0 to DstList.Items.Count - 1 do
SrcList.Items.AddObject(DstList.Items[I], DstList.Items.Objects[I]);
DstList.Items.Clear;
SetItem(DstList, 0);
end;
procedure TDualListDlg.MoveSelected(List: TCustomListBox; Items: TStrings);
var
I: Integer;
begin
for I := List.Items.Count - 1 downto 0 do
if List.Selected[I] then
begin
Items.AddObject(List.Items[I], List.Items.Objects[I]);
List.Items.Delete(I);
end;
end;
procedure TDualListDlg.SetButtons;
var
SrcEmpty, DstEmpty: Boolean;
begin
SrcEmpty := SrcList.Items.Count = 0;
DstEmpty := DstList.Items.Count = 0;
IncludeBtn.Enabled := not SrcEmpty;
IncAllBtn.Enabled := not SrcEmpty;
ExcludeBtn.Enabled := not DstEmpty;
ExAllBtn.Enabled := not DstEmpty;
end;
function TDualListDlg.GetFirstSelection(List: TCustomListBox): Integer;
begin
for Result := 0 to List.Items.Count - 1 do
if List.Selected[Result] then Exit;
Result := LB_ERR;
end;
procedure TDualListDlg.SetItem(List: TListBox; Index: Integer);
var
MaxIndex: Integer;
begin
with List do
begin
SetFocus;
MaxIndex := List.Items.Count - 1;
if Index = LB_ERR then Index := 0
else if Index > MaxIndex then Index := MaxIndex;
Selected[Index] := True;
end;
SetButtons;
end;
end.DFM:
object DualListDlg: TDualListDlg Left = 250 Top = 108 BorderStyle = bsDialog Caption = ´Choices Dialog´ ClientHeight = 255 ClientWidth = 345 Color = clBtnFace ParentFont = True OldCreateOrder = True Position = poScreenCenter PixelsPerInch = 96 TextHeight = 13 object SrcLabel: TLabel Left = 8 Top = 8 Width = 145 Height = 16 AutoSize = False Caption = ´Source List:´ end object DstLabel: TLabel Left = 192 Top = 8 Width = 145 Height = 16 AutoSize = False Caption = ´Destination List:´ end object IncludeBtn: TSpeedButton Left = 160 Top = 32 Width = 24 Height = 24 Caption = ´>´ OnClick = IncludeBtnClick end object IncAllBtn: TSpeedButton Left = 160 Top = 64 Width = 24 Height = 24 Caption = ´>>´ OnClick = IncAllBtnClick end object ExcludeBtn: TSpeedButton Left = 160 Top = 96 Width = 24 Height = 24 Caption = ´<´ Enabled = False OnClick = ExcludeBtnClick end object ExAllBtn: TSpeedButton Left = 160 Top = 128 Width = 24 Height = 24 Caption = ´<<´ Enabled = False OnClick = ExcAllBtnClick end object OKBtn: TButton Left = 101 Top = 220 Width = 75 Height = 25 Caption = ´OK´ Default = True ModalResult = 1 TabOrder = 2 end object CancelBtn: TButton Left = 181 Top = 220 Width = 75 Height = 25 Cancel = True Caption = ´Cancel´ ModalResult = 2 TabOrder = 3 end object HelpBtn: TButton Left = 261 Top = 220 Width = 75 Height = 25 Caption = ´Help´ TabOrder = 4 end object SrcList: TListBox Left = 8 Top = 24 Width = 144 Height = 185 ItemHeight = 13 Items.Strings = ( ´Item1´ ´Item2´ ´Item3´ ´Item4´ ´Item5´) MultiSelect = True Sorted = True TabOrder = 0 end object DstList: TListBox Left = 192 Top = 24 Width = 144 Height = 185 ItemHeight = 13 MultiSelect = True TabOrder = 1 end end
Se eu utiliza-se esta solução eu teria que fazer algumas alterações. Uma que acho pertinente informar, até para que vocês possam me ajudar, é botar filtros no list source para que os registros sejam encontrados pelo cliente. Lembrem-se que o correspondente list source na minha aplicação é muito grande.
Esta é a única solução que me vem a cabeça!!!Mas eu não gostei dessa solução. Será que esta é a única solução para este problema? Será que alguém resolve de outra forma?
Alguém teria alguma outra solução de interface para esse problema?
Me ajudem. Qualquer duvida é só postar.
Desde já obrigado.
Lorde_morte.
Curtir tópico
+ 0
Responder
Posts
18/09/2005
José Henrique
Já pensou em usar treeview?
Responder
Gostei + 0
Clique aqui para fazer login e interagir na Comunidade :)