PDA

View Full Version : Font Sizes in Dialog Boxes



MickCorlis
02-14-2005, 05:56 PM
I need to change the size of the font displayed in all my dialog boxes. The default of mssgreyserif8 is too small for some users. I use the text style property to select a larger font and I lose my skins.

Is there another way to increase the font size without losing the skin??

This also occurs in 10.5

RadhaK
02-15-2005, 04:46 AM
Hi,

I tried changing in "Base text style" property but it didnt affect the skin.

Another way of changing the font size is possible through script

Example

/*--------------------------------------------------------------*\
*
* InstallShield Example Script
*
* Demonstrates the GetFont and CtrlSetFont functions.
*
* This example script calls GetFont to retrieve the handles
* of four fonts. These handles are then passed to CtrlSetFont
* to set the font of the static text fields in a custom dialog
* box.
*
* The "custom" dialog box used in this script is actually the
* InstallShield dialog box that is displayed by the built-in
* function SetupType. Because this dialog box is stored in
* the file _isres.dll, which is already compressed in
* the installation, it can be used in a script as a custom
* dialog box.
*
\*--------------------------------------------------------------*/

// Dialog box and control IDs.
#define RES_DIALOG_ID 10203 // ID of the custom dialog box
#define RES_PBUT_NEXT 1 // ID of Next button
#define RES_PBUT_CANCEL 9 // ID of Cancel button
#define RES_TEXT_1 202 // ID of first static text box

#define RES_TEXT_2 210 // ID of second static text box
#define RES_TEXT_3 220 // ID of third static text box
#define RES_TEXT_4 230 // ID of fourth static text box

// Include Ifx.h for built-in InstallScript function prototypes.
#include "Ifx.h"

export prototype ExFn_CtrlSetFont(HWND);

function ExFn_CtrlSetFont(hMSI)
STRING szDialogName;
NUMBER nResult, nCmdValue;
HWND hFont1, hFont2, hFont3, hFont4;
BOOL bDone;
begin

// Get the handle of the fonts to use for the static text
// that is displayed by the custom dialog box.
hFont1 = GetFont("Arial", 14, STYLE_BOLD);
hFont2 = GetFont("Times New Roman", 11, STYLE_ITALIC);
hFont3 = GetFont("Arial", 10, STYLE_BOLD);
hFont4 = GetFont("Courier New", 9, STYLE_NORMAL);

if (hFont1 = 0 || hFont2 = 0 || hFont3 = 0 || hFont4 = 0) then
// Report an error; then terminate.
MessageBox ("Unable to get all fonts. ", SEVERE);
abort;
endif;

// Specify a name to identify the custom dialog box in this installation.
szDialogName = "CustomDialog";

// Define the dialog box. Pass a null string in the second parameter
// to get the dialog box from _isuser.dll or _isres.dll. Pass a null
// string in the third parameter because the dialog box is identified
// by its ID in the fourth parameter.

nResult = EzDefineDialog (szDialogName, "", "", RES_DIALOG_ID);

if (nResult < 0) then
// Report an error; then terminate.
MessageBox ("Error in defining dialog.", SEVERE);
abort;
endif;

// Initialize indicator used to control the while loop.
bDone = FALSE;

// Loop until done.
repeat

// Display the dialog box and return the next dialog box event.
nCmdValue = WaitOnDialog (szDialogName);

// Respond to the event.
switch (nCmdValue)
case DLG_CLOSE:
// The user clicked the window's Close button.
Do (EXIT);
case DLG_ERR:
MessageBox ("Unable to display dialog box. Setup canceled.", SEVERE);
abort;
case DLG_INIT:
// Set the font and text for static text box 1.
if (CtrlSetFont (szDialogName, hFont1, RES_TEXT_1) = 0) then
CtrlSetText (szDialogName, RES_TEXT_1,
"This text is set in 14-point Arial bold.");
else
CtrlSetText (szDialogName, RES_TEXT_1,
"Unable to set font for first static text box.");
endif;

// Set font and text for static text box 2.
if (CtrlSetFont (szDialogName, hFont2, RES_TEXT_2) = 0) then
CtrlSetText (szDialogName, RES_TEXT_2,
"This text is set in 11-point Times New Roman italic.");
else
CtrlSetText (szDialogName, RES_TEXT_2,
"Unable to set font for second static text box.");
endif;

// Set font and text for static text box 3.
if (CtrlSetFont (szDialogName, hFont3, RES_TEXT_3) = 0) then
CtrlSetText (szDialogName, RES_TEXT_3,
"This text is set in 10-point Arial bold.");
else
CtrlSetText (szDialogName, RES_TEXT_3,
"Unable to set font for third static text box.");
endif;

// Set font and text for static text box 4.
if (CtrlSetFont (szDialogName, hFont4, RES_TEXT_4) = 0) then
CtrlSetText (szDialogName, RES_TEXT_4,
"This text is set in 9-point Courier New.");
else
CtrlSetText (szDialogName, RES_TEXT_4,
"Unable to set font for fourth static text box.");
endif;
case RES_PBUT_NEXT:
bDone = TRUE;
case RES_PBUT_CANCEL:
// The user clicked the Cancel button.
Do (EXIT);
endswitch;

until bDone;

// Close the dialog box
EndDialog (szDialogName);

// Free the dialog box from memory
ReleaseDialog (szDialogName);

end;

ThomasDeboben
05-09-2005, 05:57 AM
What will happen with the predefined dialogs?

I would like to change the font and size in all dialogs, not only my custom dialogs.

Hop you could help me.

Thanks,
Thomas

ThomasDeboben
05-09-2005, 06:24 AM
I've found the needed function :-)

Syntax
DialogSetFont ( szFontName, nFontSize, nReserved );

Parameters
Parameter Description
szFontName Specifies the font to be used—for example, “Times New Roman”.
nFontSize Specifies the font size—for example, 10.
nReserved Pass 0 (zero) in this parameter. No other value is allowed.

ISNewBee
12-27-2005, 03:37 PM
This does not help if you are using Skins (in InstallShield X - InstallScript Projects). It actually skews all the graphic and dialog sizes.

Any other option to change Font Size on all dialog boxes if you are using Skins?

Editing via DirectEditor in TextStyle & Property tables don't help either.

ravikiran
01-04-2006, 01:55 AM
I was also facing the similar kind of problem. Actually i tried to set the larger font size to one of the text control present in the Welcome Dialog box, the dialog box i was using is the standard welcome 'SdWelcome'. I used the following procedure "To set the font and font style of a text string, prefix the string of displayed characters with {\style} or {&style}. Where style is an identifier listed in the TextStyle column of the TextStyle table", this is also not showing any result. I have used only the standard dialog boxes. Is it possible to set the font size to some of the controls only.