How to hide outer bounded parent rectangle in GEF figure - eclipse-gef

I am trying to create a circle or an ellipse in GEF framework. We are setting constraints/bounds as a rectangle within which the circle/ellipse sits.
My problem is that I am not able to hide/suppress outer Rectangle when I do drag drop or I just click on the circle. Is there any way we can remove this outer Rectangle ? any tip idea would help. thanks

This rectangle is created by the NonResizableEditPolicy (or ResizableEditPolicy if your figure is resizable). This policy is added automatically to children of some layout policies, for example children of ConstrainedLayoutEditPolicy. What you need to do is find which layout policy you are using in your container, and override it to use a different edit policy to decorate the children of the container. This can be done by overriding the NonResizableEditPolicy (or ResizableEditPolicy) and then modify how this policy provides feedback when the Figure is selected, clicked on, etc.

Related

How to make a drag and drop in Grid Layout in Xamarin forms?

What I want to achieve is to drag red box view and drop in on the aqua boxview. The aqua box view should then take the place of the redbox view. How can I achieve this in Xamarin Forms ? I have added the following XAML code below. Please someone help me with this.
AFAIK Xamarin.Forms does not support drag-n-drop out of the box, hence you'll have to implement it yourself. It won't be easy, since there are certainly some edge cases to consider, but it's achievable. Basically the steps could be (maybe there are other options)
Add an AbsoluteLayout that wraps your Grid
Add an PanGestureRecognizer
When the pan gesture starts, check if it's on the red BoxView
If so, move the red BoxView to the AbsoluteLayout and remove it from the Grid
Move the red BoxView if the pan is updated
When the users stops the pan, check whether the red BoxView where you'd expect it to be dropped
If so, drop it (whatever that means in the context of your app)
If not, animate it back to its original position, remove it from the AbsoluteLayout and add it to the Grid
If you have tried to implement it and are stuck with a more concrete issue, feel free to ask another question about it.

GUI shapes border checking (FLOWCHART CONNECTOR)

So I'm working on a Flowchart (OOP) Program, and I have to implement a code for Connector, which has the condition that it must be between 2 other shapes.
So the question here is how to check if the user click is within a "shape" area ?
Like I can "GetMouseClick" as a function, but I need to check if this point lies in a shape from the shapes drawn.
NOTE : Each shape has a class !
For each class (shape) define a getBounds(...) method that will return the rectangle (or a polygon) and when you click you can iterate over all shapes and see within what bounds the click was.
Another idea is to add mouse listener for each shape and rely on event handler to tell you what shape was clicked.

Positioning a UIView between two other views. Autolayout

I'm using Autolayout to set up quite a lot of labels and buttons in a view. One button needs to be exactly betwwen 2 UILabels and I don't know how to accomplish that. I try to get the position on one label, the position of the other, do the math, etc. But since it's using autolayout, it turns out that the frame.origin.x property is always 0.
So any clues on how to do that?
thanks in advance,
One possible way to do this using the designer is to place a container that will fill the space between the two labels. Just drag a View onto the design surface and make sure that you have the following constraints: Top Space to the top label with default value and Bottom Space to the bottom label with default value.
Once you have this container simply place the button as a child of this container and centre the button horizontally and vertically in the container. That should do it.
This could also be done with code. Let me know if sample code is needed.

remove a button from application at runtime

I have a xcode/ipad application that adds buttons at runtime at the touch point on the screen.
Now I need to remove these button(s) at runtime by only using the x/y coordinates.
How do I accomplish this??
take care
tony
not the best and fastest way to do it, but iterate over the parent view's control list, find out their relative x/y coordinates and remove them from the parent view

Sizing a control to fit its container in Interface Builder

Let's say I have a split view, and I want to fill half of it with a table view (a fairly common use case, I would think). Is there any way to tell the table view to size itself to fit the split view or do I really have to size it manually?
I've done this, the way Jon Hess mentions first. Assuming you're using Interface Builder version 3:
Drag and resize your GUI (tableview from what I understand?) component to fit into the enclosing area the way you want it.
Click it to select it.
Press Command-Shift-I to open the inspector window for this GUI component. The inspector window should now actually show that you've selected a "Scroll View".
Click the "ruler" heading to be able to set the sizing. You'll see to the right an animated representation of how your GUI component will behave within its enclosing GUI component, and to the left another represenation of the same, without animation, but with four springs and two struts that you can turn on or off.
Turn all six things on, making them red.
VoilĂ  :-)
It's generally easier to create the subviews first, then use the Layout/Embed Objects In/Split View menu item to create the split view around them.
As far as I know, doing it manually is the only way to go. However, if you turn on "snap to cocoa guidelines", the inner view will snap to the edges of the enclosing view as you drag towards them. This makes it easier than having to manually mouse the edges into place, or manually edit the sizes to match.
You can set all of the springs and struts of the table view to "on" in the size inspector and that will cause the table view to fill the split view. Alternatively, you can use the outline view in the main document window to place the tableview's enclosing scroll view directly into the splitview instead of in an intermediary custom view.

Resources