Closed DCowboy closed 2 months ago
These are bit flags, so you need to use the s.Font.SetDecoration()
method to properly set the flags. We will update the docs to include an example of this.
Thank you for explaining how to go about that the right way. Are there any other settings that differ from the primary examples in the docs? It might be beneficial to make notes on any variations from the prime examples given earlier in the docs. It certainly would for me it seems. In this case, I followed the s.Font.Weight = styles.WeightBold example on the Styling page as there was no indication it should be done any other way.
I'm pretty sure this is the only exceptional case, so we definitely need to highlight that! thanks for the report.
We will definitely improve the documentation for that now. FYI, this is the wrong repository; cogent
has the Cogent apps (Cogent Code, Cogent Canvas, etc), but core
has the main framework, so I will transfer this issue there.
Sorry, I was looking for other examples and apparently got lost in the mess of browser tabs I've created. In the cogent repo, I was looking to see if you had projects that could show an example of movement for widgets as I am unsure if I should put forward a feature request about it on core. Particularly if you had something that used movement that I hadn't seen. I still haven't even finished looking yet as I keep getting interrupted, then sidetracked and end up bouncing back and forth.
I apologize for any trouble I may have created as a result.
No worries! If you could clarify what kind of movement of widgets you are looking for, that would be great. Thank you!
In #1185, I updated the API docs for Decoration
to clarify that you need to use SetDecoration
, and I added code that sets the font decoration in the styling example on the text website page.
After you clarify your widget movement question, if it is not something we currently support, you can file a separate feature request issue for it.
No worries! If you could clarify what kind of movement of widgets you are looking for, that would be great. Thank you!
This was closed while I was typing a longer winded clarification, so I shortened it to below.
Short clarification: The ability to use and modify a widget's bounding box (x, y, w, h) within a frame, but obviously without rendering any parts past the frame's bounding box, For instance telling a button, (or several of them,) to shift to the left N units because another function set the buttons' new position(s) and called the frame's update function.
You can use s.Min
to control the widget size. For fine-grained position control, you can use s.Pos
if you set s.Display
on the parent to styles.NoLayout
. You could also try s.Margin
on the button(s), s.Padding
on the parent, or making Space
elements and setting s.Min
on them. You could also write your own layout function if you really need a lot of control. Which of these approaches makes the most sense depends on the details of your use case.
Regardless, the way that everything is structured is through styler closures, so you wouldn't imperatively call a function to make a button "move" per se, but you would write a styler that changes how much spacing there is based on some other variable that you would update and then call Update()
on the parent.
I think it probably makes sense for you to file a new issue with more information about your specific use case and I can help you decide which approach makes the most sense and how to implement it. (Edit: see #1186)
Describe the bug
Text decorations don't display their correct styles.descriptor. I first noticed it trying to create a conditional style, so I verified in playground to make sure it wasn't just me, or my editor interfering somehow. I'll paste what I gathered in Example code. I left each one as typed and added a comment result at the end.
How to reproduce
1) Create a new Text widget. 2) Call Styler on next line. 3) make decoration statement as seen below.
Example code
Relevant output
No response
Platform
Linux