Comments (5)
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.
from spacevil.
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.
from spacevil.
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?
from spacevil.
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:
- SizePolicy (Fixed, Expand)
- ItemAlignment (Left, Right, Top, Bottom, HCenter, VCenter)
- Container Padding
- Item Margin
- Item Size (size, max size, min size)
In that markup system, methods like SetX(), SetY() do not work (work only in FreeArea, IFloatingItem and any others that implement IFreeLayout or IHLayout, IVLayout).
And if you even set a desired ItemAlignment properties you still see that the Label stays in the same place. It because of default Label style that has SizePolicy property is set to Expand.
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);
}
}
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);
}
}
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);
}
}
So what are the conclusions?
- Common markup system is very useful.
- I really need to provide all the default styles of items via some sort of documentation...
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 [email protected]
from spacevil.
Thank you very much for the detailed answer! The picture is becoming more clear now. :)
from spacevil.
Related Issues (12)
- Source code of framework HOT 1
- System.AccessViolationException: Attempted to read or write protected memory. HOT 17
- Window doesn`t show, app fail with code -1073741819
- ButtonToggle_0 MouseRelease System.NullReferenceException: Object reference not set to an instance of an object.
- ComboBox example for C# HOT 31
- Impossible to run any example HOT 3
- Unable to find an entry point named 'glfwGetMonitorContentScale' in shared library 'glfw' HOT 7
- TextEdit.SetFontSize() not setting font size HOT 2
- How to track mouse release? HOT 10
- Table View HOT 2
- Is there a show and wait window function in the framework? HOT 9
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from spacevil.