RVA_GetProgressMessage, RVA_GetPrintingMessage functions

<< Click to display table of contents >>

RVA_GetProgressMessage, RVA_GetPrintingMessage functions

function RVA_GetProgressMessage(Operation: TRVLongOperation;

  ControlPanel: TComponent=nil): TRVALocString;

function RVA_GetPrintingMessage(PageCompleted: Integer;

  Step:TRVPrintingStep;

  ControlPanel: TComponent=nil): TRVALocString;

If ControlPanel is a TRVAControlPanel component, the functions use it. Otherwise, they use MainRVAControlPanel.

RVA_GetProgressMessage returns a localized text message describing the specified long operation. It can be used in TRichViewEdit.OnProgress event.

RVA_GetPrintingMessage returns a localized text message describing the current printing progress. It can be used in TRVPrint.OnSendingToPrinter event.

The name of the current language is returned as ControlPanel.Language, or by RVA_GetLanguageName function.

The current language can be changed by assigning a new value to ControlPanel.Language, or by calling RVA_SwitchLanguage procedure.

Example:

This example assumes that Application.Hint is displayed in a status bar.

// TRVAControlPanel.OnDownload

procedure TForm3.RVAControlPanel1Download(Sender: TrvAction;

  const Source: TRVUnicodeString);

begin

  if Source='' then

    Application.Hint := ''

  else

    Application.Hint := Format(RVA_GetS(rvam_msg_Downloading),

      [Source]);

end;

{--------------------------------------------------------------}

// TRVPrint.OnSendingToPrinter

procedure TForm3.RVPrint1SendingToPrinter(Sender: TCustomRichView;

  PageCompleted: Integer; Step: TRVPrintingStep);

begin

  Application.Hint := RVA_GetPrintingMessage(PageCompleted, Step);

end;

{--------------------------------------------------------------}

// Reading or writing

procedure TForm3.RichViewEdit1Progress(Sender: TCustomRichView;

  Operation: TRVLongOperation; Stage: TRVProgressStage;

  PercentDone: Byte);

begin

  case Stage of

    rvpstgStarting:

      begin

        ProgressBar1.Position := 0;

        ProgressBar1.Visible := True;

        Application.Hint := RVA_GetProgressMessage(Operation);

      end;

    rvpstgRunning:

      begin

        ProgressBar1.Position := PercentDone;

        ProgressBar1.Update;

      end;

    rvpstgEnding:

      begin

        Application.Hint := '';

        ProgressBar1.Visible := False;

      end;

  end;

end;