Project JEDI - Issue Tracker
Mantis Bugtracker

Viewing Issue Simple Details Jump to Notes ] View Advanced ] Issue History ] Print ]
ID Category Severity Reproducibility Date Submitted Last Update
0003778 [JEDI VCL] 00 JVCL Components minor always 2006-06-24 00:42 2006-06-28 02:24
Reporter bunglehead View Status public  
Assigned To obones
Priority normal Resolution fixed  
Status resolved   Product Version Daily / GIT
Summary 0003778: Docking package Tab Images bug (VID and NET Style)
Description VID and derived NET styles show wrong tab images. For example, if
you have docked forms in a tab host, and
some of them don't have assigned icons (but at least one other has) tab images
are drawed for all forms.

The reason is wrong default ImageIndex property value of TJvDockTabSheet (JvDockSupportControl.pas).
Zero value can't be used as default cause it's a valid index of a TImageList,
as assigned in DockDrop routines (TJvDockVIDTabPageControl.DockDrop for example).
Additional Information The solution is quite simple (tested both on VID and NET styles):

constructor TJvDockTabSheet.Create(AOwner: TComponent);
begin
  inherited Create(AOwner);
  Align := alClient;
  ControlStyle := ControlStyle + [csAcceptsControls, csNoDesignVisible];
  Visible := False;
  FTabVisible := True;
  FHighlighted := False;
  //new line
  FImageIndex := -1;
end;

And the default value of property:

property ImageIndex: TImageIndex read FImageIndex write SetImageIndex default -1 {was zero};
Tags No tags attached.
Attached Files zip file icon docking_patch.zip [^] (68,078 bytes) 2006-06-25 06:40
zip file icon docking_patch_last.zip [^] (68,150 bytes) 2006-06-25 10:44

- Relationships

-  Notes
(0009635)
bunglehead (reporter)
2006-06-24 13:56

Sorry..one method needs update (I forgot) in unit JvDockVIDStyle.pas:

function TJvDockVIDTabPageControl.CustomUnDock(Source: TJvDockDragDockObject;
  NewTarget: TWinControl; Client: TControl): Boolean;
var
  CurrPage: TJvDockTabSheet;
  I: Integer;
begin
  if not ((Source.Control.HostDockSite <> nil) and
    (Source.DropOnControl = Source.Control.HostDockSite.Parent) and
    (Source.DropAlign = alClient)) then
  begin
    CurrPage := GetPageFromDockClient(Client);
    if CurrPage <> nil then
    begin
      //if (FTabImageList <> nil) and ShowTabImages and
      // (FTabImageList.Count > CurrPage.ImageIndex) then
      //to prevent AV condition is splitted
      if Assigned(FTabImageList) then
        if ShowTabImages and
           (FTabImageList.Count > CurrPage.ImageIndex) and
           (CurrPage.ImageIndex >= 0){condition of valid icon assignement} then
      begin
        FTabImageList.Delete(CurrPage.ImageIndex);
        for I := 0 to Count - 1 do
          if Pages[I].ImageIndex > CurrPage.ImageIndex then
            Pages[I].ImageIndex := Pages[I].ImageIndex - 1;
      end;
    end;
    Result := inherited CustomUnDock(Source, NewTarget, Client);
  end
  else
    Result := True;
end;

Now it's working..
(0009637)
bunglehead (reporter)
2006-06-25 06:41
edited on: 2006-06-25 10:42

found the same bug with TJvDockVSPane..Icons are mixed in hide state of tabhost

The simply way is to create a transparent icon in TJvDockVSBlock.AddPane
when docking form hasn't it:

See:

TJvDockVSBlock.AddPane; (JvDockVSNetStyle.pas)
TJvDockTabSheet.Create; (JvDockSupportControl.pas)
TJvDockVIDTabPageControl.CustomUnDock;(JvDockVIDStyle.pas)

(0009645)
obones (administrator)
2006-06-26 06:43

The changes are in, except for those applying to JvDockVSNetStyle because of this question:
Will the handle created by CreateIcon be freed sometime? If not, there is a resource leak here.
And also, please leave the Icon = nil test (in a "or" statement) and create your new versions against SVN:
http://homepages.borland.com/jedi/wiki/index.php?title=Repository [^]

(0009704)
obones (administrator)
2006-06-28 02:24

I just checked, the icon will be destroyed by TIcon, so this is fine.
Changes are in SVN.

- Issue History
Date Modified Username Field Change
2006-06-24 00:42 bunglehead New Issue
2006-06-24 13:56 bunglehead Note Added: 0009635
2006-06-25 06:40 bunglehead File Added: docking_patch.zip
2006-06-25 06:41 bunglehead Note Added: 0009637
2006-06-25 10:41 bunglehead Note Edited: 0009637
2006-06-25 10:42 bunglehead Note Edited: 0009637
2006-06-25 10:44 bunglehead File Added: docking_patch_last.zip
2006-06-26 06:43 obones Note Added: 0009645
2006-06-26 06:43 obones Status new => feedback
2006-06-28 02:24 obones Status feedback => resolved
2006-06-28 02:24 obones Fixed in Version => Daily / SVN
2006-06-28 02:24 obones Resolution open => fixed
2006-06-28 02:24 obones Assigned To => obones
2006-06-28 02:24 obones Note Added: 0009704


Mantis 1.1.6[^]
Copyright © 2000 - 2008 Mantis Group
Powered by Mantis Bugtracker