A propriedade Defauldrawing esta como true ?? Wesley
From: fjogassa Sent: Thursday, October 23, 2008 2:31 PM To: delphi-br@yahoogrupos.com.br Subject: [delphi-br] Re: Criacao de Componente (Por favor) Quando inicia, ele está com 2, pois está configurado no Create. Sim .. este showMessage aparece a quantidade correta, ele só não atualiza o Grid. --- Em delphi-br@yahoogrupos.com.br, "BandaLemuel" <[EMAIL PROTECTED]> escreveu > > > > Ele mostra a Quantidade nestes ShowMessage e mostra os Valores Corretos ??? Apenas não Atualiza a Quantidade de Linhas atraves do RowCount ??? Quando vc inicia o componente com quantos RowCount ele esta ???? > > > > procedure TSCGFiltro.CarregaCamposFiltro; > var i: Integer; > begin > Showmessage('Carrega: ' + IntToStr(FCampos.Count)); > if FCampos.Count <= 0 then > begin > RowCount := 10; > end > else > begin > ShowMessage(IntToStr(FCampos.Count)); > RowCount := FCampos.Count + 1; > for i := 0 to FCampos.Count - 1 do > Cells[0, i + 1] := TConfigCampo(FCampos.Objects[i]).DescricaoCampo; > end; > end; > > > > > From: fjogassa > Sent: Thursday, October 23, 2008 1:49 PM > To: delphi-br@yahoogrupos.com.br > Subject: [delphi-br] Re: Criacao de Componente (Por favor) > > > Removi alguns métodos para o código ficar menor, por isso acredito > que não seja possível compilar o mesmo. > O problema está no método CarregaCamposFiltro. > > unit SCGFiltro; > > interface > > uses > SysUtils, Classes, Controls, Grids, StdCtrls, Windows, Dialogs, > DesignIntF > ,DesignEditors, Forms; > > type > TGetEditStyleEvent = procedure (TSender:TObject; ACol,ARow:integer; > var EditStyle:TEditStyle) of object; > > TConfigCampo = class; > > TSCGFiltro = class(TStringGrid) > private > FDropdownRowCount : integer; > FOnEditButtonClick : TNotifyEvent; > FOnGetEditStyle : TGetEditStyleEvent; > FOnGetPickListItems : TOnGetPickListItems; > FCampoPesquisa: TStringList; > FCampoCondicao: TStringList; > FCampoDescricao: TStringList; > FCampos: TStringList; > FConfiguracaoFiltro: TConfigCampo; > procedure SetDropdownRowCount(value:integer); > procedure SetOnEditButtonClick(value:TNotifyEvent); > procedure SetOnGetPicklistItems(value:TOnGetPickListItems); > procedure setCampoCondicao(const Value: TStringList); > procedure setCampoDescricao(const Value: TStringList); > procedure setConfigCampos(const Value: TStringList); > procedure setConfiguracaoFiltro(const Value: TConfigCampo); > protected > function CreateEditor: TInplaceEdit; override; > function GetEditStyle(ACol, ARow: integer): TEditStyle; override; > public > constructor Create(AOwner: TComponent); override; > destructor Destroy; override; > procedure AdicionaCampo(pCampo, pDescricao, pTipo: String); > function GetFCampos: TStringList; > procedure SetFCampos(Value: TStringList); > procedure AlterarCampo(pCampo, pDescricao, pTipo: String); > procedure RemoverCampo(pCampo: String); > procedure CopiaCampos(pAtualizar: Boolean; Value: TStringList); > procedure LimpaCampos; > procedure LimpaObjetos; > procedure setCampoPesquisa(const Value: TStringList); > procedure CarregaCamposFiltro; > published > property DropdownRowCount : integer read FDropDownRowCount write > SetDropdownRowCount default 3; > property OnEditButtonClick: TNotifyEvent read FOnEditButtonClick > write SetOnEditButtonClick; > property OnGetEditStyle : TGetEditStyleEvent read FOnGetEditStyle > write FOnGetEditStyle; > property OnGetPickListItems : TOnGetPickListItems read > FOnGetPickListItems write SetOnGetPickListItems; > property CampoDescricao: TStringList read FCampoDescricao Write > setCampoDescricao; > property CampoPesquisa: TStringList read FCampoPesquisa write > setCampoPesquisa; > property CampoCondicao: TStringList read FCampoCondicao write > setCampoCondicao; > property ConfiguracaoFiltro: TConfigCampo read FConfiguracaoFiltro > write setConfiguracaoFiltro; > end; > > TConfiguracaoCampo = Class(TComponentEditor) > private > protected > > public > procedure ExecuteVerb(Index: Integer); override; > function GetVerb(Index: Integer): String; override; > function GetVerbCount: Integer; override; > published > end; > > TConfigCampo = class(TPersistent) > private > FNomeCampoBanco: String; > FTipoCampo: String; > FDescricaoCampo: String; > procedure setDescricaoCampo(const Value: String); > procedure setNomeCampoBanco(const Value: String); > procedure setTipoCampo(const Value: String); > protected > public > constructor Create; > destructor Destroy; override; > published > property NomeCampoBanco: String read FNomeCampoBanco write > setNomeCampoBanco; > property DescricaoCampo: String read FDescricaoCampo write > setDescricaoCampo; > property TipoCampo: String read FTipoCampo write setTipoCampo; > end; > > var vSCGFiltro: TSCGFiltro; > > procedure Register; > > implementation > > uses SCGConfigCamposTela; > > procedure Register; > begin > RegisterComponents('SCG', [TSCGFiltro]); > RegisterComponentEditor(TSCGFiltro, TConfiguracaoCampo); > end; > > { TSCGFiltro } > > procedure TSCGFiltro.AdicionaCampo(pCampo, pDescricao, pTipo: String); > var configCampo: TConfigCampo; > begin > configCampo := TConfigCampo.Create; > configCampo.NomeCampoBanco := pCampo; > configCampo.DescricaoCampo := pDescricao; > configCampo.TipoCampo := pTipo; > > FCampos.AddObject(pCampo, configCampo); > end; > > procedure TSCGFiltro.AlterarCampo(pCampo, pDescricao, pTipo: String); > begin > if FCampos.IndexOf(pCampo) > 0 then > begin > > TConfigCampo(FCampos.Objects[FCampos.IndexOf(pCampo)]).DescricaoCampo := > pDescricao; > TConfigCampo(FCampos.Objects[FCampos.IndexOf(pCampo)]).TipoCampo := > pTipo; > end > else > begin > Raise Exception.CreateFmt('Campo ' + pCampo + ' não encontrado na > lista de campos.', []); > end; > end; > > constructor TSCGFiltro.Create(AOwner: TComponent); > begin > inherited Create(AOwner); > SetDropdownRowCount(8); > ColCount := 3; > RowCount := 2; > DefaultRowHeight := 20; > ScrollBars := ssVertical; > FCampoPesquisa := TStringList.Create; > FCampoCondicao := TStringList.Create; > FCampoDescricao := TStringList.Create; > FCampos := TStringList.Create; > Cells[0, 0] := 'Campo'; > Cells[1, 0] := 'Condição'; > Cells[2, 0] := 'Valor'; > ColWidths[0] := 150; > ColWidths[1] := 80; > ColWidths[2] := 300; > CarregaCamposFiltro; > end; > > function TSCGFiltro.CreateEditor: TInplaceEdit; > begin > Result := TInplaceEditList.Create(self); > TInplaceEditList(result).DropdownRows := FDropdownRowCount; > TInplaceEditList(result).OnGetPickListItems := FOnGetPickListItems; > TInplaceEditList(result).OnEditButtonClick := FOnEditButtonClick; > end; > > destructor TSCGFiltro.Destroy; > begin > FCampoPesquisa.Free; > FCampoCondicao.Free; > FCampoDescricao.Free; > FCampos.Free; > inherited; > end; > > function TSCGFiltro.GetEditStyle(ACol, ARow: integer): TEditStyle; > begin > Result := esSimple; > if Assigned(FOnGetEditStyle) then > FOnGetEditStyle(self, ACol, ARow, result); > end; > > function TSCGFiltro.GetFCampos: TStringList; > begin > Result := nil; > if Assigned(FCampos) then > Result := FCampos; > end; > > procedure TSCGFiltro.RemoverCampo(pCampo: String); > begin > if FCampos.IndexOf(pCampo) < 0 then // campo não encontrado > Raise Exception.CreateFmt('Campo ' + pCampo + ' não foi > encontrado.', []) > else > begin > FCampos.Objects[FCampos.IndexOf(pCampo)].Free; > FCampos.Delete(FCampos.IndexOf(pCampo)); > end; > end; > > procedure TSCGFiltro.setCampoPesquisa(const Value: TStringList); > begin > if (Assigned(Value)) and (Value.Count > 0) then > FCampoPesquisa.Assign(Value); > end; > > procedure TSCGFiltro.setConfiguracaoFiltro(const Value: TConfigCampo); > begin > FConfiguracaoFiltro := Value; > end; > > procedure TSCGFiltro.SetDropdownRowCount(value: integer); > begin > FDropdownRowCount := value; > if Assigned(InplaceEditor) then > TInplaceEditList(InplaceEditor).DropdownRows := value; > end; > > procedure TSCGFiltro.CarregaCamposFiltro; > var i: Integer; > begin > Showmessage('Carrega: ' + IntToStr(FCampos.Count)); > if FCampos.Count <= 0 then > begin > RowCount := 10; > end > else > begin > ShowMessage(IntToStr(FCampos.Count)); > RowCount := FCampos.Count + 1; > for i := 0 to FCampos.Count - 1 do > Cells[0, i + 1] := > TConfigCampo(FCampos.Objects[i]).DescricaoCampo; > end; > end; > > procedure TSCGFiltro.CopiaCampos(pAtualizar: Boolean; Value: > TStringList); > var i: Integer; > begin > if Value.Count > 0 then > begin > LimpaCampos; > for i := 0 to Value.Count - 1 do > begin > AdicionaCampo( > TConfigCampo(Value.Objects[i]).NomeCampoBanco > ,TConfigCampo(Value.Objects[i]).DescricaoCampo > ,TConfigCampo(Value.Objects[i]).TipoCampo > ); > end; > end; > end; > > procedure TSCGFiltro.SetFCampos(Value: TStringList); > begin > if Assigned(Value) then > FCampos := Value; > end; > > { TConfiguracaoCampo } > procedure TConfiguracaoCampo.ExecuteVerb(Index: Integer); > var tela: TSCGConfigCamposTelaF; > begin > Tela := TSCGConfigCamposTelaF.Create(Application); > try > Tela.showModal; > finally > FreeAndNil(Tela); > end; > end; > > { TConfigCampo } > > constructor TConfigCampo.Create; > begin > FTipoCampo := 'S'; // inicialização > end; > > destructor TConfigCampo.Destroy; > begin > > inherited; > end; > > procedure TConfigCampo.setDescricaoCampo(const Value: String); > begin > FDescricaoCampo := Value; > end; > > procedure TConfigCampo.setNomeCampoBanco(const Value: String); > begin > FNomeCampoBanco := Value; > end; > > procedure TConfigCampo.setTipoCampo(const Value: String); > begin > FTipoCampo := Value; > end; > > end. > > --- Em delphi-br@yahoogrupos.com.br, "BandaLemuel" <bandalemuel@> > escreveu > > > > Fábio > > > > Vc não tem a propriedade RowCount ???? Poste o Codigo para a > gente ver... > > > > Wesley > > > > > > > > > > From: fjogassa > > Sent: Thursday, October 23, 2008 12:57 PM > > To: delphi-br@yahoogrupos.com.br > > Subject: [delphi-br] Criacao de Componente (Por favor) > > > > > > Boa tarde, estou criando um componente herdado do StringGrid, e em > > dado momento vou alterar o rowCount mais não altera, só altera > se eu > > removo o componente e insiro novamente. Alguém pode me dizer como > faço > > para aumentar o número de linhas sem precisar remover e inserir o > > componente? > > Abraços. > > > > Obs: Estou utilizando D2007 > > > > Fábio Jun > > Analista/Programador > > Maringá - Pr. > > > > > > > > > > > > __________ Information from ESET NOD32 Antivirus, version of virus > signature database 3548 (20081023) __________ > > > > The message was checked by ESET NOD32 Antivirus. > > > > http://www.eset.com > > > > > > [As partes desta mensagem que não continham texto foram removidas] > > > > > > > > __________ Information from ESET NOD32 Antivirus, version of virus signature database 3549 (20081023) __________ > > The message was checked by ESET NOD32 Antivirus. > > http://www.eset.com > > > [As partes desta mensagem que não continham texto foram removidas] > __________ Information from ESET NOD32 Antivirus, version of virus signature database 3550 (20081023) __________ The message was checked by ESET NOD32 Antivirus. http://www.eset.com [As partes desta mensagem que não continham texto foram removidas]