PDA

View Full Version : Read Edit control value in custom dialog



Manish Jhalani
10-16-2014, 04:51 AM
Hi,

I am using custom dialog where I am providing an edit control to show installation path and browse button to select/change the installation folder path. Edit control is suggesting default path. User can change path of his choice by browse button, and we show the changed path in edit control. This path is being used in another custom dialog Ready to install. Browse button changes on option dialog are carried forward to Ready to install.

But if user changes installation path directly in edit control by keyboard, they are not carried forward to Ready to install.

Do I need to handle any event ?

Set Variable %_SB_INSTALLDIR% to "[INSTALLDIR]"
Set Variable %DEST_DIR% to "%_SB_INSTALLDIR%"

Set Text "%_SB_INSTALLDIR%" to ControlID "DESTDIR"
***** If %_SB_CONTROLID% Equals "BROWSEDIR" Then
******** Set Variable %_SB_INSTALLDIR% to FUNCTION:Browse for Folder()
******** Set Variable %DEST_DIR% to "%_SB_INSTALLDIR%"
******** Set Text "%_SB_INSTALLDIR%" to ControlID "DESTDIR"
***** End
***** If %_SB_CONTROLID% Equals "DESTDIR" Then
******** Set Variable %_SB_INSTALLDIR% to "%DEST_DIR%"
******** Set Text "%_SB_INSTALLDIR%" to ControlID "DESTDIR"
***** End

linder
10-16-2014, 05:32 AM
Manish,

Please send a small demo project to support [at] lindersoft [dot] com so we can see what you are doing. We can then tell you how to "fix" it. The code snippet you posted does not include the required information.

Friedrich

Unregistered
10-16-2014, 05:45 AM
Manish,

Please send a small demo project to support [at] lindersoft [dot] com so we can see what you are doing. We can then tell you how to "fix" it. The code snippet you posted does not include the required information.

Friedrich


! //////////////////////////////////////////////////////////////////////////////////////////////////
! //
! //** SSSS S* BBBBBB
! //* S*** SS** B*** B
! //* S**** S** B*** B
! //* S******** B*** B
! //** SSS***** BBBBB******** SetupBuilder 7 Install Project Script
! //***** SS*** B*** B
! //******* S** B*** B******* Created with build: 7.1.2860
! //* S**** S** B*** B
! //* SS*** S** B*** B
! //* S SSSS** BBBBBB
! //
! //////////////////////////////////////////////////////////////////////////////////////////////////
[ Support Files ]
! --- Required temporary installation files ---

[ Billboards ]
! --- Billboard files ---
[ Initialize Setup ]
! --- Define commonly used constants ---
#include script "Common Definitions.sbi"

! Important: Initialize default install folder and program group variables
Set Variable %_SB_INSTALLDIR% to "[INSTALLDIR]"

[ Features ]
! If features are enabled, %_SB_FEATURESID% holds all selections separated by a vertical bar "|"
! Warning: It is not recommended to manually modify the %_SB_FEATURESID% variable!

[ Setup Types ]
! If setup types are enabled, %_SB_SETUPTYPEID% holds the selected type
! Warning: It is not recommended to manually modify the %_SB_SETUPTYPEID% variable!
::Define Setup Type "Typical"
::Define Setup Type "Minimal"
::Define Setup Type "Custom" [Custom Type]

[ User Interface ]
! Wizard dialog definition(s)

Set Variable %DEST_DIR% to "%_SB_INSTALLDIR%"

! Wizard dialog definition(s)
Define Wizard Dialog "WELCOME" (Custom Wizard Dialog)
Define Wizard Dialog "LICENSE" (Custom Wizard Dialog)
Define Wizard Dialog "OPTIONS" (Custom Wizard Dialog)
Define Wizard Dialog "READYTOINSTALL" (Custom Wizard Dialog)
! The Wizard Loop displays the dialog screens that the user sees in the installation
Loop Wizard (Abort Dialog Active)
** If %_SB_DIALOGID% Equals "$LICENSE$" Then
***** If %_SB_EVENTID% Equals "$EVENT:ONINIT$" Then
******** Disable ControlID "$NEXT_BUTTON$"
***** End
*****
***** If %_SB_EVENTID% Equals "$EVENT:ONREOPEN$" Then
******** If %LICENSE_ACCEPTED% Equals "0" Then
*********** Disable ControlID "$NEXT_BUTTON$"
******** End
***** End
*****
***** If %LICENSE_ACCEPTED% Equals "1" Then
******** Enable ControlID "$NEXT_BUTTON$"
***** End
***** If %LICENSE_ACCEPTED% Equals "0" Then
******** Disable ControlID "$NEXT_BUTTON$"
***** End
** End
**
**
**
** If %_SB_DIALOGID% Equals "$OPTIONS$" Then
*****
***** Set Text "%_SB_INSTALLDIR%" to ControlID "DESTDIR"
***** If %_SB_CONTROLID% Equals "BROWSEDIR" Then
******** Set Variable %_SB_INSTALLDIR% to FUNCTION:Browse for Folder()
******** Set Variable %DEST_DIR% to "%_SB_INSTALLDIR%"
******** Set Text "%_SB_INSTALLDIR%" to ControlID "DESTDIR"
***** End
***** If %_SB_CONTROLID% Equals "DESTDIR" Then
******** Set Variable %_SB_INSTALLDIR% to "%DEST_DIR%"
******** Set Text "%_SB_INSTALLDIR%" to ControlID "DESTDIR"
***** End
*****
***** If %_SB_INSTALLDIR% File or Folder doesn't exist Then
******** Create Folder "%_SB_INSTALLDIR%"
***** End
***** Set Variable %DRIVELETTER% to FUNCTION:Extract Drive Letter(%_SB_INSTALLDIR%)
***** Set Variable %DISKSPACE% to FUNCTION:Get System Info(Free Disk Space) for "%DRIVELETTER%"
** End
**
** If %_SB_DIALOGID% Equals "$READYTOINSTALL$" Then
***** Set Text "%_SB_INSTALLDIR%" to ControlID "DESTFOLDER"
***** Set Text "%DRIVELETTER%" to ControlID "CURRDRIVE"
** End
End

[ Final User Interface ]
! Final wizard dialog definition(s)
Define Wizard Dialog "FINISH" (Custom Wizard Dialog)
! The Wizard Loop displays the dialog screens that the user sees in the installation
Loop Wizard (Abort Dialog Active)
** Set Text "Finish" to ControlID "$NEXT_BUTTON$"
** Disable ControlID "$CANCEL_BUTTON$"
End

linder
10-16-2014, 06:08 AM
Sorry, but this is just a script text. All the internal parameters are missing and the text can't be used to compile an executable.

Please send the project file (.sb8) to support [at] lindersoft [dot] com.

Friedrich

linder
10-16-2014, 06:12 AM
BTW, just noticed the "Created with build: 7.1.2860".

This is a very old version and it reached End-of-Life on July 26, 2010 (more than 4 years ago).

But you can send the .sb7 project and we'll compile and test it with the latest SB8.

Friedrich

Unregistered
10-16-2014, 06:54 AM
BTW, just noticed the "Created with build: 7.1.2860".

This is a very old version and it reached End-of-Life on July 26, 2010 (more than 4 years ago).

But you can send the .sb7 project and we'll compile and test it with the latest SB8.

Friedrich

Sent.

linder
10-16-2014, 07:50 AM
Hello,

There are some problems in your script logic. You do not handle the events correctly or not at all ($EVENT:ONINIT$, $EVENT:ONREOPEN$, $EVENT:ONUPDATE$). Sometimes, you execute the functions twice and this results in an unexpected behavior.

To fix the problem from the question asked, add the %DEST_DIR% runtime variable to the Static Text field. Then remove the Set Text "%_SB_INSTALLDIR%" to ControlID "DESTFOLDER" line from the script. But again, there are some more problems in your script logic. This will only fix one of them.

Does this help?

Friedrich

P.S. NEVER create a folder from within the wizard that collects information from the user. All this should be executed after the wizard.

Unregistered
10-17-2014, 03:37 AM
Hello,

There are some problems in your script logic. You do not handle the events correctly or not at all ($EVENT:ONINIT$, $EVENT:ONREOPEN$, $EVENT:ONUPDATE$). Sometimes, you execute the functions twice and this results in an unexpected behavior.

To fix the problem from the question asked, add the %DEST_DIR% runtime variable to the Static Text field. Then remove the Set Text "%_SB_INSTALLDIR%" to ControlID "DESTFOLDER" line from the script. But again, there are some more problems in your script logic. This will only fix one of them.

Does this help?

Friedrich

P.S. NEVER create a folder from within the wizard that collects information from the user. All this should be executed after the wizard.


Thanks.

I am still facing some issues after I did both suggested changes - 1. Add the %DEST_DIR% runtime variable to the Static Text field, 2. remove the Set Text "%_SB_INSTALLDIR%" to ControlID "DESTFOLDER" line from the script.

Issues:
1. Change of installation folder done by keyboard on options dialog only get reflected once on ready to install dialog. If we do back and change installation folder it is not reflected on ready to install.
2. Now change of installation folder using Change button also not get reflected on ready to install.
3. When we do back the edit control shows the default install dir not the changed one.

linder
10-17-2014, 03:47 AM
Yes, exactly. That what I meant in my previous comment. There are some more issues in your script logic :( Sometimes, you execute the same code twice and overwrite values.

Did you already download the Example Package and Learning SetupBuilder Part I? There are some very interesting custom dialog demo projects available (including "event handling").

Friedrich

Unregistered
10-17-2014, 04:53 AM
Yes, exactly. That what I meant in my previous comment. There are some more issues in your script logic :( Sometimes, you execute the same code twice and overwrite values.

Did you already download the Example Package and Learning SetupBuilder Part I? There are some very interesting custom dialog demo projects available (including "event handling").

Friedrich

I dont have download rights at my system and could not access Example Package and Learning Setup Builder Part I. Could you please help with solution ?

linder
10-17-2014, 05:39 AM
Do you mean another solution to get the access to the examples? Perhaps via email?

Friedrich

Manish Jhalani
10-17-2014, 05:59 AM
Do you mean another solution to get the access to the examples? Perhaps via email?

Friedrich

If you could suggest solution of my original posted problem in this post or mail. Also could you please mail me examples/help files for events and custom dialog.

linder
10-17-2014, 06:35 AM
The problem is that your script logic (especially the event handling in your OPTIONS and READYTOINSTALL dialogs) is incorrect. The solution would be to handle the events. As I understand it, you do not have downloaded the required documentation. But you really need the examples / documentation to learn how to use this feature.

Please send your email address to our Support [at] lindersoft [dot] com and we'll send the dialog examples. I am afraid that the help file is too large.

Friedrich

Unregistered
10-17-2014, 07:11 AM
The problem is that your script logic (especially the event handling in your OPTIONS and READYTOINSTALL dialogs) is incorrect. The solution would be to handle the events. As I understand it, you do not have downloaded the required documentation. But you really need the examples / documentation to learn how to use this feature.

Please send your email address to our Support [at] lindersoft [dot] com and we'll send the dialog examples. I am afraid that the help file is too large.

Friedrich

Email address is shared.

linder
10-17-2014, 07:27 AM
ZIP file with some custom example projects and direct links to the full Example Package / Tips and Tricks manual sent.

Friedrich

linder
10-17-2014, 07:32 AM
BTW, when I can find some time this busy weekend, I'll try to use your project as an example and add some more script logic.

Friedrich

Unregistered
10-17-2014, 10:34 PM
BTW, when I can find some time this busy weekend, I'll try to use your project as an example and add some more script logic.

Friedrich

Thanks for the extended support.