Jump to content


This is a ready-only archive of the InstallSite Forum. You cannot post any new content here. / Dies ist ein Archiv des InstallSite Forums. Hier können keine neuen Beiträge veröffentlicht werden.
Photo

How can I make a Custom Dialog


9 replies to this topic

Dyerald

Dyerald
  • Members
  • 43 posts

Posted 05 November 2001 - 12:07

Hi,

Im new with ISDev7 and I want to make a custom dialog. I did not find any tutorial on how to do this. I have made a custom dialog on the dialog editor on the standard project but I dont know how to include it on my setup. I saw a sample on the EzDefineDialog and WaitOnDialog but it requires a numerical DalogID. They said it would be much better if I use nDialogID. Where can i find this DalogID. Im sorry but Im really confused.

Pls help... Can you teach me how to make a working custom dialog. Pls help me... I would be very grateful for any help you could give me. Thanks in advance. =)

Dyerald


Christof

Christof
  • Members
  • 56 posts

Posted 05 November 2001 - 13:55

Hi,
create a new Dialog e.g. MyDialog1. Create a function and call after e.g. your Welcome Dialog
In this function insert the following code:

Put this in the function header:
STRING szDialogName,szDialogID;
NUMBER nCmdValue,nResult;
BOOL bDone;

bDone = FALSE;
szDialogName = "ImosSelectLanguage";
szDialogID = "ImosSelectLanguage";
EzDefineDialog(szDialogName, ISUSER, szDialogID, NULL );
repeat
nCmdValue = WaitOnDialog(szDialogName);
switch (nCmdValue)
case DLG_CLOSE:
     Do (EXIT);
case DLG_ERR:
     MessageBox ("Unable to display dialog. Setup canceled.", SEVERE);
     abort;
case DLG_INIT:
 //Put in some INIT code here
// NEXT
case SD_PBUT_CONTINUE:
 nResult = nCmdValue;
 bDone = TRUE;
// BACK
case SD_PBUT_BACK:
 nResult = nCmdValue;
 bDone = TRUE;
//Cancel
case SD_PBUT_EXITSETUP:
nResult = nCmdValue;
Do (EXIT);
endswitch;
until bDone;  
EndDialog("ImosSelectLanguage");
ReleaseDialog("ImosSelectLanguage");
return nResult

You can see that you must use the Dialog Name as ID. This only is different, when you modify a standard dialog, then you have to finde out the standard dialog id.
Also you have to use the 7.01 version if you use multilanguage setup. There was a big bug in the 7.0

Hope that help. If you need more help you can contact me directly.
Greetings
Christof


Christof

Christof
  • Members
  • 56 posts

Posted 05 November 2001 - 13:57

Ooops
correction please use
szDialogName = "MyDialog1";
szDialogID = "MyDialog1";  
I used some parts of my code and forgot to modify the names...


JonB

JonB
  • Members
  • 12 posts

Posted 05 November 2001 - 18:55

You can enter the dialog ID in the Direct Editor.  Go to "dialogs", and it's the last column in the table.  The example uses 22003, I think?  I started with that, and incremented up from there.  Not clear if these are "legal" numbers.  I haven't had problems yet, but only have a few dialogs.   I talked to a support person about this, and she seemed to think it was the right thing to do.  But I'll bet there are legal and illegal ranges of id numbers.

afisk2

afisk2
  • Members
  • 5 posts

Posted 05 November 2001 - 20:42

I would definitely recommend testing the numbers you choose on 9X machines, as I've had a couple of cases where the custom dialog numbers I chose worked on NT/2000/XP and not on 9X.

Dyerald

Dyerald
  • Members
  • 43 posts

Posted 06 November 2001 - 10:43

Hi Guys,

Thank you so much for a such big help... I can show now my dialog but I still have a problem.. its about my dialog controls... I have 2 radio button groups and the radiobuttongroup1 consist of 3 radio buttons and the radiobuttongroup2 consist of 2 radiobuttons. I dont know how to make this controls work. I have read about the controls built-in functions of InstallShield namely CtrlGetState and CrtlSetState. I have read also their example... its example was for checkboxes. Checkbox and radiobutton has different functionality so I dont know if I will try those example cause im a bit confused. In the radio button properties, it has a property there named value so I put a value on it knowing that these values will be will be reflected with the radiobuttongroup property. I cant find the radiobuttongroup property instead I found 5 new properties on the property manages which is related to the 5 radibuttons on my dialog. So I do not know what to code in my script. Do you have any idea?  

Thanks in advance for any help or ideas you could give me.

Dyerald =)

(Edited by Dyerald at 9:45 am on Nov. 6, 2001)

(Edited by Dyerald at 9:57 am on Nov. 6, 2001)


Christof

Christof
  • Members
  • 56 posts

Posted 06 November 2001 - 10:57

Hi,
I don't if I understand your problem, but first you must create a radio button group, in this group you can insert radio buttons. The you have to find out the id of the radio buttons. My way is to open the rc file with text editor and find my radio button and it's id.
Here is some code from my projekt. I have a special  language dialog:

case DLG_INIT:
 if(bShowGER = TRUE) then
  CtrlSetState("ImosSelectLanguage", 1302, BUTTON_CHECKED);
   else
   CtrlSetState("ImosSelectLanguage", 1302, BUTTON_UNCHECKED);
           endif;
  if(bShowENG = TRUE) then
      CtrlSetState("ImosSelectLanguage", 1303, BUTTON_CHECKED);
   else
       CtrlSetState("ImosSelectLanguage", 1303, BUTTON_UNCHECKED);
           endif;
...
where ImosSelectLanguage is the name of my dialog and 1302 and 1303 the ids of the radio buttons

When the user presses the next button you can find out the control state like this:
case SD_PBUT_CONTINUE:
     if(CtrlGetState("ImosSelectLanguage", 1302)= BUTTON_CHECKED)then
     nLanguage  = 0;
   endif;
   if(CtrlGetState("ImosSelectLanguage", 1303)= BUTTON_CHECKED)then
    nLanguage  = 1;
 endif;

It is important for you to find out the id's. The rest is simple coding..
Hope that helps
Greetings
Christof


Dyerald

Dyerald
  • Members
  • 43 posts

Posted 07 November 2001 - 04:49

Hi Sir Christof,

Thank you so much for a very big help. I’m very grateful. My custom dialog worked fine now. =) But I still have a question, I'm just curious about the radio buttons property table and the property manager thing on the standard project. I have 5 radio buttons and then 5 properties appeared on the property manager and its name is exactly the same with the name of the radio buttons in the radio button property table... so I thought it was the controls property that I can use in my script. I put also a value on the value part of the radio buttons property table just like what I was doing when I'm using IPWI 2.03. I thought it was just the same since I found a value and property name on the property table on the dialog editor.

//////And this is what I have read from the help about the value on the property table. ////

Enter the value that you want the radio button group's property to have when this radio button is selected.

To make one of the buttons selected by default, enter the radio button group's Windows Installer property into the Property Manager. The property must be in all capital letters if you want it be public in scope. Then, specify the value of the button that you want to appear as the default. For example, if one of your radio buttons has a value of 104 and the radio button group uses the property GRP_PROPERTY1, enter the following information in the Property Manager to make this radio button the default selection:
Name Value

GRP_PROPERTY1   104
////////////////////////////////////////

I thought I could use the controls property table. But I did not found any property related to the radio button group. I only found properties for my radio buttons. What's the property of the radio buttons for if I cant use it? Is it for MSI project only? I’m just curious =) By the way I’m using ISDev 7.0 coz I haven't downloaded yet the upgraded version =). Hey thanks again for your help =)

Dyerald


Christof

Christof
  • Members
  • 56 posts

Posted 07 November 2001 - 08:45

Hi Dyerald ,
sorry I can't follow. If I understand right (sorry my english is not so good) you want to select a special radio button by default. This is simple. In my example you found the section
case DLG_INIT:
if(bShowGER = TRUE) then
 CtrlSetState("ImosSelectLanguage", 1302, BUTTON_CHECKED);
  else
  CtrlSetState("ImosSelectLanguage", 1302, BUTTON_UNCHECKED);
          endif;

If I enter my function I tested the selected languange of InstallShield. This may be German, but if you want to have my program menus in english you have to select in my custom dialog the language englsih. I have a global variable which contanis a language id. So at start of my function I tested the language and set the selected language to default with the function CtrlSetState(..). So you can get a defined start. You also can set it fixed at start, but I found it to difficult if the user changes between your dialogs (got to next and come back). I think it is more easy to use a global variable and have a defined status.

If user selects the next button
case SD_PBUT_CONTINUE:
    if(CtrlGetState(..)
you can get the state of your radio button and set it to the global variable.

Is this what you mean - if not, then send me an email and attach your dialog and your code for the dialog (or a sample project) and I 'll have a look.
Greetings
Christof

By the way thanxs for the title "SIR" :-)))


Dyerald

Dyerald
  • Members
  • 43 posts

Posted 09 November 2001 - 10:39

Sir Christof,

Thanks so much! I understand now... =) My dialog works fine now. Thanks a lot again.

Dyerald =)