This website uses cookies. By clicking Accept, you consent to the use of cookies. Click Here to learn more about how we use cookies.
Turn on suggestions
Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.
- Revenera Community
- :
- InstallShield
- :
- InstallShield Forum
- :
- Re: Set Dialog Title
Subscribe
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Feb 04, 2009
07:06 PM
Set Dialog Title
Project Type: InstallShield MSI
I'd like to create a single "error dialog" and change the text and title whenever the error dialog gets instantiated, reusing the same dialog. I have everything working as expected except I can't seem to figure out how to change the title of the dialog programmatically. I have a generic title set in the dialogs direct editor screen but I'd like to be able to programmatically set the title to match the error being shown. SetDialogTitle won't work as I'm not using one of the pre-defined dialog types but a dialog created from scratch. Is there any way to set the title each time the dialog is created?
I'd like to create a single "error dialog" and change the text and title whenever the error dialog gets instantiated, reusing the same dialog. I have everything working as expected except I can't seem to figure out how to change the title of the dialog programmatically. I have a generic title set in the dialogs direct editor screen but I'd like to be able to programmatically set the title to match the error being shown. SetDialogTitle won't work as I'm not using one of the pre-defined dialog types but a dialog created from scratch. Is there any way to set the title each time the dialog is created?
(10) Replies
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Feb 04, 2009
07:58 PM
Depending how it was created, set IFX_SETUP_TITLE to the title you want?
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Feb 05, 2009
01:51 PM
I tried setting IFX_SETUP_TITLE just before creating the dialog and just after creating it with DefineDialog. I still get the title defined in the direct editor table.
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Feb 05, 2009
02:07 PM
Could you post an outline of the custom dialog code, including any initialization?
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Feb 05, 2009
04:39 PM
Below are both of my relevant functions and a sample calling. I've left in the most recent attempt at setting IFX_SETUP_TITLE. I've also tried setting it in the DLG_INIT code to no avail.
function NUMBER spsDialogCreate( szDialogName, nResourceId )
BOOL bDone;
HWND hInstance, hParent;
NUMBER nResult;
STRING szDialog, szDllName;
begin
hInstance = 0;
szDllName = "";
szDialog = "";
hParent = 0;
nResult = DefineDialog( szDialogName, hInstance, szDllName,
nResourceId, szDialog, hParent,
HWND_INSTALL, DLG_MSG_STANDARD|DLG_CENTERED );
if ( nResult < 0 ) then
MessageBox( "Error in defining dialog", SEVERE);
abort;
endif;
return nResult;
end;
function spsDisplayError( szText )
BOOL bDone;
NUMBER nResult;
STRING szDialogName;
begin
IFX_SETUP_TITLE = "foo";
szDialogName = "dlgError";
nResult = spsDialogCreate( szDialogName, RES_DLG_ERROR );
bDone = FALSE;
while ( !bDone )
nResult = WaitOnDialog( szDialogName );
if ( nResult == DLG_INIT ) then
CtrlSetText( szDialogName, RES_TEXT_ERROR_TEXT, szText );
elseif ( nResult == RES_BTN_ERROR_OK || nResult == DLG_CLOSE ) then
bDone = TRUE;
elseif ( nResult == DLG_ERR ) then
MessageBox( "Unable to display dialog. Setup canceled.", SEVERE );
abort;
endif;
endwhile;
EndDialog( szDialogName );
ReleaseDialog( szDialogName );
end;
spsDisplayError( szText );
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Feb 05, 2009
04:55 PM
Perhaps try calling SdInit( ); near the beginning of your custom dialog function and then set IFX_SETUP_TITLE; in a quick test, that seemed to make the dialog pay attention...
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Feb 05, 2009
05:50 PM
I've tried SdInit() in several locations inside of both spsCreateDialog and spsDisplayError. In every case, the IFX_SETUP_TITLE was set after the call to SdInit(). None has produced a change in the dialog's title. Could you show the sample code from your test that worked?
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Feb 05, 2009
06:06 PM
Sloppy and condensed, but this seemed to work:
Later, in OnFirstUIBefore after SdWelcome:
After which the changed IFX_SETUP_TITLE seems to show up:
#include "ifx.h"
// dialog nickname and also name in Dialogs view
#define DLGNAME "TestDlg"
prototype ShowMyDlg( );
function ShowMyDlg( )
begin
SdInit( );
IFX_SETUP_TITLE = "Changed Dialog Title";
EzDefineDialog(DLGNAME, ISUSER, DLGNAME, 0);
while(TRUE)
switch(WaitOnDialog(DLGNAME))
case 9: Do(EXIT); // Cancel, that is
endswitch;
endwhile;
EndDialog(DLGNAME); ReleaseDialog(DLGNAME);
end;
Later, in OnFirstUIBefore after SdWelcome:
IFX_SETUP_TITLE = "Unchanged Dialog Title";
// display custom dialog
ShowMyDlg( );
After which the changed IFX_SETUP_TITLE seems to show up:
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Feb 05, 2009
06:31 PM
I just tried this sequence with the exception that my dialog is created with DefineDialog instead of EzDefineDialog. Perhaps therein lies the problem.
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Feb 05, 2009
06:43 PM
Hmmm, replacing my EzDefineDialog call with this---
DefineDialog(DLGNAME, 0, ISUSER,---seems to work, too...
0, DLGNAME, 0,
HWND_INSTALL, DLG_MSG_STANDARD|DLG_CENTERED);
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Feb 06, 2009
06:56 PM
When I replace my nResourceId with 0, as you have done, I get a DLG_ERR condition and the dialog is not displayed. I guess I'll just leave it as a generic "Error!" title and not worry about it. I hope your insights can help someone else get this working for them.
Thanks for the time and effort.
Thanks for the time and effort.