Office Assistant

Please post bug reports, feature requests, or any question regarding the DELPHI AREA projects here.

Office Assistant

Postby sequelinha » December 12th, 2008, 3:58 pm

hello good afternoon, I am from Brazil and first I would like to congratulate the designer component of Office Assistant, like much of the components, greatly helped me in my systems,
the package installed correctly in my Delphi 2007, and is working beauty,
then come on, I with a probema's time to use the Event OnGuideSearchClick,
I am not able to make more of a word to search.
I'm using the code below is for the demonstration,
but when places two searches, the code checks only the search for low


First check the search
PS. there is not this one
Code: Select all
 if Pos('cadastrar' , LowerCase(Request)) <> 0 then



Second verification of search
PS. there is only this

Code: Select all
 if Pos('Vendas' , LowerCase(Request)) <> 0 then


below the code of the entire event

Code: Select all
procedure TFrmPrincipal.AssistenteGuideSearchClick(Sender: TObject);
var
  I: Integer;
begin
  if Writing then
  begin
    Writing := False;
    {Exibe ele procurando}
   Assistente.Play('WriteReturn');
  end;
  {Se for digitado as palavras abaixo ele exibe os Topicos a seguir}
  with Assistente.GuideDlg do
  begin
    if Pos('cadastrar' , LowerCase(Request)) <> 0 then
    begin
      Description := 'Você perguntou alguma coisa sobre '+ Request +', aqui tem opções que eu posso te oferecer.';
      Topics.Clear;
      Topics.AddStyle('', [tsHeader]);
      Topics.AddStyle('Selecione um dos seguintes itens:', [tsHeader, tsBold]);
           for I := 0 to Random(8) do
        case Random(100) of
          00..33:
            Topics.AddID('Cadastro de Clientes', 1);
          34..66:
            Topics.AddID('Cadastro de Vendedores', 2);
          67..99:
            Topics.AddID('Cadastro de Produtos', 3);
        end;
      if Random(5) = 0 then
        Assistente.Play(aaCongratulate)
      else
        Assistente.Play(aaPleased);
      RequestResult := True;
       end
    else
    begin
      Description := 'Eu não sei o que você quer dizer. Por favor reformular a sua pergunta.';
      Topics.Clear;
      Topics.AddStyle('Mostre-me um exemplo', [tsHoverUnderline]);
      {$IFDEF COMPILER4_UP}
      Assistente.Play([aaConfused, aaDecLine, aaSad]);
      {$ELSE}
      Assistente.PlayRandom([aaConfused, aaDecLine, aaSad]);
      {$ENDIF}
      RequestResult := False;
    end;
  end;

begin
  if Writing then
  begin
    Writing := False;
    {Exibe ele procurando}
    Assistente.Play('WriteReturn');
  end;
  {Se for digitado as palavras abaixo ele exibe os Topicos a seguir}
  with Assistente.GuideDlg do
  begin
    if Pos('Vendas' , LowerCase(Request)) <> 0 then
    begin
      Description := 'Você perguntou alguma coisa sobre '+ Request +', aqui tem opções que eu posso te oferecer.';
      Topics.Clear;
      Topics.AddStyle('', [tsHeader]);
      Topics.AddStyle('Selecione um dos seguintes itens:', [tsHeader, tsBold]);
           for I := 0 to Random(8) do
        case Random(100) of
          00..33:
            Topics.AddID('Como Gerar Vendas', 4);
          34..66:
            Topics.AddID('Como faço para apagar a vendas', 5);
          67..99:
            Topics.AddID('Gerando pedido de vendas', 6);
        end;
      if Random(5) = 0 then
        Assistente.Play(aaCongratulate)
      else
        Assistente.Play(aaPleased);
      RequestResult := True;
       end
    else
    begin
      Description := 'Eu não sei o que você quer dizer. Por favor reformular a sua pergunta.';
      Topics.Clear;
      Topics.AddStyle('Mostre-me um exemplo', [tsHoverUnderline]);
      {$IFDEF COMPILER4_UP}
      Assistente.Play([aaConfused, aaDecLine, aaSad]);
      {$ELSE}
      Assistente.PlayRandom([aaConfused, aaDecLine, aaSad]);
      {$ENDIF}
      RequestResult := False;
    end;
  end;
end;
end;



Thank you
Grato

[]'s
Charles
sequelinha
Member
Member
 
Posts: 3
Joined: December 11th, 2008, 7:38 pm
Location: Brasil

Re: Office Assistant

Postby Kambiz » December 12th, 2008, 6:22 pm

You can never locate 'Vendas' in LowerCase(Request). Pay attention to capital letter 'V'.
Kambiz
User avatar
Kambiz
Administrator
Administrator
 
Posts: 2429
Joined: March 7th, 2003, 7:10 pm

Re: Office Assistant

Postby sequelinha » December 12th, 2008, 7:15 pm

Hello! I made the change, I put everything I wrote in lower case, it is true that the last check is to
check over the top, that means that detects only the "vendas", and the first "cadastrar" does not make the search more,
checked and everything is in Tiny too.

Thank you
sequelinha
Member
Member
 
Posts: 3
Joined: December 11th, 2008, 7:38 pm
Location: Brasil

Re: Office Assistant

Postby Kambiz » December 16th, 2008, 9:05 am

Assistant does not do any search. It's your code in OnGuideSearch event handler that should perform the search.

If it doesn't act as you expected, it means you have to review and fix your code.
Kambiz
User avatar
Kambiz
Administrator
Administrator
 
Posts: 2429
Joined: March 7th, 2003, 7:10 pm

Re: Office Assistant

Postby sequelinha » December 18th, 2008, 9:43 pm

I got it ...
was putting my code wrong

Thank you
português

>
inglês

alterar
Traduzir
sequelinha
Member
Member
 
Posts: 3
Joined: December 11th, 2008, 7:38 pm
Location: Brasil


Return to DELPHI AREA Projects

Who is online

Users browsing this forum: No registered users and 1 guest

cron