Hi there! You are currently browsing as a guest. Why not create an account? Then you get less ads, can thank creators, post feedback, keep a list of your favourites, and more!
Quick Reply
Search this Thread
Test Subject
Original Poster
#1 Old 7th Feb 2023 at 1:38 PM
Help with LAYO files for relocating some UI elements
I've read about how you can change the placement of UI using the LAYO files, but I've never found details on how that's exactly done or where to get started as well as where to find specific code for the UI elements I need to change in the files, any guide or help would be appreciated!
Advertisement
Virtual gardener
staff: administrator
#2 Old 12th Feb 2023 at 12:57 PM
Often, The LAYO files will have the same name of the C# class they're using. So with ILSpy, you can often trace down the class for it.

However, when we're talking about editing the UI... depending on what you want to change, it can be quite a pain. I always just “clone” (duplicate the file) that is the closest to the UI that I want, edit maybe the padding/colours or even through code, the functionality of said buttons.

Not quite sure if this helps But at least gets you on the right path!
Test Subject
Original Poster
#3 Old 13th Feb 2023 at 4:16 PM
Quote: Originally posted by Lyralei
Often, The LAYO files will have the same name of the C# class they're using. So with ILSpy, you can often trace down the class for it.

However, when we're talking about editing the UI... depending on what you want to change, it can be quite a pain. I always just “clone” (duplicate the file) that is the closest to the UI that I want, edit maybe the padding/colours or even through code, the functionality of said buttons.

Not quite sure if this helps But at least gets you on the right path!


Thank you for the response! I'm a complete noob when it comes to coding. but for example, if I want to move the wishes in the Simhud up or down or sideway, what exactly do I need to do and how do I know what values will get it there? when I opened the LAYO file for simhud it was a very long repeat of what looks like the same random codes, nothing that stood out to me as a position value on a screen.

cls="Window" clsid="0x4ec1b8d8">
<prop name="WindowFlags" propid="0xeec1b000" type="uint32" value="0x00002013"/>
<prop name="ControlID" propid="0xeec1b001" type="uint32" value="0x06f5b822"/>
<prop name="CommandID" propid="0xeec1b002" type="uint32" value="0"/>
<prop name="Area" propid="0xeec1b005" type="rectf" value="445,-35,560,15"/>
<prop name="FillColor" propid="0xeec1b006" type="uint32" value="0x00000000"/>
<prop name="ShadeColor" propid="0xeec1b004" type="uint32" value="0xffffffff"/>
<prop name="TextFont" propid="0xeec1b00e" type="uint32" value="0"/>
<prop name="SoundGroup" propid="0xeec1b010" type="uint32" value="1"/>
<prop name="Comment" propid="Comment" type="string" value="Moodlet tooltip anchor win"/>
Space Pony
#4 Old 13th Feb 2023 at 9:53 PM
Quote: Originally posted by SimsLabs
Thank you for the response! I'm a complete noob when it comes to coding. but for example, if I want to move the wishes in the Simhud up or down or sideway, what exactly do I need to do and how do I know what values will get it there? when I opened the LAYO file for simhud it was a very long repeat of what looks like the same random codes, nothing that stood out to me as a position value on a screen.

cls="Window" clsid="0x4ec1b8d8">
<prop name="WindowFlags" propid="0xeec1b000" type="uint32" value="0x00002013"/>
<prop name="ControlID" propid="0xeec1b001" type="uint32" value="0x06f5b822"/>
<prop name="CommandID" propid="0xeec1b002" type="uint32" value="0"/>
<prop name="Area" propid="0xeec1b005" type="rectf" value="445,-35,560,15"/>
<prop name="FillColor" propid="0xeec1b006" type="uint32" value="0x00000000"/>
<prop name="ShadeColor" propid="0xeec1b004" type="uint32" value="0xffffffff"/>
<prop name="TextFont" propid="0xeec1b00e" type="uint32" value="0"/>
<prop name="SoundGroup" propid="0xeec1b010" type="uint32" value="1"/>
<prop name="Comment" propid="Comment" type="string" value="Moodlet tooltip anchor win"/>


If you want to change the position of an element, the key property you're looking for here is "Area":

Code:
<prop name="Area" propid="0xeec1b005" type="rectf" value="445,-35,560,15"/>


The first two numbers are the x and y coordinates of the top left corner relative to the parent window, and the second two numbers are the coordinates of the bottom right corner. To move an element up or down, you'd want to shift the 2nd and 4th numbers up or down by an equal value, and likewise with the 1st and 3rd numbers if you want to move it left or right.

Note that the y coordinate values are sort of in reverse of what you might have learned in school: the higher the value, the lower on the screen the position will be.

As for knowing which element you want to move, that can be a bit challenging. Sometimes the "Comment" property will tell you what it does so you can pretty easily find what you're looking for. Otherwise, you might be able to search for usage of the value of the "ControlID" property in ILSpy to infer where and how it's being used in the script.

"The Internet is the first thing that humanity has built that humanity doesn't understand, the largest experiment in anarchy that we have ever had." - Eric Schmidt

If you enjoy the mods I put out, consider supporting me on patreon: www.patreon.com/Gamefreak130
Test Subject
Original Poster
#5 Old 13th Feb 2023 at 11:33 PM
Quote: Originally posted by gamefreak130
If you want to change the position of an element, the key property you're looking for here is "Area":

Code:
<prop name="Area" propid="0xeec1b005" type="rectf" value="445,-35,560,15"/>


The first two numbers are the x and y coordinates of the top left corner relative to the parent window, and the second two numbers are the coordinates of the bottom right corner. To move an element up or down, you'd want to shift the 2nd and 4th numbers up or down by an equal value, and likewise with the 1st and 3rd numbers if you want to move it left or right.

Note that the y coordinate values are sort of in reverse of what you might have learned in school: the higher the value, the lower on the screen the position will be.

As for knowing which element you want to move, that can be a bit challenging. Sometimes the "Comment" property will tell you what it does so you can pretty easily find what you're looking for. Otherwise, you might be able to search for usage of the value of the "ControlID" property in ILSpy to infer where and how it's being used in the script.


Thank you for the help!! I was also wondering if it's possible to rotate them or even add a completely new element to the UI doesn't have to be functional just an IMG?
Back to top