Fórum Me ajudem urgente!!!! #145670
14/03/2003
0
[color=red:82b3ae2b5f][size=18:82b3ae2b5f][/size:82b3ae2b5f]Alguém pode me ajudar? como eu coloco no statechange do datasource pra os botões desabilitarem pra não dar akeles erros de banco de dados????? valeuz!!![/color:82b3ae2b5f]
Anonymous
Curtir tópico
+ 0
Responder
Posts
14/03/2003
Bilouro
Quando statechange for chamado pergunte ao datasource qual é o estado dele:
ex:
if datasource.state = dsedit then
btnedit.enable:=false;
principais:
-dsInactive Dataset is closed, so its data is unavailable.
-dsBrowse Data can be viewed, but not changed. This is the default state of an open dataset.
-dsEdit Active record can be modified.
-dsInsert The active record is a newly inserted buffer that has not been posted. This record can be modified and then either posted or discarded.
TEM UMA BOA PROPRIEDADE NO DATASOURCE:
autoedit -> Se vc setar como true, qdo seu usuário alterar algo no dbedit por ex. a tabela entra em edição automaticamente... Se estiver usando DBedit uma saida é setar FALSE;
ex:
if datasource.state = dsedit then
btnedit.enable:=false;
principais:
-dsInactive Dataset is closed, so its data is unavailable.
-dsBrowse Data can be viewed, but not changed. This is the default state of an open dataset.
-dsEdit Active record can be modified.
-dsInsert The active record is a newly inserted buffer that has not been posted. This record can be modified and then either posted or discarded.
TEM UMA BOA PROPRIEDADE NO DATASOURCE:
autoedit -> Se vc setar como true, qdo seu usuário alterar algo no dbedit por ex. a tabela entra em edição automaticamente... Se estiver usando DBedit uma saida é setar FALSE;
Responder
Gostei + 0
14/03/2003
E_gama
Uma forma que utilizo bastante eh:
no evento OnStateChange:
e por ai vai ...
no evento OnStateChange:
BtnOK.Enabled := (QryCadastro.State in [dsInsert, dsEdit]); BtnCancelar.Enabled := BtnOK.Enabled; BtnPesquisar.Enabled := BtnOK.Enabled; BtnEditar.Enabled := not QryCadastro.IsEmpty and (QryCadastro.State = dsBrowse) BtnProximo.Enabled := not BtnOK.Enabled and not QryCadastro.EOF; BtnAnterior.Enabled := BtnProximo.Enabled and not QryCadastro.BOF;
e por ai vai ...
Responder
Gostei + 0
Clique aqui para fazer login e interagir na Comunidade :)