Assistant.Think does not work... sometimes

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

Assistant.Think does not work... sometimes

Postby w2m » January 4th, 2004, 3:42 pm

Sometimes, Assistant.Think does not work! :(

In the following situation the message is not shown.

Code: Select all
procedure Tfrm_Main.TBXItemPrintClick(Sender: TObject);
begin
  Assistant.Think('Printing...',0);
  HTMLEdit.Print(HTMLEdit.ClientRect);
  Sleep(1000);
  Assistant.CloseBalloon;
end;


I even tried using Application.ProcessMessages without sucess:

Code: Select all
procedure Tfrm_Main.TBXItemPrintClick(Sender: TObject);
begin
  Assistant.Think('Printing...',0);
  Application.ProcessMessages;
  HTMLEdit.Print(HTMLEdit.ClientRect);
  Sleep(1000);
  Assistant.CloseBalloon;
end;


How can I force an update so the message appears?

Regards

Bill
w2m
w2m
Senior Member
Senior Member
 
Posts: 76
Joined: March 8th, 2003, 7:11 pm
Location: New York, USA

Postby Kambiz » January 7th, 2004, 6:17 pm

The balloons appear on the screen with an animating effect. So, for your case, you have to call application.processmessages inside a loop while OnBalloonShow event occurs.

Cheers,
Kambiz
User avatar
Kambiz
Administrator
Administrator
 
Posts: 2405
Joined: March 7th, 2003, 7:10 pm

AssistantBalloonShow not called by Assistant.Think

Postby w2m » January 8th, 2004, 7:42 pm

AssistantBalloonShow is not called by Assistant.Think('Printing...',0) but
if I hide the Assistant, then call "Think" then show the Assistant, then AssistantBalloonShow is called and the message appears.

If I place a breakpoint in AssistantBalloonShow then just call Assistant.Think then the breakpoint does not appear.

Is this a bug?

Code: Select all
procedure Tfrm_Main.AssistantBalloonShow ( Sender: TObject );
begin
  Application.ProcessMessages;
  case Assistant.VisibleBalloon of
    bkMessage:
      case Assistant.BalloonPos of
        bpTopLeft, bpTopRight:
          if not Assistant.IsPlaying ( [aaGestureUp] ) then
            Assistant.Play ( aaGestureUp );
        bpBottomLeft, bpBottomRight:
          if not Assistant.IsPlaying ( [aaGestureDown] ) then
            Assistant.Play ( aaGestureDown );
        bpLeftTop, bpLeftBottom:
          if not Assistant.IsPlaying ( [aaGestureRight] ) then
            Assistant.Play ( aaGestureRight );
        bpRightTop, bpRightBottom:
          if not Assistant.IsPlaying ( [aaGestureLeft] ) then
            Assistant.Play ( aaGestureLeft );
      end;
    bkTips, bkHint:
      if not Assistant.IsPlaying ( [aaSuggest] ) then
        Assistant.Play ( aaSuggest );
  end;
end;


Code: Select all
procedure Tfrm_Main.TBXItemPrintClick(Sender: TObject);
begin
  Assistant.Visible := False;
  Assistant.Think('Printing...',0);
  Assistant.Visible := True;
  Sleep(1000);
  HTMLEdit.Print(HTMLEdit.ClientRect);
  Sleep(1000);
  Assistant.CloseBalloon;
end;
w2m
w2m
Senior Member
Senior Member
 
Posts: 76
Joined: March 8th, 2003, 7:11 pm
Location: New York, USA

Postby Kambiz » January 11th, 2004, 10:31 pm

Hi Bill,

Please use v2.35 of the package in conjunction with the following code:
Code: Select all
procedure Tfrm_Main.TBXItemPrintClick(Sender: TObject);
begin
  Assistant.Think('Printing...',0);
  Application.ProcessMessages;
  HTMLEdit.Print(HTMLEdit.ClientRect);
  Assistant.CloseBalloon;
end;


Regards,
Kambiz
User avatar
Kambiz
Administrator
Administrator
 
Posts: 2405
Joined: March 7th, 2003, 7:10 pm

Fix was sucessful

Postby w2m » January 12th, 2004, 3:55 pm

It works now... even without Applicatio.ProcessMessages in OnBaloonShow event.

Thanks

Code: Select all
procedure Tfrm_Main.TBXItemPrintClick(Sender: TObject);
begin
  Assistant.Think('Printing...',0);
  Application.ProcessMessages;
  HTMLEdit.Print(HTMLEdit.ClientRect);
  Assistant.CloseBalloon;
end;
w2m
w2m
Senior Member
Senior Member
 
Posts: 76
Joined: March 8th, 2003, 7:11 pm
Location: New York, USA


Return to DELPHI AREA Products

Who is online

Users browsing this forum: Google [Bot] and 2 guests

cron