Closed spektro37 closed 4 years ago
Yeah, the documentation is out of date. Sorry. We are working on it. I will notice you here when it is done. PS. I understand that this can be inconvenient, but if you have questions, I will be happy to answer you. I will try to update the documentation as soon as possible.
I tried to show how to do a most things in examples that are provided by this repository, but of course that examples (demo apps, tutorials, simple examples) does not cover all frameworks features.
Thank you for your quick response and agreeing to answer questions I might have.
I have to admit that I didn't look through all the examples you have provided, so maybe answers to some of my questions are already there, but it requires significant amount time to analyse and digest these examples and flesh out examples of using separate elements and their properties. For example, I know exactly what I want to build and I am interested in how I can position a Label element in the main window or do certain things with other elements. Using SetX() and SetY() did not have the expected effect and then I had to go into some of the examples looking for any information about positioning elements.
I have read your article on Habr and I agree that having a fully working application as an example is good for understanding how the framework works in the real world. However, I feel that documentation also needs to have comprehensive description of the element, it's properties, public methods (not only list them, though I admit that their names are very descriptive) and a couple of examples of how it can be used with only necessary context. Having this would make the learning curve less steep.
I don't want to look to picky, sorry if this is the case. :) At the moment I can say that I like SpaceVIL and I simply want it to be easier to learn and use.
If I will have questions, should I ask them by creating a separate issue per question here?
Yes, I agree that need a solid documentation for framework. And about your question of positioning elements... hmmm... Using SetX () and SetY () will definitely not give the expected effect because of SpaceVIL markup system and default Label style. Common markup system works with the following properties:
Examples:
public class MyWindow : ActiveWindow
{
// implement ActiveWindow class
public override void InitWindow()
{
// window parameters
SetParameters("MyWindow", "MyWindow", 300, 300);
Label label = new Label("Hello World!");
label.SetAlignment(ItemAlignment.Bottom, ItemAlignment.Right);
AddItem(label);
}
}
You get the result:
That happens because of Label SizePolicy property by default is set to Expand. To make sure we can change the background color of label:
public class MyWindow : ActiveWindow
{
// implement ActiveWindow class
public override void InitWindow()
{
// window parameters
SetParameters("MyWindow", "MyWindow", 300, 300);
Label label = new Label("Hello World!");
label.SetAlignment(ItemAlignment.Bottom, ItemAlignment.Right);
label.SetBackground(Color.Chocolate); // bg color
AddItem(label);
}
}
Result:
But we can change SizePolicy property to Fixed:
public class MyWindow : ActiveWindow
{
// implement ActiveWindow class
public override void InitWindow()
{
// window parameters
SetParameters("MyWindow", "MyWindow", 300, 300);
Label label = new Label("Hello World!");
label.SetAlignment(ItemAlignment.Bottom, ItemAlignment.Right);
label.SetBackground(Color.Chocolate); // bg color
// change SizePolicy
label.SetSizePolicy(SizePolicy.Fixed, SizePolicy.Fixed);
label.SetSize(label.GetTextWidth() + 30, 60);
AddItem(label);
}
}
Result:
And the last thing (optionally). Label can change position of text via method SetTextAlignment():
public class MyWindow : ActiveWindow
{
// implement ActiveWindow class
public override void InitWindow()
{
// window parameters
SetParameters("MyWindow", "MyWindow", 300, 300);
Label label = new Label("Hello World!");
label.SetAlignment(ItemAlignment.Bottom, ItemAlignment.Right);
label.SetBackground(Color.Chocolate); // bg color
// change SizePolicy
label.SetSizePolicy(SizePolicy.Fixed, SizePolicy.Fixed);
label.SetSize(label.GetTextWidth() + 30, 60);
// change text alignment
label.SetTextAlignment(ItemAlignment.Bottom, ItemAlignment.Right);
AddItem(label);
}
}
Result:
So what are the conclusions?
Thanks for letting me know about my mistakes!
PS. "If I will have questions, should I ask them by creating a separate issue per question here?" If you think that it will be useful question that can help others peoples then you can create a new issue. If you need to report about bugs or common suggestions then you can write a email to feedback@spvessel.com
Thank you very much for the detailed answer! The picture is becoming more clear now. :)
I have found that documentation located at https://spvessel.com/spacevil/docs/csharp/html/class_space_v_i_l_1_1_core_window.html seems to be out of date. At least it doesn't mention CoreWindow.ToggleFullScreen() anywhere.