cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
FlexeraFan
Level 5

Not able to change text control text using the "CtrlSetText" command.

Jump to solution

 

I have a custom dialog box with text controls on it. How can I change the text using install script?

I have a text control and I tried to change the text using the "CtrlSetText"  command. I also tried changing the edit control text using "CtrlSetText"  but that also is not working? Attached is my projects .ism and my .rul files.

Please help !

p.s., I am using both InstallShield 2019, and 2016, for project creation. Also below is the .rul file I am using for my custom dialog where CtlrSetText is being called:

 

#define BUTTON_NEXT 1
#define BUTTON_BACK 12

#define DialogBoxIdentifier 50

#define UserNameText 1302
#define InputTextBox 1303

prototype NUMBER FirstDialog();
function NUMBER FirstDialog()
BOOL bDone;
BOOL isSelected;
NUMBER nControl, nReturn;
HWND hInstance, hwndParent, hwndDlg;
string szDlg;
STRING szDialogName;

begin

szDialogName = "FirstDialog";

CtrlSetText(szDialogName,UserNameText,"Hello");
CtrlSetText(szDialogName,InputTextBox,"World");


EzDefineDialog(
"FirstDialog",
"",
"",
DialogBoxIdentifier);

bDone = FALSE;


while (!bDone)
nControl = WaitOnDialog("FirstDialog");
switch (nControl)
case DLG_INIT:
hwndDlg = CmdGetHwndDlg("FirstDialog");
SdGeneralInit("FirstDialog", hwndDlg, 0, "");
case BUTTON_BACK:
// user clicked Back
nReturn = BUTTON_BACK;
bDone = TRUE;
case BUTTON_NEXT:
nReturn = BUTTON_NEXT;
bDone = TRUE;
default:
if (SdIsStdButton(nControl) && SdDoStdButton(nControl)) then
bDone = TRUE;
endif;
endswitch;
endwhile;


EndDialog("FirstDialog");
ReleaseDialog("FirstDialog");
return nReturn;

end;

 

Labels (1)
0 Kudos
(1) Solution
Varaprasad
Level 7 Flexeran
Level 7 Flexeran

Move CtrlSetText command after dialog gets initialized.

while (!bDone)
nControl = WaitOnDialog("FirstDialog");
switch (nControl)
case DLG_INIT:
hwndDlg = CmdGetHwndDlg("FirstDialog");
SdGeneralInit("FirstDialog", hwndDlg, 0, "");

CtrlSetText(szDialogName,UserNameText,"Hello");
CtrlSetText(szDialogName,InputTextBox,"World");

case BUTTON_BACK:
// user clicked Back
nReturn = BUTTON_BACK;
bDone = TRUE;
case BUTTON_NEXT:
nReturn = BUTTON_NEXT;
bDone = TRUE;
default:
if (SdIsStdButton(nControl) && SdDoStdButton(nControl)) then
bDone = TRUE;
endif;
endswitch;
endwhile;

 

For more information, please refer below link.

https://helpnet.flexerasoftware.com/installshield25helplib/Subsystems/LangRef/helplibrary/LangrefCtrlSetText_example.htm

View solution in original post

0 Kudos
(1) Reply
Varaprasad
Level 7 Flexeran
Level 7 Flexeran

Move CtrlSetText command after dialog gets initialized.

while (!bDone)
nControl = WaitOnDialog("FirstDialog");
switch (nControl)
case DLG_INIT:
hwndDlg = CmdGetHwndDlg("FirstDialog");
SdGeneralInit("FirstDialog", hwndDlg, 0, "");

CtrlSetText(szDialogName,UserNameText,"Hello");
CtrlSetText(szDialogName,InputTextBox,"World");

case BUTTON_BACK:
// user clicked Back
nReturn = BUTTON_BACK;
bDone = TRUE;
case BUTTON_NEXT:
nReturn = BUTTON_NEXT;
bDone = TRUE;
default:
if (SdIsStdButton(nControl) && SdDoStdButton(nControl)) then
bDone = TRUE;
endif;
endswitch;
endwhile;

 

For more information, please refer below link.

https://helpnet.flexerasoftware.com/installshield25helplib/Subsystems/LangRef/helplibrary/LangrefCtrlSetText_example.htm

0 Kudos