The current designer doesn't easily support locking of a component. You can hook into the Designer.OnDestroyComponent event, but there is no way to stop the component from being freed from the workspace. What you can do is reload the template or use a subreport ins a band to reload a template that represents the band.
Thanks for the answer. I was just trying something. In the selectionchanged event i generate a message like 'this component cannot be changed' if its a 'read-only'component. After this i would like to change the focus to the designer form, or to another item in the designer. I tried Abort, but this doesn't abort the selection. Can this be done? Or are there any other problems i didn't see?
And is it possible to hide or remove the popup menu when you right-click on a component?
I worked on finding a solution to locking a component, as in making new descendent components implement a IppLockable interface, then checking that in the designer events. After looking at what the designer would have to do, the designer would have to be significantly enhanced to support locking. We have this on the todo list I remember readign a post a few months ago about a customer who had a good approach to dynamically recreating components after they were deleted by the user. I can't seem to find this post unfortunately. My guess is that you could compare a a report loaded with the original tempalte and the report that the user is using and has just deleted a componen from. Then looping through the objects, when one is located in the original tempalte but not the user's then you could recreate that component and assign its properties to the user's report. We don't have a demo of this, but maybe this could be one way to do it. We'd have to try it to find out. The problem is going to be creating and assigning the properties without hardcoding for the different class types.
To disable options in a component's popup menu, you can create a custom descendent of that component, unregister the current class and register the new class. The descendent can override the CreatePopupMenu method and disable some of the options. For an example of creating a custom component, see the RBuilder\Demos\RCL directory which creates a check box component.
Comments
hook into the Designer.OnDestroyComponent event, but there is no way to stop
the component from being freed from the workspace. What you can do is
reload the template or use a subreport ins a band to reload a template that
represents the band.
A locking feature is on the to do list.
Cheers,
Jim Bennett
Digital Metaphors
http://www.digital-metaphors.com
info@digital-metaphors.com
Thanks for the answer. I was just trying something. In the selectionchanged
event i generate a message like 'this component cannot be changed' if its a
'read-only'component. After this i would like to change the focus to the
designer form, or to another item in the designer. I tried Abort, but this
doesn't abort the selection. Can this be done? Or are there any other
problems i didn't see?
And is it possible to hide or remove the popup menu when you right-click on
a component?
Thanks in advance, Wim Looman.
descendent components implement a IppLockable interface, then checking that
in the designer events. After looking at what the designer would have to do,
the designer would have to be significantly enhanced to support locking. We
have this on the todo list I remember readign a post a few months ago about
a customer who had a good approach to dynamically recreating components
after they were deleted by the user. I can't seem to find this post
unfortunately. My guess is that you could compare a a report loaded with the
original tempalte and the report that the user is using and has just deleted
a componen from. Then looping through the objects, when one is located in
the original tempalte but not the user's then you could recreate that
component and assign its properties to the user's report. We don't have a
demo of this, but maybe this could be one way to do it. We'd have to try it
to find out. The problem is going to be creating and assigning the
properties without hardcoding for the different class types.
To disable options in a component's popup menu, you can create a custom
descendent of that component, unregister the current class and register the
new class. The descendent can override the CreatePopupMenu method and
disable some of the options. For an example of creating a custom component,
see the RBuilder\Demos\RCL directory which creates a check box component.
Cheers,
Jim Bennett
Digital Metaphors
http://www.digital-metaphors.com
info@digital-metaphors.com