how to set the right canvas in an firemonkey application? - firemonkey

I have 2d scene editor based on firemonkey. The user can select/move various complex 2d objects on his iPad. My problem, the objects are drawn on the scrollbar also.
The visual structure is simple. The form contains a tabcontrol. The tabcontrol's editor tab has two scrollbar (right, bottom). On the tab client area there is a TLayout type component (aligned alClient). The 2d objects parents are the layout component. The 2d object parent type is TShape.
I assume the application draw on the form directly instead of drawing on the editor tab. How to set the correct drawing canvas?

The solution:
Layout.ClipChildren := True;

Related

UWP - Custom non-rectangular hit area on button. Either image or shape

I would like to define a non-rectangular clickable "hit area" for a button. I am happy to define this custom shape using a UWP XAML path, or by using a PNG with transparent areas.
The following question explains how to use an XAML path for a button's appearance, but the result still seems to use a rectangular bounding box hit area. XAML UWP Button with a polygonal shape
There are also posts explaining how to override the Image class, intercepting the 'click' event, and determining the opacity of the pixels under the mouse cursor. This would solve my problem, but this solution only applies to WPF.
Does anyone know of a solution for UWP?
It looks like I can just use the raw < path > element, and use its pointer events directly.

Unable to Move the Canvas or Change Any of the Transform Values

I am using Unity 5 and I started to make a menu scene. When I made the canvas, all of values under the Rect Transform component are locked and it says "some values driven by Canvas." The only thing I can change is the z position when using the gizmo in the editor. I can't reset the position or anything. Why is this happening?
This means that the canvas's canvas component has it's render mode set to Screen space - overlay. This forces it to be the size of the screen. Change it to World Space and it will allow you to resize it and move it around.
Changing the Render mode is not an ideal solution; neither is Overlay mode the reason why this is happening at all. World Space is just a render mode that changes the way your whole UI behaves and would mean a whole different set up and a whole lot more work just to get a child UI object to move independently.
Here is the description of what World Space is for from the Unity site:
In this render mode, the Canvas will behave as any other object in the
scene. The size of the Canvas can be set manually using its Rect
Transform, and UI elements will render in front of or behind other
objects in the scene based on 3D placement. This is useful for UIs
that are meant to be a part of the world. This is also known as a
“diegetic interface”.
The Rect Transform usually gets locked because it is a child of another Canvas Object which controls its Transforms. The way to fix this is to overwrite it by adding a “Layout Element” component to it. From there you can configure it to work the way you like and it can have transforms independent of the Parent UI Object.
For full details, see this Unity support page: https://support.unity3d.com/hc/en-us/articles/115000179163-How-to-overwrite-Width-and-Height-values-that-are-driven-by-a-Layout-Group-in-runtime-
Canvas is depend on game tab in your window panel.
Adjust panel by use of close tab or resize panel or doc game panel.
It will help you make default 800 X 600 canvas.

Irregular/Abnormal shaped WinForms Control (Button or PictureBox) [duplicate]

I would like to make my user control have invisible areas like the areas that surround a circle or an irregular shape. I have seen this done with a system.windows.form but not with a system.windows.form.usercontrol. How is this done?
.net 2.0,c#,winform
You can set the control's Region to an irregular GraphicsPath. Here's an article that shows how to create irregular shaped menuitems

UI doesn't show up in #Screen tab in Unity 4.6

I have just upgraded Unity to version 4.6 and tried to create a button by Create -> UI -> Button.
However, this button doesn't show up in #Screen tab but it does in Game tab.
Please look at the screen shoot below:
Another question is: The default width and height when creating a new button is 160 x 30. When I change the source image with my own image button, I have to change the width and height parameters in rect transform. Is there any faster way to automatically obtain new width and height based on the image which I insert?
Thank you very much!
First, double click the button in your hierarchy and see that it indeed does not show in the Scene view, excluding any kind of zoom problem. (By the way, I'm assuming you mean "Scene" and not "Screen", right?) Things in different cameras or canvases might have very different scales but appear correctly in the Game view. I don't know how used you are to Unity, so I'm sorry if this sounds obvious. :)
Next, check the dropdown labeled "Layers" on top of Unity's editor, to the right of the Play, Pause and Step buttons. See if the layer of your button (which in this case is "UI") is visible. It should have an open eye icon next to it.
Regarding your other question, after dragging your sprite to the Image component, you can press the "Set Native Size" button, which will set the size of your object to the dimensions of your Sprite. Regarding the new UI, I think this is as automatic as it gets. Note that "Set Native Size" will only appear if your Image type is set to Simple (probably what you want) or Filled in the component.
I had the same problem before and here's a possible solution.
By default, the editor camera (Scene Tab) renders the World Space,
so your Canvas component's render mode should be set to "World Space".
The problem may only occur when you're trying to (or supposedly) render your UI in Screen Space - Overlay or Screen Space - Camera in the Canvas component.
So if you want to properly edit UI objects in the scene tab/window; set the Canvas component's render mode to World Space.
We don't have this problem in Unity 4.x before because I think Unity automatically renders any render mode from the Canvas component, however, that doesn't happen in Unity 5.x. I'm guessing it's either intentional that they do that or it's a bug on Unity UI feature.

Mapping user input from one DOM element to the renderer element using Three.js and TrackballControls.js

I am trying to create a small container where the user will be able to move the mouse/drag his finger in order to control the renderer DOM element, in another container. The problem is that TrackballControls.js, a controller script included with THREE.js, maps the controls to event.clientX and event.clientY, so when I drag with in the small container I created, I don't see the desired effect. I was wondering what a proper way to map the input from a small area and effect the renderer element as if the user had the entire rendering area to give input?
The reason I need to do this is because I am integrating a CSS3D view into a normal, 2D page, and the mobile experience is awful if I do not disable to touch controls on TrackballControls.js- the user will be scrolling down the page as normal, and when he hits the 3D div, the 3D controls take over and the user can no longer scroll out of that area back to the rest of the page content. So I need a little small area where the user can spin, zoom, and pan my 3D visualization but then be able to scroll on the rest of it to escape.
Thanks!

Resources