Jump to content
Sign in to follow this  
limelect

On IDE cannot get TABS

Recommended Posts

Further to my small project and on D10.2.3

I am NOT using tool Pallet

I am using  ToolBar>Component as on d7.

I want to detect the tabs and open one of them

I am using also Winspector.

 

  FDelphiForm :=Application.MainForm;
  x:=TComponent(FDelphiForm.FindComponent('ComponentToolbarFrame'));
  x:=TComponent(x.FindComponent('TabControl'));<<< hear i tried also TTabControl instead of TComponent
  x IS NOT NIL.
  
 TTabControl(x).TabIndex:=3;  <<<<<     dose not work
label1.caption:=  TTabControl(x).Tabs[0] ; <<< Access violation

 

Label2.Caption:=TComponent(x).name; ===TabControl 

Any thing with tabs give an error.

 

I have tried many variations.

As far as I recall @dummzeuch comented that multiline is not possible above D7

I tried it does not work.

 

Maybe it is not possible to access the ToolBar ?

 

 

Screenshot - 15_09_2020 , 18_13_36.jpg

Share this post


Link to post
15 minutes ago, limelect said:

I am using also Winspector.

Did you try one of the Delphi IDE Explorers? E.g. mine. It might get you better information than Winspector.

 

15 minutes ago, limelect said:

As far as I recall @dummzeuch comented that multiline is not possible above D7

Multline tabs for the editor window are not possible with Delphi > 7. I don't know about the "new" old style component palette, I never used it.

Share this post


Link to post

@dummzeuch I will try.

However, what I did on each FindComponent I made sure it is not nil

and save all components to file with ComponentCount Components.Name

this how I found all the names. 

Share this post


Link to post

@dummzeuch Thanks I used it. 

However, I sent you a personal mail with comments and

changes to your software for you to add and publish.

 

As for my problem, it seems I cannot reach the component tabs.

Although TTabControl(x).Tabs in not nil it cannot be accessed.

 

Share this post


Link to post

P.S TTabControl(x).Visible:=false; make all the tabs disapear.

So I have control of the tabs but not on TTabControl(x).Tabs

Share this post


Link to post
3 hours ago, limelect said:

P.S TTabControl(x).Visible:=false; make all the tabs disapear.

So I have control of the tabs but not on TTabControl(x).Tabs

Since the Visible property is introduced very early in the controls hierarchy, it's more likely to work than the Tabs property. Most likely your "x" is not a TTabControl but something else. Have you checked its ClassName?

Share this post


Link to post

@dummzeuch Yes ClassName and more.

Every thing checked. It is a TTabControl and I even did

a hide that hides all the tabs.

with IDE Explorer (Not yours) I can see all propeties.

ComponentToolbarFrame>TabControl=TTabControl

My only problem now is that TABS is not nil but using it give an error.

 

Share this post


Link to post

TabControl is a TGradientTabSet, not a TTabControl and it does not descend from TTabControl either (Look at the Hierarchy tab in the IDE explorer), so typecasting it to TTabControl won't work. It doesn't have a Tabs property either, so even RTTI won't help you there.

 

I found a TGradientTabSet on https://github.com/RRUZ/Delphi-IDE-Colorizer/blob/master/IDE PlugIn/Galileo/TGradientTabSet.pas. Not sure this is the one used in the IDE, but it's worth a try since this seems to be an IDE plugin.,

Share this post


Link to post

@dummzeuch I will try

P.s i saw it before

 

It is not implemented. No idea how to use it.

Edited by limelect

Share this post


Link to post

Yeah, that's odd. I wonder where this declaration comes from. There are other classes there as well, that are naked declarations. Maybe looking at the project as a whole would give some clues.

 

For a start I would remove all property and method declarations, typecast to this type and try to access the fields to see if that results in plausible values.

If they do, it's possible to call the virtual methods through the VMT. But that's definitely out of my league.

Edited by dummzeuch
  • Like 1

Share this post


Link to post

Have a look at the code in "IDE PlugIn\Colorizer.Hooks.IDE.pas", "IDE PlugIn\Colorizer.Hooks.pas" and "IDE PlugIn\Colorizer.Wrappers.pas". These seem to be the places where the plugin hooks into the TGradientTabSet code of the IDE.

 

I just grepped for "TGradientTabSet", I didn't try to understand any of the code, so don't ask me how it works, I don't know.

Share this post


Link to post

Yes, I used your GREP already and I still, unfortunately, did not understand how to use it.

Any idea?

It will not work.

For example, it has

FTabList            :TList;

FTabList            :TStringList;

Is it allowed?

Something fishy.

 

Edited by limelect

Share this post


Link to post

I will look further with your advice that it is TGradientTabSet and not TabControl

But if I use IDE explorer (sorry not yours) I see all the properties

and I do not see TABS but Items so you might be correct

 

On CnWizard there is something to associate the toolbar

search for TGradientTabSet. I will investigate

Edited by limelect

Share this post


Link to post

The joke is on me. They did not implement it only the d7. Back to the search

Edited by limelect

Share this post


Link to post

@dummzeuch With the help of this link and IDE explorer  IIIIII DDDDIDDDD IT.

From here I got https://stackoverflow.com/questions/2071247/dynamically-access-a-property-in-a-delphi-component/2071398

var

PropInfo: PPropInfo;

   x:=TComponent(x.FindComponent('TabControl'));
    PropInfo:= GetPropInfo(x.ClassInfo, 'TabIndex').;

SetOrdProp(x, PropInfo, 3);  it press tab 4.

 

Thanks every body and see you on my next NOT EASY problem.

 

P.S may some know how to get a list of items from

PropInfo:= GetPropInfo(x.ClassInfo, 'Items')  into StrinList?

 

Edited by limelect

Share this post


Link to post

As of my last request reading an item like integer is no problem

like

    PropInfo:= GetPropInfo(x.ClassInfo, 'LastShownIndex');
  i:=   GetOrdProp( x,PropInfo);

  Label2.Caption:=inttostr(i);


But items=stringlist how?

Share this post


Link to post

@dummzeuch without your lead I could not have done it

I was thrown away by thinking that it was TabControl

Thanks

Checking that it works got the list of my tabs

 sx=tstringlist

   PropInfo:= GetPropInfo(x.ClassInfo, 'Items');
 sx:= TStringList(GetObjectProp(x,PropInfo));
 Label2.Caption:=inttostr(Sx.Count);
 Memo1.Clear;
 for I := 0 to Sx.Count-1 do
 Memo1.Lines.Add(sx) ;

Great
why cannot write  bracket i bracket ???????????

Edited by limelect

Share this post


Link to post

Ok my software is OK

Now for Embarcadero to give some Answers.

I have 2 components bar.

1. D7 like.

2. Tool pallet.

 

They differ in what the show  position wise!!!!!

For example, the Tool bar does not have BDE or ActivX in the same position !!!!

What is going on?

 

Edited by limelect

Share this post


Link to post

Found one drawback

  sx := TStringList(GetObjectProp(x, PropInfo)); // all the tabs
this instruction cannot be made ONShow only On form create.

It makes on second-time error.

It has to execute only once.

Which mean installing a new component will not

update unless I restart Delphi.

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×