View Issue Details

IDProjectCategoryView StatusLast Update
0003778JEDI VCL00 JVCL Componentspublic2006-06-28 02:24
ReporterbungleheadAssigned Toobones 
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionfixed 
Product VersionDaily / GIT 
Target VersionFixed in Version3.30 
Summary0003778: Docking package Tab Images bug (VID and NET Style)
DescriptionVID 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 InformationThe 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};
TagsNo tags attached.

Activities

bunglehead

2006-06-24 13:56

reporter   ~0009635

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..

2006-06-25 06:40

 

docking_patch.zip (68,078 bytes)

bunglehead

2006-06-25 06:41

reporter   ~0009637

Last edited: 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)

2006-06-25 10:44

 

docking_patch_last.zip (68,150 bytes)

obones

2006-06-26 06:43

administrator   ~0009645

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

obones

2006-06-28 02:24

administrator   ~0009704

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