Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 10 of 17 total
Thread How to find or go to a Page by its name
Sun, Aug 9 2015 12:45 PMPermanent Link

Trinione

Hi:
I would like to do something like: PagePanel.PageByName('Page1').Tab.Visible := False;

Should I write a function that loops thru and find it, as in:

pgName := 'Page1';
for i := 0 to PagePanel1.PageCount - 1) do
begin
 if PagePanel1.Pages[i].Name := pgName then
 begin
   PagePanel1.Pages[i].Tab.Visible := False;
   exit;
 end;
end;
Sun, Aug 9 2015 12:50 PMPermanent Link

Uli Becker

TPage(FindComponent('Page1')).Tab.Visible := false;

Uli
Sun, Aug 9 2015 1:13 PMPermanent Link

Trinione

<< TPage(FindComponent('Page1')).Tab.Visible := false; >>

Thank you Uli.

Clearly I need a few days off of programming (forgetting the basics now!) :/
Mon, Aug 10 2015 10:42 AMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Uli,

<< TPage(FindComponent('Page1')).Tab.Visible := false; >>

In case anyone is wondering why FindComponent isn't documented, it's because it's actually a protected method, and I need to do some updates to the component references before I can start including protected properties/methods.  EWB 2 has an unusual protected scope for classes that is both different from EWB 1 and Delphi.  In EWB 2, access to the protected scope of a class is determined by whether a) the class method accessing the property/method is a descendant of the class being accessed (same as EWB 1 and Delphi), or b) the class method accessing the property/method is a descendant of the class *in which the property/method was declared*.

For example, a TDialogEditComboBox class method can't access a protected property in a TEditComboBox class if the protected property is declared in the TEditComboBox class.  However, a TDialogEditComboBox class method *can* access the protected Element property of the TEditComboBox class, because both classes descend from the TInterfaceController (WebUI unit) class where the Element property is declared as a protected property.

I hope that makes sense.

Tim Young
Elevate Software
www.elevatesoft.com
Fri, Jun 3 2016 7:58 AMPermanent Link

Trinione

<< In case anyone is wondering why FindComponent isn't documented, it's because it's actually a protected method, and I need to do some updates to the component references before I can start including protected properties/methods. >>

Tim:
Any idea when FindComponent will be available? It would be extremely useful. Thanks.
Fri, Jun 3 2016 8:07 AMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com


<< Any idea when FindComponent will be available? It would be extremely useful. Thanks. >>

I just surfaced it for 2.05.

Of course, you're free to do so yourself, and have been able to do so since the question was first asked.

Tim Young
Elevate Software
www.elevatesoft.com
Fri, Jun 3 2016 8:09 AMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

<< Any idea when FindComponent will be available? It would be extremely useful. Thanks. >>

Also, in case it wasn't clear the first time: any TComponent instance's methods *can* use the *protected* method right now, no need for promotion to a public property.  The only reason that it's needed is for documentation purposes.

Tim Young
Elevate Software
www.elevatesoft.com
Fri, Jun 3 2016 10:48 AMPermanent Link

Trinione

<< Of course, you're free to do so yourself, and have been able to do so since the question was first asked. >>

I made the decision not to change things within the EWB core system as those changes may impact ensuing versions and become my personal nightmare to maintain/figure out.
Fri, Jun 3 2016 10:52 AMPermanent Link

Trinione

Tim Young [Elevate Software] wrote:

<< Also, in case it wasn't clear the first time: any TComponent instance's methods *can* use the *protected* method right now, no need for promotion to a public property.  The only reason that it's needed is for documentation purposes. >>

Tim:
EWB has re-awaken my interest in Pascal. Still coming to terms with it and don't understand the nuance of what you said regarding *protected* method etc. I shall research it and grasp it soon enough though.

Thanks.
Fri, Jun 3 2016 11:03 AMPermanent Link

Trinione

Question: Is it possible to find a tab in an Application by its name?

For example, a form has a page panel tab named 'tabUser_293'. And, from another form elsewhere in the system find that tab with: Application.TPage(FindComponent('tabUser_293'))?

Just thinking out loud before I try it over the weekend.
Page 1 of 2Next Page
Jump to Page:  1 2
Image