I need to create a simulink library block that has a configurable subsystem inside.
One of my requirements is that the end user can change the configurable subsystem (inside the library) block choice as a mask parameter of the library without breaking the link.
Also, since this block will be used 100000x times, I cannot use the initialization panel of mask editor due to performance issues when loading the model.
Each library instance should use a different block choice...
Is it possible to implement? How?
I figure it out..
You need to set the 'Allow library block to modify its contents' checkbox inside Mask Editor/Initialization pane
Related
I'm struggling to find documentation on cursor customization in MRTK. Consider a plain simple scenario - I want custom cursor when I focus on certain object in the scene.
If you look into this official sample -- EyeTracking, the visual effects of the “cursor” when a user is looking at an object is simply switching the state of the background object (enable/disable). You may refer to the sample to customize the visual effects.
EyeTracking sample is not of much help, MRTK in fact does not provide available tools to customize cursor visuals. I see two options available:
Implement custom BaseCursor similarly to how e.g. AnimatedCursor is implemented and create your own context info class similarly to how CursorContextInfo is done. This is how MRTK modifies cursor when focusing on resize and scale handles.
Modify available pointer prefab, add your custom visuals into it and add a custom singleton script there. Use available focus on/off events on your content objects to modify cursor via singleton methods.
I have a simple GTK program in c that requires the user to set values using GTK Scale widgets. Is there a way to make the settings persistent so that they will still be there when the program is closed and run again?
Thanks!
Use GSettings. Briefly, this involves writing a "settings schema" describing the pieces of data (each known as a "setting") that you want to save across program runs. Then, you can use g_settings_bind() to bind the setting to the value property of your GtkScale's GtkAdjustment, so the value will automatically be saved each time the slider is dragged.
I'm investigating some novel approaches to extending openui5.
Particularly I'm playing around with the idea of implementing material design with openui5 (through material design lite https://github.com/google/material-design-lite). Normally, you would extend existing components with new ones, but I want to avoid this if possible.
One approach would be to dynamically change the renderer of a component during runtime. I want to change the renderer for a particular instance of a component and not all instances.
I've found that through the MetaData of the control, I can change overwrite the render function
myComponent.getMetadata().getRenderer().render = function(oRm, oControl) {
...
};
myComponent.rerender();
This gives the intended effect. However, using this approach changes the renderer for all instances of the component class.
Is there some way of only changing the renderer for a particular instance?
Well, in the standard controls that come as part of the framework, the *Renderer for each control is a static class - this is why the control instance is passed in to the render() method. This is why re-defining the render method, as you did it, affects all control instances of this type.
Sneaking into metadata.getRenderer() and returning something different for this instance would cause similar issues, as ElementMetadata is also one instance for the entire control class. Cloning the metadata and modifying it for certain instances would be an option, but I think not a nice one.
Maybe a simple solution is the best choice here?
Mark the control instances to be rendered differently with a flag and overwrite the render method to either do the normal thing or do the special handling, depending on this flag.
Something like this:
http://jsbin.com/yabujigitu/edit?html,output
I have a Containerwith so many Labels added inside it. When I try to capture the pointerReleased event in this Container, I have found some problems. The event only is captured when I released in the free area of the Container, no when I made the release over the Labels. Is there any way to encapsulate this event? I mean when I will do the realase over the main Container(instead I'm on a Label), the event must be launched.
Here you can take a look at my Container
You should look at the lead component feature added in LWUIT 1.5, it allows you to define a component that manages the entire hierarchy of container/component and all events for every component in the hierarchy are sent to it.
This adds another benefit of handling the style synchronization between all the different elements (e.g. if you use a button all components will become pressed together).
I dont' find any cool solution, so finally I propagate the pointerReleased from the Labelsto the Container.
GWT's Editor framework is really handy and it can not only be used for editing POJOs but also for read-only display.
However I am not entirely sure what the best practice is for doing inline edits.
Let's assume I have a PersonProxy and I have one Presenter-View pair for displaying and editing the PersonProxy. This Presenter-View should by default display the PersonProxy in read-only mode and if the user presses on a edit button it should allow the user to edit the PersonProxy object.
The solution I came up with was to create two Editors (PersonEditEditor and PersonDisplayEditor) that both added via UiBinder to the View. The PersonEditEditor contains
ValueBoxEditorDecorators and the PersonDisplayEditor contains normal Labels.
Initially I display the PersonDisplayEditor and hide PersonEditEditor.
In the View I create two RequestFactoryEditorDriver for each Editor and make it accessable from the Presenter via the View interface. I also define a setState() method in the View interface.
When the Presenter is displayed for the first time I call PersonDisplayDriver.display() and setState(DISPLAYING).
When the user clicks on the Edit button I call PersonEditDriver.edit() and setState(EDITING) from my Presenter.
setState(EDITING) will hide the PersonDisplayEditor and make the PersonEditEditor visible.
I am not sure if this is the best approach. If not what's the recommended approach for doing inline edits? What's the best way to do unit-testing on the Editors?
If you can afford developing 2 distinct views, then go with it, it gives you the most flexibility.
What we did in our app, where we couldn't afford the cost of developing and maintaining two views, was to bake the two states down into our editors, e.g. a custom component that can be either a label or a text box (in most cases, we simply set the text box to read-only and applied some styling to hide the box borders).
To detect which mode we're in, because we use RequestFactoryEditorDriver (like you do), we have our editors implement HasRequestContext: receiving a null value here means the driver's display() method was used, so we're in read-only mode. An alternative would be to use an EditorVisitor along with some HasReadOnly interface (which BTW is exactly what RequestFactoryEditorDriver does to pass the RequestContext down to HasRequestContext editors).
Yes,Presenter-View pair should be. But Here two ways to achieve this feature if you like to go with:
1) Integrate Edit/View code design in one ui.xml i.e.Edit code in EDitHorizonatlPanel and View code in ViewHorizontalPanel.The panel has different id. By using id, show/hide panel with display method. if getView().setState() ==Displaying then show ViewHorizontalPanel and if getView().setState()==Editing then show EditHorizontalPanel.
2) Instead of using labels, Use textboxes only. set Enable property is false when you need it in view mode otherwise true
You have created two Presenter/view but I think if Edit/View function has similar code so no need to rewrite similar code again and again for view purpose.
If a big project has so many Edit/View function and you will create such type of multiple View/Presenter than your project size become so huge unnecessary.
I think that whatever I have suggest that might be not good approach but a way should be find out which help to avoid code replication.