Jump to content

Pixel width for DCL dialogs


jwinkl

Recommended Posts

Hi,

 

does anyone know a way to define the width of a DCL dialog box in pixel units? The command

 

width = 200;

 

makes the dialog window not 200 pixels wide, but fills nearly the whole width of the screen (1600 pixels).

Link to comment
Share on other sites

In my experience, the following formulae provide a good approximation:

 

tw = pw/6

th = ph/13

 

Where:

 

tw / th = Tile Width / Height

pw / ph = Pixel Width / Height

 

Hence, for a 200x100 pixel tile, you would use the following:

 

width = 33.33;

height = 7.69;

fixed_width = true;

fixed_height = true;

 

Example:

test : dialog
{
   spacer;
   : image
   {
       key = "img";
       width = 33.33;
       height = 7.69;
       fixed_width = true;
       fixed_height = true;
       color = 0;
   }
   spacer;
   ok_only;
}

 

exampledialog.png

Link to comment
Share on other sites

Thanks a lot.

 

Do you or does anyone know why DCL has this behaviour, that seems to me somewhat lunatic? Dialog windows don't make any sense but on a screen, so it would be natural to use the same units as the screen does - pixels, that is.

Link to comment
Share on other sites

As stated in the Developer Documentation, DCL uses units corresponding to the height & width of characters:

 

width

 

Possible values are an integer or a real number representing the distance in character-width units.

 

...

 

Character width units are defined as the average width of all uppercase and lowercase alphabetic characters, or the screen width divided by 80, whichever is less (average width is (width(A .. Z) + width (a .. z)))/52 ).

 

height

 

Possible values are an integer or a real number representing the distance in character height units.

 

...

 

Character-height units are defined as the maximum height of screen characters (including line spacing).

 

Though, I do not know why these units were chosen.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...