View Issue Details

IDProjectCategoryView StatusLast Update
0002385JEDI VCL00 JVCL Componentspublic2004-12-26 22:32
ReporterborzovAssigned To 
PrioritynormalSeveritycrashReproducibilityalways
Status resolvedResolutionopen 
Product Version3.00 BETA 2 
Target VersionFixed in Version 
Summary0002385: Access Violation in procedure TJvBrowseForFolderDialog.UpdateStatusText(AText: string);
DescriptionI found in procedure TJvBrowseForFolderDialog.UpdateStatusText(AText: string)
(unit JvBrowseForder) this text:

      AText := MinimizeFileName(AText, Application.MainForm.Canvas,
        (WindowRect.Right - WindowRect.Left) - (ItemRect.Left - WindowRect.Left) * 2 - 8);

In my Application this procedure runs before initialization of MainForm, and so Application.MainForm is not assigned and I get Access Violation.
TagsNo tags attached.

Activities

user72

2004-12-15 11:14

  ~0005891

Try changing the procedure to:

procedure TJvBrowseForFolderDialog.UpdateStatusText(AText: string);
const
  cStatusLabel = $3743;
var
  WindowRect, ItemRect: TRect;
  ItemHandle: THandle;
  ACanvas:TCanvas;
begin
  if [odStatusAvailable, odNewDialogStyle] * FUsedOptions <> [odStatusAvailable] then
    Exit;

  if StatusText <> '' then
    AText := StatusText
  else
  begin
    ItemHandle := GetDlgItem(FDialogWindow, cStatusLabel);
    if ItemHandle <> 0 then
    begin
      GetWindowRect(FDialogWindow, WindowRect);
      GetWindowRect(ItemHandle, ItemRect);
      if Application.MainForm <> nil then
        ACanvas := Application.MainForm.Canvas
      else
      begin
        ACanvas := TCanvas.Create;
        ACanvas.Handle := GetDC(0);
      end;
      AText := MinimizeFileName(AText, ACanvas,
        (WindowRect.Right - WindowRect.Left) - (ItemRect.Left - WindowRect.Left) * 2 - 8);
      if Application.MainForm = nil then
        ACanvas.Free;
    end;
  end;

  SetStatusText(AText);
end;

Also, add Graphics to the uses clause

robert_marquardt

2004-12-26 22:32

developer   ~0006017

This has obviously been fixed in CVS.

Issue History

Date Modified Username Field Change
2004-12-15 03:33 borzov New Issue
2004-12-15 11:14 user72 Note Added: 0005891
2004-12-15 11:14 user72 Status new => feedback
2004-12-26 22:32 robert_marquardt Note Added: 0006017
2004-12-26 22:32 robert_marquardt Status feedback => resolved