I want to see the added object in the view.
Show me the solution.
This is from the FAQ:
How do I display something in a GoView control?
You’ll want to allocate a new object that is an instance of a GoObject class, typically an instance of one of the predefined GoNode classes that Go provides. Set the Location (and optionally the Size) of this new object, and set any other properties you care about, and then add it to the view’s document:
A very simple complete example is given in the MinimalApp sample.
This concept of adding objects to the view’s document applies generally to most views, including GoPalette. By convention, you should add links to a particular layer of the document:
There are several possibilities:
· You didn’t add your object to the right document
· You added it to an invisible layer (GoLayer.AllowView is false)
· Your object is actually not visible (GoObject.Visible is false)
· Your object has a zero (or very small) width or height (GoObject.Size is too small)
· Your object is a GoShape with no Pen or Brush, or the Pen’s or Brush’s color is transparent or very close to the background color
· Your object is positioned off-screen (GoObject.Position is not where you expected, or your view is scrolled somewhere else)
· Your object is hidden behind other objects
· The view’s scale (GoView.DocScale) causes all objects to appear very small or causes some objects not to be drawn (the scale is less than GoView.PaintNothingScale)
· Some exception is occurring, preventing your object from getting a chance to be painted (look at the Trace output for any messages)
· If an image is not appearing when the object is pasted from the clipboard, but is visible when created and when drag-drop-copied, then the cause is a lack of knowledge about where to retrieve the Image. You need to set GoImage.ImageList or GoImage.ResourceManager on the newly copied objects, because those image sources are not serialized. More convenient, when you only have a single source of images, is to set the static/shared property GoImage.DefaultImageList or GoImage.DefaultResourceManager.
I am sorry for the unclear question
If i drop objects from the Pallete to the View, the vertical scroll and horizontal scroll will scroll to show the added objects.
But when I add new objects with a location, the view won’t show the added objects.
I assigned the value the Vertical Scrollbar and Horizontal ScrollBar, the positions of the scrollbars were changed but the view wasn’t changed.
Help me to show the added objects by runtime code, not by changed scrollbars to show they
Thanks for your advance
Are you asking how to scroll a view so that you can make sure an object can be seen?
I will try.