Topic: UI questions
kaputtnik Topic Opener |
Posted at: 2024-01-15, 19:19
Probably a topic gathering UI-related questions regarding the new ui widgets available in version 1.2 In the screenshot below the windows have a layout of one horizontal box containing two vertical boxes (2 columns). The 'left' box has a textarea as child, the 'right' one has a mutlilinetextarea as child. Each vertical box should have a width of 200 pixels. For comparison a screen ruler showing pixels is also in this screenshot. Fighting with width's
Why need the textarea an extra property The Problem for me is that i build such a menu part by part: 1. create the boxes with one child for each, probably i want to show a header for each column so i put textareas in each column box and test this. The result is not what i want (the width's are not applied), because i didn't remember the Just wanted to write from a users perspective and hopefully my confusion is understandable. Multilinetextarea and richtextThe textarea in the left column uses
I know i can do something like `rt(p(_("Enter coordinates, e.g.: 20,23"))) for the text, but then the font is totally different.
Probably i didn't understand this, because if i try to use something like So i am a bit lost here, maybe too dumb to understand all these things. And a bit frustrated. On the other side i think the new UI stuff is just new, and the documentation only lacks some important information for beginners. Nevertheless this is a great enhancement to the game and i am glad to have it Top Quote |
Nordfriese |
Posted at: 2024-01-15, 19:58
Single line textareasThey can be either layouted or fixed. In layouted mode, the default width is always equal to the text width, and your custom width is ignored completely. If you specify a The SpinboxHow regular width and This widget is an absolute nightmare to layout properly. Play around with many combinations of Multiline textarea and richtextIf you use any richtext markup (the The ML text area's style only applies if you don't use any richtext markup at all. If you use Examples:
However, by comparing your examples (which actually should work but here don't) with my own sample code (which does work), I noticed that in the current state of the branch the style was only applied if the text was afterwards set via Edited: 2024-01-15, 19:59
Top Quote |
matthiakl |
Posted at: 2024-01-15, 20:59
SpinboxA spinbox consists of two components: a label and the "unit" which is the button group and the value indicator in between. So the If we name the width of the label (In C++ there are even more widths to add to the confusion ;): width, desired_width, max_width) Top Quote |
kaputtnik Topic Opener |
Posted at: 2024-01-16, 11:49
Ok, thank you very much! SpinboxFunnily i have no problems so far with this widget, except the label. But this can be circumvented by applying just no label and make an extra textarea widget which act as a label. Multilinetextarea and richtextThe explanation of Nordfriese was exactly how i understood this. So my issue was just a bug, leading to confusion. Thanks for fixing! Another thing i am fighting with: Fighting with width's, aka positioning of widgetsNormally all widgets should be shown centered. But in a two columns layout this doesn't work if one widget's width is smaller than the wanted columns width. In the screenshot the row with the editbox (value 10,25) consist of a multilinetextarea (column1, width 200) and an editbox (column2, width 200) both wrapped in an horizontal box. All fine here. But for my taste the editbox is too wide. The row below of this consists also of multilientextarea (column1, width 200) but the editbox has a width of 100. As a result the sum of both widgets width's is used for centering the whole row. Now my idea was to put the multilientextarea and the editbox each in it's own box with orientation vertical and give the boxes the wanted width of 200 to make them shown centered. But the result is the same. The only solution i found is to add some space widgets around the edit box, so that the overall width of column2 is 200 (space 50 + widget width 100 + space 50). Is there another way to have widgets centered in a two columns layout? Top Quote |
Nordfriese |
Posted at: 2024-01-16, 12:26
I am not sure what exactly you want to accomplish. A mockup annotating the desired dimensions of all widgets and the spacing between them would be helpful. If I understand correctly, you want the right column entry to consist of a fixed-width editbox with empty padding of 50px each to the left and right, in which case two space widgets would indeed be the correct way to go. Giving a box a nominal width may or may not have a visible effect if the box itself is layouted by a parent box, since the box will calculate its desired size based on its content and the parent box will resize the child box based on that. Thus, a box with only one element is nearly always useless. P.S. The text in your example has some ugly linebreaks, consider using Edited: 2024-01-16, 12:27
Top Quote |
kaputtnik Topic Opener |
Posted at: 2024-01-16, 17:46
Yes, that's the answer i want to hear.
Yes, the next thing i want to fix, thanks for the hint! Top Quote |
kaputtnik Topic Opener |
Posted at: 2024-01-16, 18:21
Don't know if this a bug or normal: This does only work if i wrap the text within richtext, eg. Top Quote |
Nordfriese |
Posted at: 2024-01-16, 18:39
That's normal. As I said above, without an Btw, the website is having a bit of trouble with even when put in markdown code styling Top Quote |
kaputtnik Topic Opener |
Posted at: 2024-01-20, 12:54
Another question: I want to stop code execution and want to show a window with an Ok and a Cancel button. Pseudo code:
Does the variable 'fields' needs to be global in such a case? Or is there another solution? Top Quote |
Nordfriese |
Posted at: 2024-01-20, 15:09
If you have single-threaded execution you might want to use
If you don't want to use
Top Quote |