in c#I'm creating a mod that sets the time with a slider in c#, but the slider doesn't work. After setting the time, closing the setting panel and opening it again, for some reason the slider moves to the right end. Is there any way to fix this phenomenon?
various numbers I tried resetting the numbers, but it didn't work.
Related
In the image above the Back button was in the corner of the screen and the right arrow was near the end of the canvas. I left my computer for like 30 mins and I come back to it like this, I've tried fixing it but if I scale the canvas it still isn't right and id have to adjust all the UI I have done. Is there a way to reset the canvas to normal or some kind of fix? I don't have time to rescale all my UI so it would be nice to know, thanks.
Make sure the Canvas is set to "Scale with screen size" and that the "Back" button is pivoted ( go to pivot -> upper right corner and use ALT and then SHIFT to make sure it's pivoted ).
Other than this, if it was your cat just "Ctrl+Z" your way out or revert to a slighty older version if you are using version control.
For some reason unity re-scaled itself and now everything is (mostly) back to normal, I have no idea how this happened and how it fixed itself (I hadn't touched the project since this post until now (about a day later) and it was fixed)
So I tried building my game, but I saw that the objects that were set on a panel didnt keep their position. If I click on max window size then the objects move away from their original position. How can I solve this? (see images for extra info)
You should set ui elements' anchor position
For example my Restart button is in top-left place. When screen size change, it doesn't change position. To do this, click your ui object, click anhcor-presets section, press alt key and select a position which you want.
Also, Canvas scale may help you for resizing ui objects,when you change screen size
Here is the problem. If you dynamically place controls in a panel, it works fine, but only until the vertical scrollbar appears. Once there is enough content for this to happen, it starts positioning controls nonsensically.
In my window, you can click a button to add another row of controls inside the panel, which represent options for an item in a list. If you scroll the vertical scrollbar on the panel all the way down and click the button again, the new row of controls will be positioned below the bottom edge of the panel out of view. If you scroll down, there is a huge gap between the new row and the previous row of controls. This should not happen. The positioning code is working flawlessly, as proven by debug output. As far as I can tell, the problem is the stupid anchoring system, however disabling anchoring on these controls does not fix the problem as one might expect. Instead, it just makes it position them wrong in a different manner. This makes no sense at all, and is super annoying!
I tried disabling Autoscroll in code before controls are added to the panel. No change. So I modified that code to disable both the vertical scroll bar and Autoscroll and set the scrollbar to not visible before controls are added. No change again, except that the now disabled vertical scrollbar still manages to appear usable when there is enough content in the panel in spite of it being disabled and set not visible!? That's not supposed to happen when I disabled and made it invisible! With anchoring disabled on the controls being added to the panel and once the vertical scrollbar has appeared, clicking the button to add a few more rows of controls now causes them to be indented a bit for no reason and positioned overlapping each other a bit vertically! It's as if the coordinate system in the panel has somehow arbitrarily changed, because of the presence of a vertical scrollbar and anchoring being disabled on the controls? The debug code shows that the controls are all being placed at correct coordinates, yet they appear positioned very wrongly. So my code is working perfectly, and therefore something else is the problem here.
Everything behaves exactly as expected up until the vertical scrollbar appears. This is so bizarre. Does anyone have any idea what on earth is going on with this stuff? Apparently it is far easier to make it do stupid stuff than to get it working properly.
Thanks again! I got it working. I went with TaW's solution first since it seemed like the simplest solution. Incidentally, I already tried TaW's approach days ago when I was fighting with it, but I had naturally subtracted the AutoScrollPosition value rather than add it, because I didn't expect it to be a negative value!
It seems very odd that control positioning is relative to the current AutoScrollPosition, as absolute coordinates seems like a much more natural, intuitive approach than having negative numbers. I guess that would make it slightly harder to place a control in the currently visible area, but I suppose that's not a big deal as most scrollable interfaces are probably initialized ahead of time and don't need to do that anyway.
Whenever I write line to TextBox that is wider than width of textbox the scrollbar moves with appended text. The problem is I want to have scrollbar maximally moved to the left (at the beginning of the line). Can be moved at the end of writing or just fixed and then moved manually by scrollbar.
My question can be duplicate, because I don't even know how to name this issue.
Maybe screenshots can easier introduce my problem. On the left there is a position of a text in TextBox automatically moved and on the right side is position of thet text in TextBox manually moved by me with scrollbar.
I use FastColoredTextBox in my project and I just found method my_text_box.ScrollLeft(); and works fine. Whenever text appends on textbox it moves to the left, no flickering etc.
I don't like the default ToolTip behavior. First, I don't like that, after tooltip is shown for "AutoPopDelay" miliseconds, it disappears and don't appear anymore if you move the mouse over the control again. Second, I don't like that AutoPopDelay is limited to 5000 miliseconds.
I found one way to make tooltip always reappear on mouse move over control, even if it was shown for a time exceeding AutoPopDelay value: I call toolTip.Hide() in MouseLeave handler. This way tooltip will appear again on mouse over.
But I haven't found a simple way to make tooltip stay shown for longer time (longer than maximum 5000 miliseconds). If I call toolTip.Show() in MouseEnter handler, then toolTip is shown in not good position. I like the position in which it shows automatically :)
So, what can you suggest?
Use the Show method to control the length of time (it is not limited to 5000ms).
There is a signature for Show that does not require that you set the relative coordinates and there is one that will take the coordinates if you want to fine-tune things. In your case you will need to pass coordinates (if you don't like what it automatically gives you). I do not believe there to be an alternative...