View Issue Details

IDProjectCategoryView StatusLast Update
0006332JEDI VCL00 JVCL Componentspublic2019-05-24 12:00
ReporterlstauberAssigned Toobones 
PrioritynormalSeveritymajorReproducibilityalways
Status resolvedResolutionfixed 
Product VersionDaily / GIT 
Target VersionFixed in VersionDaily / GIT 
Summary0006332: Jvrollout realigns controls on collapse/expand
Descriptioncreate a rollout and place 2 panels with Align=alTop into it (panel1 lies now on the top of the panel2). if you start this application, collapse this rollout and expand it again, the panels are switched, the panel1 lies now below the panel2.
Additional Informationbug in the (relatively new) method CheckVisibility. The alignment must be disabled during the visibility setting task. 4 added lines are commented.

[code]

procedure TJvCustomRollOut.CheckChildVisibility;
  procedure GetChildVisibility;
  var
    I: Integer;
  begin
    if FChildControlVisibility = nil then
    begin
      FChildControlVisibility := TStringList.Create;
      FChildControlVisibility.Sorted := True;
    end;
    DisableAlign; // !!!!!!!!!!!!!! ADD THIS LINE !!!!!!!!!!!!!!
    for I := 0 to ControlCount - 1 do
      if (Controls[I] is TWinControl) and (TWinControl(Controls[I]).Visible) then
      begin
        FChildControlVisibility.AddObject(Controls[I].Name, Controls[I]);
        TWinControl(Controls[I]).Visible := False;
      end;
    EnableAlign; // !!!!!!!!!!!!!! ADD THIS LINE !!!!!!!!!!!!!!
  end;

  procedure SetChildVisibility;
  var
    I: Integer;
  begin
    if FChildControlVisibility <> nil then
    begin
      DisableAlign; // !!!!!!!!!!!!!! ADD THIS LINE !!!!!!!!!!!!!!
      for I := 0 to FChildControlVisibility.Count - 1 do
        if FindChildControl(FChildControlVisibility[I]) <> nil then
          TWinControl(FChildControlVisibility.Objects[I]).Visible := True;
      EnableAlign; // !!!!!!!!!!!!!! ADD THIS LINE !!!!!!!!!!!!!!
      FreeAndNil(FChildControlVisibility);
    end;
  end;
begin
  if csDesigning in ComponentState then
    Exit;

  if Collapsed then
    GetChildVisibility
  else
    SetChildVisibility;
end;
[/code]

This change could also bring some performance.
You can naturally also use try...finally :)

notice: I also do not understand, why the code only works with TWinControl and not with all TControls - perhaps from the old, removed method, that only worked with tabstops?!
TagsNo tags attached.

Activities

obones

2014-12-04 15:00

administrator   ~0021079

Please provide the zipped sources of a sample application showing this.

2014-12-05 11:38

 

rollout content moving.zip (4,859 bytes)

lstauber

2014-12-05 11:40

reporter   ~0021130

zipped sources uploaded

mh

2019-05-05 09:37

reporter   ~0021814

Created a pull request for this one:
https://github.com/project-jedi/jvcl/pull/121

mh

2019-05-16 22:23

reporter   ~0021838

My bad. Had deleted the branch too early so I created a new pull request for this one, I hope it is good enough now:
https://github.com/project-jedi/jvcl/pull/125

Issue History

Date Modified Username Field Change
2014-10-02 10:01 lstauber New Issue
2014-12-04 15:00 obones Note Added: 0021079
2014-12-04 15:00 obones Status new => feedback
2014-12-05 11:38 lstauber File Added: rollout content moving.zip
2014-12-05 11:40 lstauber Note Added: 0021130
2015-01-19 16:00 obones Status feedback => acknowledged
2019-05-05 09:37 mh Note Added: 0021814
2019-05-16 22:23 mh Note Added: 0021838
2019-05-24 12:00 obones Status acknowledged => resolved
2019-05-24 12:00 obones Fixed in Version => Daily / GIT
2019-05-24 12:00 obones Resolution open => fixed
2019-05-24 12:00 obones Assigned To => obones