CGDevTools Forum

Welcome to the Official CGDevTools Support Community Forums.

Setting .Zindex for all controls on TIWCGJQDialog

General discussion

by ScottWGast » 10 Apr 2014 22:30

I would like to have an iterative procedure that will set the .ZIndex on all of the applicable controls that reside on a TIWCGJQDialog; it should iterate through all of the controls/components on the dialog and set their .Zindex property accordingly. The purpose is to set the .Zindex properties on each layer one higher than the previous layer.

Something like (FYI: This code does not work, but hopefully it will give you an idea of what I'm attempting to accomplish):

Code: Select all
procedure TframeEditContact.SetChildrenZIndex(Container: TIWCGJQContainer; Value: Integer = 100);
var
  i: Integer;
begin
  for i := 0 to Container.ComponentCount - 1 do
    begin
      if (Container.Components[i].ComponentCount > 0)  then
        Self.SetChildrenZIndex((Container.Components[i] AS TIWCGJQContainer), Value)
      else
        try
          (Container.Components[i] AS TIWCGJQGenericControlWithZIndexProperty).Zindex := Value + 1;
        except
        end;
    end;
end;


If possible, I would like to avoid testing each type to determine if it has a .Zindex property.

Suggestions?
TIA!
Scott
ScottWGast
 
Posts: 875
Joined: 23 May 2012 11:02

by Jorge Sousa » 11 Apr 2014 10:02

Hi Scott

Here's our solution

Code: Select all
uses
  IWHTML40Interfaces, IWRegion;

procedure SetZIndex(AContainer: TIWCustomRegion; const Value: Integer; ARecursive: Boolean);
var
  i: Integer;
  Ctrl: TControl;
  HTML40Control: IIWHTML40Control; // Interface shared by both TIWCustomControl and TIWCustomRegion
begin
  for i:= 0 to AContainer.ControlCount - 1 do
  begin
    Ctrl:= AContainer.Controls[i];
    if Supports(Ctrl,IIWHTML40Control,HTML40Control) then
       HTML40Control.ZIndex:= Value;
    if ARecursive and (Ctrl is TIWCustomRegion) and (TIWCustomRegion(Ctrl).ControlCount > 0) then
      SetZIndex(TIWCustomRegion(Ctrl),Value,True);
  end;
end;


You should keep in mind, that internally, (and without understandable reason), Intraweb automatically sets Zindex += 100;
Best Regards
CGDevTools Develop / Support Team
Home Page: http://www.cgdevtools.com
Jorge Sousa
 
Posts: 4261
Joined: 17 May 2012 09:58

by ScottWGast » 11 Apr 2014 15:44

Thank you so much for the solution, I knew it was possible!

And, yes, I have been inspecting the .Zindex values in the DOM explorer and have found that .Zindex gets updated to += 100. Couldn't figure out why. :|

Also, if I have more than one instance of a dialog with the same name, it's .Zindex property value gets jacked up by an additional 1000, sometimes 2000.

Have an awesome day!
Scott
ScottWGast
 
Posts: 875
Joined: 23 May 2012 11:02

by Jorge Sousa » 11 Apr 2014 17:00

hi

Also, if I have more than one instance of a dialog with the same name


How can you have a dialog with the same name? is it in different Frames? (with different Frame names)?

can you check what is the Dialog.HTMLName for each instance please?
Best Regards
CGDevTools Develop / Support Team
Home Page: http://www.cgdevtools.com
Jorge Sousa
 
Posts: 4261
Joined: 17 May 2012 09:58

by ScottWGast » 11 Apr 2014 17:23

The additional dialogs are on separate frames and I create those frames on the fly.

I have since changed the names of the dialogs so that they are unique, but I will set them back to the original name, "dialogModal" and check their html names.

Scott
ScottWGast
 
Posts: 875
Joined: 23 May 2012 11:02

by ScottWGast » 11 Apr 2014 17:41

Looks like if I use the same name on the dialog components, the HTMLName is different for each dialog; the last 8 characters are a unique HEX value.
ScottWGast
 
Posts: 875
Joined: 23 May 2012 11:02

by Jorge Sousa » 11 Apr 2014 17:48

Hi

the last 8 characters are a unique HEX value.


thanks for the info, then all is good, and the HEX come from the frame name.

Now this

Also, if I have more than one instance of a dialog with the same name, it's .Zindex property value gets jacked up by an additional 1000, sometimes 2000.


Do you mean that a 2nd dialog needs higher zindexs for the edits?
Best Regards
CGDevTools Develop / Support Team
Home Page: http://www.cgdevtools.com
Jorge Sousa
 
Posts: 4261
Joined: 17 May 2012 09:58

by ScottWGast » 11 Apr 2014 17:58

Keep in mind, this is _before_ I started using the SetZIndex procedure (above).

I was saying that it looked like the first time that I popped up a dialog, the .zindex value was 1001, the second time I popped up the same dialog, the .zindex was 2001. If I popped it up a third time, the .zindex was still 2001.

Weird, but not a showstopper.
ScottWGast
 
Posts: 875
Joined: 23 May 2012 11:02


Return to General - Archive

cron

Who is online

Users browsing this forum: No registered users and 2 guests

Contact Us.