Jump to content

Recommended Posts

Hello guys,

Yes, I finally learnt the basics of the GUI thanks to HoverGuy. Really appreciate the hours and patience he spent with me.

I have a question, though. I created a text dialogue that I would like to obviously have text in it :P

However, I want to edit that text to make it look good. The problem I am facing has I placed a big box text box, but when I write anything in it, it comes in the middle left of the box, not from the top.

How do I have the text at the top? And is it possible to have the text formatted like first line of text would be in the middle top with Big Red text and what comes after would be small text?

 

Here is how I made my textbox if you are wondering..

class RscText_1000: RscText
        {
            idc = 1000;
            colorBackground[] = {1,1,1,1};
            colorText[] = {1,0,0,1};
            text = "Hello";
            x = 0.5 * GUI_GRID_W + GUI_GRID_X;
            y = 5 * GUI_GRID_H + GUI_GRID_Y;
            w = 39 * GUI_GRID_W;
            h = 19.5 * GUI_GRID_H;
        };

 

Share this post


Link to post
Share on other sites

If you want to change the position where the text is rendered, you need to use the 'style' property:
 

// basic styles, generated through gui editor

#define ST_POS            0x0F
#define ST_HPOS           0x03
#define ST_VPOS           0x0C
#define ST_LEFT           0x00 // Left aligned text
#define ST_RIGHT          0x01 // Right aligned text
#define ST_CENTER         0x02 // Center aligned text
#define ST_DOWN           0x04
#define ST_UP             0x08
#define ST_VCENTER        0x0C

#define ST_TYPE           0xF0
#define ST_SINGLE         0x00 // Single line textbox
#define ST_MULTI          0x10 // Multi-line textbox (text will wrap, and newline character can be used). There is no scrollbar, but mouse wheel/arrows can scroll it. Control will be outlined with a line (color = text color).
#define ST_TITLE_BAR      0x20 // Light gray background with 3D border
#define ST_PICTURE        0x30 // 'Text' property is interpreted as an image path.

class myText
{
	style = ST_LEFT + ST_MULTI;	// Text overflow will go to a new line
};

class myCenterAlignedText
{
	style = ST_CENTER + ST_MULTI;
};

class myCenterBottomText
{
	style = ST_DOWN + ST_MULTI;
};

class myCenterTopText
{
	style = ST_UP + ST_MULTI;
};

The above code only shows the property you need to change - you still need to have the other properties set up in your text class for it to render properly.

 

If you want to be able to format individual lines inside of a single text field, then you need to use a structured text class, not a text class:

class ignStructuredText : ignBase
{
	type = CT_STRUCTURED_TEXT;
	style = ST_UP + ST_MULTI;		
	size = 1;						
};

 

afterwards in the .sqf for your dialog, you can format the text as html and use parseText:

https://community.bistudio.com/wiki/parseText

 

^ this link above explains how you can change color, font size, etc using structured text.

Share this post


Link to post
Share on other sites
2 hours ago, igneous01 said:

If you want to change the position where the text is rendered, you need to use the 'style' property:
 


// basic styles, generated through gui editor

#define ST_POS            0x0F
#define ST_HPOS           0x03
#define ST_VPOS           0x0C
#define ST_LEFT           0x00 // Left aligned text
#define ST_RIGHT          0x01 // Right aligned text
#define ST_CENTER         0x02 // Center aligned text
#define ST_DOWN           0x04
#define ST_UP             0x08
#define ST_VCENTER        0x0C

#define ST_TYPE           0xF0
#define ST_SINGLE         0x00 // Single line textbox
#define ST_MULTI          0x10 // Multi-line textbox (text will wrap, and newline character can be used). There is no scrollbar, but mouse wheel/arrows can scroll it. Control will be outlined with a line (color = text color).
#define ST_TITLE_BAR      0x20 // Light gray background with 3D border
#define ST_PICTURE        0x30 // 'Text' property is interpreted as an image path.

class myText
{
	style = ST_LEFT + ST_MULTI;	// Text overflow will go to a new line
};

class myCenterAlignedText
{
	style = ST_CENTER + ST_MULTI;
};

class myCenterBottomText
{
	style = ST_DOWN + ST_MULTI;
};

class myCenterTopText
{
	style = ST_UP + ST_MULTI;
};

The above code only shows the property you need to change - you still need to have the other properties set up in your text class for it to render properly.

 

If you want to be able to format individual lines inside of a single text field, then you need to use a structured text class, not a text class:


class ignStructuredText : ignBase
{
	type = CT_STRUCTURED_TEXT;
	style = ST_UP + ST_MULTI;		
	size = 1;						
};

 

afterwards in the .sqf for your dialog, you can format the text as html and use parseText:

https://community.bistudio.com/wiki/parseText

 

^ this link above explains how you can change color, font size, etc using structured text.

 

Thank you. Will try that out and will report back

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×