Customizing of the designer modules (Calc and Data)
Hello,
after adding of the unit raIDE, the Calc tab appears within the designer.
When I select it, I see the need to customize it a bit - the same what I'm
doing for the Design-module already, but here it seems to be more difficult.
How to do it with the Design-module is described in my posts here and in
many articles in the wiki, but I wasn't able to find anything useful about
the Calc module.
What I would like to do:
1) Access the MainMenu of the Calc module and the items, to hide / show
them.
2) Access the toolbox with the datapipelines, elements and functions
2.1) to be able to hide / show those three single tabs
2.2) to set the caption of the datatree to the value I need instead of the
name of the datamodule where it resides. The same case as with the DataTree
within the Design-module, which I already posted here in another post.
2.3) to be able to show / hide certain entries of the "function-tree" on the
language tab
I tried it myself to accomplish at least point 1, but seem to fail to
complete it. Here how I tried it so far:
I took the article "How To...Hide DADE Menu Items" as the basis for my
attempt, but it seems to be a bit problematical. The code there assumes,
that all 4 tab are available. The condition is:
if (Designer.Notebook.ActivePageIndex = 0) then
begin
...
end;
In my case I don't have the data tab (yet), so 0 is not the data tab, but
the calc tab. I tried to find another way to determine what page / tab is
active at the moment, but it doesn't work. There are things like
Designer.Form.PreviewPageIndex or Designer.Form.DesignPageIndex, but nothing
like Designer.Form.CalcPageIndex or Designer.Form.DataPageIndex. Also
Designer.Notebook.ActivePage.Name or Designer.Notebook.ActivePage.Caption
are empty, so no way to determine the active page properly, somehow...
After looking in the RB sources I tried to work with DesignModules then to
customize at least the mainmenu, but as I said: I fail to complete it
somehow.
I found out, that the Designer.Form.MainMenu.ClassType is TraCodeManagerMenu
at that moment. Also I can get the module as well:
lLayoutManager :=
TppDesignLayoutManager(Designer.Form.DesignModules.ItemsByName['Calc']);
but type casting and accessing of the items etc. appears to be
problematical, so in case that's the correct way in general, I need some
help here and in other points
Regards,
Mark
after adding of the unit raIDE, the Calc tab appears within the designer.
When I select it, I see the need to customize it a bit - the same what I'm
doing for the Design-module already, but here it seems to be more difficult.
How to do it with the Design-module is described in my posts here and in
many articles in the wiki, but I wasn't able to find anything useful about
the Calc module.
What I would like to do:
1) Access the MainMenu of the Calc module and the items, to hide / show
them.
2) Access the toolbox with the datapipelines, elements and functions
2.1) to be able to hide / show those three single tabs
2.2) to set the caption of the datatree to the value I need instead of the
name of the datamodule where it resides. The same case as with the DataTree
within the Design-module, which I already posted here in another post.
2.3) to be able to show / hide certain entries of the "function-tree" on the
language tab
I tried it myself to accomplish at least point 1, but seem to fail to
complete it. Here how I tried it so far:
I took the article "How To...Hide DADE Menu Items" as the basis for my
attempt, but it seems to be a bit problematical. The code there assumes,
that all 4 tab are available. The condition is:
if (Designer.Notebook.ActivePageIndex = 0) then
begin
...
end;
In my case I don't have the data tab (yet), so 0 is not the data tab, but
the calc tab. I tried to find another way to determine what page / tab is
active at the moment, but it doesn't work. There are things like
Designer.Form.PreviewPageIndex or Designer.Form.DesignPageIndex, but nothing
like Designer.Form.CalcPageIndex or Designer.Form.DataPageIndex. Also
Designer.Notebook.ActivePage.Name or Designer.Notebook.ActivePage.Caption
are empty, so no way to determine the active page properly, somehow...
After looking in the RB sources I tried to work with DesignModules then to
customize at least the mainmenu, but as I said: I fail to complete it
somehow.
I found out, that the Designer.Form.MainMenu.ClassType is TraCodeManagerMenu
at that moment. Also I can get the module as well:
lLayoutManager :=
TppDesignLayoutManager(Designer.Form.DesignModules.ItemsByName['Calc']);
but type casting and accessing of the items etc. appears to be
problematical, so in case that's the correct way in general, I need some
help here and in other points
Regards,
Mark
This discussion has been closed.
Comments
There are no shortcuts to gaining access to the calc and data tabs in the
designer due to the fact that they are not always enabled. The best option
is to keep track of which pages you have enabled and index into them
accordingly (like the example).
You can get full access to the RAP code manager (including the CodeExplorer,
CodeEditor, MenuBar, and Toolbox) using the TraCodeManager typecast of the
design module. Note that the code below will need to be called after the
CodeManager is created (perhaps in the OnTabChanged event).
TraCodeManager(ppDesigner1.Form.DesignModules.ItemsByName['Calc']).MenuBar.FileMenu.Visible
:= False;
--
Regards,
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
Exactly this seems to be not that easy. I don't see a way how I can
determine, if the current tab / page is "Calc" or "Data".
How exactly is it meant?
Something like that?
- if I have calc, desing, preview, then idexes are 0 for calc, 1 for design,
2 for preview
- if I have data, calc, design, preview, then idexes are 0 for data, 1 for
calc, 2 for design, 3 for preview
- if I have data, design, preview, then idexes are 0 for data, 1 for design,
2 for preview
How do I determine, which tabs are available? Ok Designer.RAPInterface :=
[riDialog] means no Calc tab, but what about the data tab? Doesn't it depend
on an unit in the uses clause? How can I check, if it's there or not?
or not. Likewise raIDE for the calc tab. See the following article...
http://www.digital-metaphors.com/rbWiki/End-User/Fundamentals/Registration_of_Components
--
Regards,
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
Sorry for being not clear.. I will try again.
Once I add raIDE, RAP code manager is available. "Designer.RAPInterface"
would allow me to determine, if the Calc tab is available or not. Ok so far.
Once I add daIDE, DADE is available, but
- how can I control, if the tab shall be visble or not?
- how can I determine, *if* the tab is visible or not?
The reason for the need is, that I have 2 different configurations for the
designer, depending on the template type the user is going to edit, so in
one the Calc tab and the Data tab may be available, in the second not
available. All this is in the same unit due to the structure, classes etc.
RAPInterface allows me at least to control the Calc-tab visibility, so I
would be able to check if it's visible and access it via index how you
suggest, but the problem is, that the index of the Calc tab can be 0 or 1 -
depending on the availability of the Data tab, which, as I said, can be
there, can be not there.
And that's what I would need to know somehow, if it shall be done with your
suggested solution.
But aside from this:
why not to add something to control the visibility of the datatab despite
the included unit and something like "Designer.Form.CalcPageIndex" and
"Designer.Form.DataPageIndex", which would be -1 or so, if they are not
available...
I hope it's more clear what I mean now.
Regards,
Mark
There is no way to control the Data tab as there is with the Calc tab. If
for some reason you would like to how and hide the data tab in the same
application, you can manually register and unregister the design module in
code. If you take a look at the daIDE.pas file in the
Initialization/Finalization section you can see how this is done in
ReportBuilder.
--
Regards,
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com