MZ Text misaligned or disappearing when changing window sizes.

I'm completely new to js and I've been making my own plugins to edit the many windows. I've mostly been using "this.x = 100" for the x, y, w and h. I've also been changing some rows and columns count. However for some windows, when I change these parameters to my desire, the text for those options either disappear, are very small, or are cut off at some point. What is the problem and what do I need to do to fix this?
Well, so going off by what you've said in your post i'm assuming you are trying to move the text by using the window's properties (x, y, width, height).

Usually you should mess around with the "drawText" or "drawTextEx" methods if you want to change how the text is drawn.

I can't tell what you mean by disappearing since you haven't posted some screenshots along with your post, basically some before and after modifications type of screenshots.

The "very small" and "cut off" text may be because there's not enough space in the window that you are drawing the text.

For example, the drawText method has a "maxWidth" parameter that it uses to determine how wide the text should be at most.
If the text's width is larger than the "maxWidth" parameter value then it will start to get squashed to fit within that defined width.

Windows also have only a certain amount of space in which you can add stuff, so if you go out of that space you won't be able to draw the entire text.
JavaScript:
Window_Base.prototype.createContents = function() {
    const width = this.contentsWidth();
    const height = this.contentsHeight();
    this.destroyContents();
    this.contents = new Bitmap(width, height);
    this.contentsBack = new Bitmap(width, height);
    this.resetFontSettings();
};
The thing i was talking about is the "contents" bitmap and the bounds are defined in "contentsWidth" and "contentsHeight".
In addition to the good advice Toby gave you, I'd ask where you are getting your magic numbers like this.x = 100?

While you can arbitrarily place stuff, it's a better idea to leverage the existing Window methods to fetch and calculate positions for UI elements.

For example, assuming you are working with Window_Selectable or any window it inherits from:

JavaScript:
Window_Whatever.prototype.drawMyText = function() {
    const index = 1; // the line of the window to draw the text
    const rect = this.itemLineRect(index); // fetch a rectangle for the text coords
    const align = 'left';
    const text = 'Whatever';
    this.drawText(text, rect.x, rect.y, rect.width, align); // rather than arbitrary numbers, use the rect's coords/width as a base
};

You can build offsets into this as needed including adjusting the x coord based on the dimensions/coords of other window elements.
Well, so going off by what you've said in your post i'm assuming you are trying to move the text by using the window's properties (x, y, width, height).

Usually you should mess around with the "drawText" or "drawTextEx" methods if you want to change how the text is drawn.

I can't tell what you mean by disappearing since you haven't posted some screenshots along with your post, basically some before and after modifications type of screenshots.

The "very small" and "cut off" text may be because there's not enough space in the window that you are drawing the text.

For example, the drawText method has a "maxWidth" parameter that it uses to determine how wide the text should be at most.
If the text's width is larger than the "maxWidth" parameter value then it will start to get squashed to fit within that defined width.

Windows also have only a certain amount of space in which you can add stuff, so if you go out of that space you won't be able to the entire text.
JavaScript:
Window_Base.prototype.createContents = function() {
    const width = this.contentsWidth();
    const height = this.contentsHeight();
    this.destroyContents();
    this.contents = new Bitmap(width, height);
    this.contentsBack = new Bitmap(width, height);
    this.resetFontSettings();
};
The thing i was talking about is the "contents" bitmap and the bounds are defined in "contentsWidth" and "contentsHeight".
For clarification, I'm trying to move the window and change its rows/cols, not moving any text in specific.
In addition to the good advice Toby gave you, I'd ask where you are getting your magic numbers like this.x = 100?

While you can arbitrarily place stuff, it's a better idea to leverage the existing Window methods to fetch and calculate positions for UI elements.

For example, assuming you are working with Window_Selectable or any window it inherits from:

JavaScript:
Window_Whatever.prototype.drawMyText = function() {
    const index = 1; // the line of the window to draw the text
    const rect = this.itemLineRect(index); // fetch a rectangle for the text coords
    const align = 'left';
    const text = 'Whatever';
    this.drawText(text, rect.x, rect.y, rect.width, align); // rather than arbitrary numbers, use the rect's coords/width as a base
};

You can build offsets into this as needed including adjusting the x coord based on the dimensions/coords of other window elements.
I'm very new to this, the only way I found that allowed me to move a window was to place this.x = x underneath a window. Is there a better way?
Since your descriptions are at odds with what you seem to be trying to do, just post some screenshots. I'm not going to speculate any further as it's a major waste of everyone's time.

Original thread: https://forums.rpgmakerweb.com/threads/text-misaligned-or-disappearing-when-changing-window-sizes.174944/