Home   Help Search Login Register  

Author Topic: How to display a dialog the way I need  (Read 2260 times)

0 Members and 1 Guest are viewing this topic.

klavan

  • Guest
How to display a dialog the way I need
« on: 02 Nov 2005, 20:57:26 »
Code: [Select]
class RscTextD
{
        type = CT_STATIC;
        idc = -1;
        style = ST_LEFT;
        colorBackground[] = {0, 0, 0, 0};
        colorText[] = {1, 1, 1, 1};
        font = FontS;
        sizeEx = 0.04;
};

class RscButtonD
{
        type = CT_BUTTON;
        idc = -1;
        style = ST_CENTER;
        colorText[] = {0, 0, 1, 1};
        font = FontHTML;
        sizeEx = 0.025;
        soundPush[] = {, 0.2, 1};
        soundClick[] = {"ui\ui_ok", 0.2, 1};
        soundEscape[] = {"ui\ui_cc", 0.2, 1};
        default = false;
};


class Info1
{
  idd = -1;
  movingEnable = true;
  controlsBackground[] = {BACKGROUND,FRAME};
  objects[] = { };
  controls[] = {EXIT,TEXT};
class BACKGROUND : RscTextD
  {
     colorBackground[] = {0, 0, 0, 1};
     text = ;
     x = 0.1;
     y = 0.1;
     w = 0.8;
     h = 0.8;
  };
class FRAME : RscTextD
  {
     idc = 100;
     style = ST_FRAME;
     colorText[] = {1, 1, 1, 1};
     text = "Info Sheet 1";
     sizeEx = 0.02;
     x = 0.108;
     y = 0.105;
     w = 0.78;
     h = 0.78;
  };
class EXIT : RscButtonD
  {
          idc = 101;
          x = 0.43;
          y = 0.84;
          w = 0.17;
          h = 0.037;
          text = "Exit";
          action = "closedialog 0";
  };
class TEXT : RscTextD
  {
      style="0.5";
           lineSpacing=0.5;
           text=$STRN_In1;
           x=0.14;
           y=0.05;
           w=0.7;
           h=0.7;
           colorText[]={1,1,1,1};
           font="tahomaB36";
           size=0.8;
};


This dialog works, but my problem is that I can't display the text ($STRN_In1 defined in the .csv) the way I want, because:
-1 My attempts in moving upside the box that contains the text always fails (if i'm not wrong it should be defined by the y value in the class TEXT resource).
-2 When displayed, even by using the "\n" command to start a new line, the text is not interrupted.
Example
"TESTLINE\nTESTLINE"
instead of
"TESTLINE
TESTLINE"

I've checked some dialogs made by others missionmakers but I can't find a solution and that's why I ask for your help.
Thanks in advance
Klavan

Offline Planck

  • Honoured
  • Former Staff
  • ****
  • I'm never wrong ....I'm just not always right !
Re:How to display a dialog the way I need
« Reply #1 on: 02 Nov 2005, 21:27:20 »
The x and y values define the top left corner of the box.

The w and h values define the width and height of the box.


Planck
I know a little about a lot, and a lot about a little.

klavan

  • Guest
Re:How to display a dialog the way I need
« Reply #2 on: 02 Nov 2005, 21:38:31 »
@Planck
I was already quite sure of that, but even decreasing the y value the text appears always in the same position,  about in the middle of the screen.
Klavan

Offline Planck

  • Honoured
  • Former Staff
  • ****
  • I'm never wrong ....I'm just not always right !
Re:How to display a dialog the way I need
« Reply #3 on: 02 Nov 2005, 21:49:33 »
Have you tried:

x=0
y=0

I think this should start the text box at the top left of the screen.........maybe   ::)


Planck
I know a little about a lot, and a lot about a little.

klavan

  • Guest
Re:How to display a dialog the way I need
« Reply #4 on: 02 Nov 2005, 22:02:24 »
That damned dialog is kidding me!

By decreasing both x and y to 0.0 the text is moved on the left of the screen but remains in the middle!
Uffffhhh.....
Klavan

Offline Planck

  • Honoured
  • Former Staff
  • ****
  • I'm never wrong ....I'm just not always right !
Re:How to display a dialog the way I need
« Reply #5 on: 02 Nov 2005, 22:05:36 »
OK.........what you need to do I think is reduce h.

h=0.04

try that.   ;D

These values are percentage of screen.

1 would be full height for h

Edit:  I just noticed your:

style= "0.5"

I have never seen this style.

Try:   style= 2;



Planck
« Last Edit: 02 Nov 2005, 22:16:17 by Planck »
I know a little about a lot, and a lot about a little.

Offline Planck

  • Honoured
  • Former Staff
  • ****
  • I'm never wrong ....I'm just not always right !
Re:How to display a dialog the way I need
« Reply #6 on: 02 Nov 2005, 22:21:58 »
Here is a list of style types I have:

Code: [Select]
#define ST_HPOS            0x0F
#define ST_LEFT            0
#define ST_RIGHT         1
#define ST_CENTER         2
#define ST_UP            3
#define ST_DOWN            4
#define ST_VCENTER         5

#define ST_TYPE            0xF0
#define ST_SINGLE         0
#define ST_MULTI         16
#define ST_TITLE_BAR         32
#define ST_PICTURE         48
#define ST_FRAME         64
#define ST_BACKGROUND         80
#define ST_GROUP_BOX         96
#define ST_GROUP_BOX2         112
#define ST_HUD_BACKGROUND      128
#define ST_TILE_PICTURE         144
#define ST_WITH_RECT         160
#define ST_LINE            176

#define ST_SHADOW         256
#define ST_NO_RECT         512

#define ST_TITLE         ST_TITLE_BAR + ST_CENTER


Planck
I know a little about a lot, and a lot about a little.

klavan

  • Guest
Re:How to display a dialog the way I need
« Reply #7 on: 02 Nov 2005, 22:40:35 »
Ok thank you Planck, now the text is moved where I need.
Now I've to solve the second problem. I've attached an image to better explaining what I mean with the "\n" problem.
klavan

PS
I'm takin' in consideration the opportunity to replace the dialog with an hintc if I will not able to solve this problem quickly......
« Last Edit: 02 Nov 2005, 22:44:27 by klavan »

Offline Planck

  • Honoured
  • Former Staff
  • ****
  • I'm never wrong ....I'm just not always right !
Re:How to display a dialog the way I need
« Reply #8 on: 02 Nov 2005, 22:44:03 »
I'm not even sure you can do this, I've never tried.

Is it '\n' or is it '/n'.......I can never remember.


Planck
I know a little about a lot, and a lot about a little.

klavan

  • Guest
Re:How to display a dialog the way I need
« Reply #9 on: 02 Nov 2005, 22:48:05 »
By taking a look at some other dialogs I've found that \n (this is the right  sintax) works........Maybe it's only a matter of style.
I will try something else.....
Klavan

Offline Planck

  • Honoured
  • Former Staff
  • ****
  • I'm never wrong ....I'm just not always right !
Re:How to display a dialog the way I need
« Reply #10 on: 02 Nov 2005, 22:51:24 »
Yes.....Experiment with the styles.

ST_MULTI         16

Maybe.........I'm not sure.


Planck
I know a little about a lot, and a lot about a little.

Offline Igor Drukov

  • Contributing Member
  • **
  • Conscientious Subjector
Re:How to display a dialog the way I need
« Reply #11 on: 02 Nov 2005, 23:27:03 »
You can't use the "\n" command in dialogs, even if you call a  script and change the text of a given idc using ctrlSetText.

(example) :

Code: [Select]
call format ["ctrlsettext [120,""%1's Stick Status : (%2 active)""]",name player,count units group player]
The following code does NOT work :

Code: [Select]
call format ["ctrlsettext [120,""%1's Stick Status : \n(%2 active)""]",name player,count units group player]

So what you have to do is define another class, with another idc (better), laid out lower in the screen  :).




klavan

  • Guest
Re:How to display a dialog the way I need
« Reply #12 on: 02 Nov 2005, 23:34:04 »
@Igor
Do you mean that if i want to put in the dialog a text that looks somewhat like the following:

Today is a bad day
I hope that tomorrow will be better
But can't believe it will be so

I need to create three different text boxes to display it?
In this case I will switch to the hintc immediately.......

Klavan

Offline Igor Drukov

  • Contributing Member
  • **
  • Conscientious Subjector
Re:How to display a dialog the way I need
« Reply #13 on: 03 Nov 2005, 00:28:24 »
Yes, you'd need to create three different RSCs.

But then, don't switch off to hintC yet !! Dialogs are so powerful, and I so much wish they were more used by the community... :-[

klavan

  • Guest
Re:How to display a dialog the way I need
« Reply #14 on: 03 Nov 2005, 00:44:40 »
@Igor
Well, after all I'm forced to continue with the dialog: the hintc simply can't contains enough text for my pourpouse........
Tomorrow will be a long editing day.
Thank you for your help.
Goodnight.
Klavan