Hello staff, as I can do for my end user can not change or objects and data that are in bands of Header and Footer. We do not want users to change the way this information. Thanks
Here is an example I created that shows how to prevent the end-user from modifying the report header. No objects in the header can be selected and no popup menus can be invoked.
Nard Moseley, Good Afternoon. His examples were 100% reliable and adapted to our examples, but now with these resources, I had another problem. When you give a preview in the Designer, the report shows it perfectly, but to return it enables the popup menus for the header and footer again. How can I do to make this not happen. Thank you again and happy Christmas and a prosperous 2008.
the tips with the components and popupmenus were arelredy helpfull, but I need one more thing for my reports, which is similar to the topic here: how can I prevent, that the end user resizes the height of the bands?
I would like to set it to a certain value and to keep it. At the moment the user can resize it with the mouse, when he clicks on the band and drags it.
This can be done by disabling the band control for each band present in the report. It's a long way to get to the BandControl from the designer but it is possible...
uses ppDesignLayoutManager;
procedure TForm1.ppDesigner1Show(Sender: TObject); begin //if you want to disable all bands, create a loop here TppDesignLayoutManager(ppDesigner1.Form.DesignModules.ItemsByName['Design']).WorkspaceView.DesignControlManager.BandControlsByIndex[0].Enabled := False; end;
Does it make any difference if I use the one option or the other? Which one should be used preferably? Yours looks better, I think.
What seems not to work with your suggestion, though, is to "remove" the popupmenu of the band.
it works with: Designer.Form.LayoutManager.DialogController.DesignControlManager.BandControls[Designer.Report.DetailBand].PopupMenu := nil;
but it doesn't work with: TppDesignLayoutManager(Designer.Form.DesignModules.ItemsByName['Design']).WorkspaceView.DesignControlManager.BandControls[Designer.Report.DetailBand].PopupMenu := nil;
Is there any reason? Is the way I'm doing it ok?
Though there seems to be a problem with the popupmenu, if I remove it. By clicking on the band with the right mouse button an AV occurs in procedure TppDesignWorkspaceController.DisplayBandPopupMenu(aCursorPos: TPoint);
I took a look into it and "if (lBandControl <> nil) and (lBandControl.PopupMenu <> nil) then" instead of "if (lBandControl <> nil) then"
Comments
- This example shows how to control the designer selection.
http://www.digital-metaphors.com/tips/DesignerSelection.zip
- To check whether a component is in the header or footer, you can code
something like this...
uses
ppBands;
if (Component.Band is TppHeaderBand) or (Component.Band is TppFooterBand)
then
ShowMessage('component is in the header/footer');
--
Nard Moseley
Digital Metaphors
www.digital-metaphors.com
Best regards,
Nard Moseley
Digital Metaphors
www.digital-metaphors.com
The code you passed me worked legally, but now must disable the pop-up menu
of all objects of each Band, or disable the pop-up menu of bands.
Thank you and I look forward on.
Here is an example I created that shows how to prevent the end-user from
modifying the report header. No objects in the header can be selected and no
popup menus can be invoked.
http://www.digital-metaphors.com/tips/PreventEditOfComponents.zip
--
Nard Moseley
Digital Metaphors
www.digital-metaphors.com
Best regards,
Nard Moseley
Digital Metaphors
www.digital-metaphors.com
Good Afternoon. His examples were 100% reliable and adapted to our examples,
but now with these resources, I had another problem. When you give a preview
in the Designer, the report shows it perfectly, but to return it enables the
popup menus for the header and footer again. How can I do to make this not
happen.
Thank you again and happy Christmas and a prosperous 2008.
http://www.digital-metaphors.com/tips/PreventEditOfComponents.zip
--
Nard Moseley
Digital Metaphors
www.digital-metaphors.com
Best regards,
Nard Moseley
Digital Metaphors
www.digital-metaphors.com
newsgroup guidelines.
http://www.digital-metaphors.com/support/newsgroups.html
- Attachments may be sent to support@digital-metaphors.com
- I posted an updated example in a response higher up in this thread. I
will repeate it here.
http://www.digital-metaphors.com/tips/PreventEditOfComponents.zip
--
Nard Moseley
Digital Metaphors
www.digital-metaphors.com
Best regards,
Nard Moseley
Digital Metaphors
www.digital-metaphors.com
the tips with the components and popupmenus were arelredy helpfull, but I
need one more thing for my reports, which is similar to the topic here:
how can I prevent, that the end user resizes the height of the bands?
I would like to set it to a certain value and to keep it. At the moment the
user can resize it with the mouse, when he clicks on the band and drags it.
Is there a way to prevent this?
Mark
This can be done by disabling the band control for each band present in the
report. It's a long way to get to the BandControl from the designer but it
is possible...
uses
ppDesignLayoutManager;
procedure TForm1.ppDesigner1Show(Sender: TObject);
begin
//if you want to disable all bands, create a loop here
TppDesignLayoutManager(ppDesigner1.Form.DesignModules.ItemsByName['Design']).WorkspaceView.DesignControlManager.BandControlsByIndex[0].Enabled
:= False;
end;
--
Regards,
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
thanks a lot. Somehow I didn't think, that it's so easy and "band.enabled :=
false" does already lead to the result I need
So it works with your suggestion:
TppDesignLayoutManager(Designer.Form.DesignModules.ItemsByName['Design']).WorkspaceView.DesignControlManager.BandControls[Designer.Report.DetailBand].Enabled
:= False;
and with my attempt too:
Designer.Form.LayoutManager.DialogController.DesignControlManager.BandControls[Designer.Report.DetailBand].Enabled
:= false;
Does it make any difference if I use the one option or the other? Which one
should be used preferably? Yours looks better, I think.
What seems not to work with your suggestion, though, is to "remove" the
popupmenu of the band.
it works with:
Designer.Form.LayoutManager.DialogController.DesignControlManager.BandControls[Designer.Report.DetailBand].PopupMenu
:= nil;
but it doesn't work with:
TppDesignLayoutManager(Designer.Form.DesignModules.ItemsByName['Design']).WorkspaceView.DesignControlManager.BandControls[Designer.Report.DetailBand].PopupMenu
:= nil;
Is there any reason? Is the way I'm doing it ok?
Though there seems to be a problem with the popupmenu, if I remove it. By
clicking on the band with the right mouse button an AV occurs in
procedure TppDesignWorkspaceController.DisplayBandPopupMenu(aCursorPos:
TPoint);
I took a look into it and
"if (lBandControl <> nil) and (lBandControl.PopupMenu <> nil) then"
instead of
"if (lBandControl <> nil) then"
does fix it, in case it's a correct place. Is it?
Regards,
Mark
the PopupMenu <> nil for the next release.
--
Regards,
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com