Install4j console handler for directory selection - console

My app has an installation directory chooser form. It validates whether dir has required available space. Screen looks like:
some text
Dir chooser component
A label which prints the available disk space. This is bound to a context variable availableSpace.
Disk space is calculated in "validation expression".
This works correctly in UI mode. In console mode - the behaviour is:
A. #1 is shown.
B. #2 asks user to select dir
(user selects a dir)
C. #3 shows the label text. Since there is no calculation done yet, availableSpace is not updated yet. User sees an old value.
D. Validation logic triggers and the UI is rerendered.
E. #1 is shown. #2 is shown and user enters the dir again. #3 shows the value which was set in #C.
From UI's perspective the form has already calculated data so #C is correct.
But from console user's perspective, user entered a dir and so #C is confusing to user. Because he just entered a dir and space value is old. He thinks that the dir has space, why is application shows old value ?
How to fix this behaviour ?
One solutionis to not show #C on console mode and instead use a Util.showMessage().
Can ConsoleHandlerFormComponent solve this ?
Is there a handler for DirectoryChooserComponent selection ? That can check for space in real time.
Thanks for your help.

In console mode, the "Validation script" property of the "Installation directory chooser" form component is executed as soon as you confirm the selection.
The problem in your case is that the label is not updated. This is because form components are initialized only once at the time that the screen is created. You can call
formEnvironment.reinitializeFormComponents();
in the "Validation script", then the contents of the label will be evaluated again.

Related

Qt 6 crash in QPlainText::setExtraSelections after QPlainText::setDocument

I'm trying to set up a text widget that highlights the searched word, when I open a new file with QPlainText::setDocument, then immediately use QPlainText::setExtraSelections I get a SIGSEV crash in:
QTextDocumentPrivate::rootFrame
QTextDocumentPrivate::frameAt
QTextCursorPrivate::complexSelectionTable
QTextCursor::hasComplexSelection
QWidgetTextControl::selectionRect
QWidgetTextControl::setExtraSelections
QTextDocumentPrivate is causing a SIGSEV because it is a null this pointer. But this doesn't happen if no word is set before the document is loaded.
I must be supposed to do something to force it to generate the QTextDocumentPrivate. But I have no idea what that is.
Actually, this happens because QPlainText::setDocument does not remove the prior results of QPlainText::setExtraSelections. So when setting the new selections tries to remove the previous things selected, they all have invalid pointers and that causes the crash.
To fix it call: textEdit->setExtraSelections({}); to clear out the selections prior to calling QPlainText::setDocument.

QFileDialog prompt to overwrite if selection changed

I would like a QFileDialog to prompt for overwrite confirmation only if the selection changed. Is there any way to achieve this?
Currently, I'm getting a save file name as follows:
data_file_name = QtGui.QFileDialog.getSaveFileName(self, "Data File", selected, self.FILTER_DATA_FILE)
If I'm re-saving an open project, selected is the name of the project file. If I'm creating a new project, selected is the name of the directory where the user most recently saved a project. If I enter a file name that doesn't exist (regardless of the value of selected), I don't get prompted for confirmation, as desired. However, if the selected name is a file that exists, also regardless of the value of selected, I always get promoted for confirmation. I would like the following behaviour:
If the dialog has a default selection and the user does not change this selection, do not prompt for confirmation.
Else if the user enters a file name that does not currently exist, do not prompt for confirmation.
Else prompt for confirmation. (I don't particularly care what happens if the user enters the empty string as a file name.)
I'm currently using Qt 4, though I'm not against upgrading to Qt 5 if that would make my life easier.
It looks like what I want isn't possible: QFileDialog::accept() doesn't provide any mechanism for that sort of customization. I'll have to disable overwrite confirmation in my dialog and implement that logic myself.

Log4net - Change file name based on logged user data

I am trying to use this pattern to create a dynamic file name: "Debug_%property{LogUserName}.txt"
The value of %property{LogUserName} is retrieved from log4net.LogicalThreadContext.Properties["LogUserName"], which is filled when the user logs in.
In the first time, it works perfectly. The file gets named like Debug_user1.txt (for example).
If user1 disconnects, and the user2 logs in (at the same browser) a new file should be created, but it's not happening.
It seems that the LogicalThreadContext.Properties are final variables, and can't be changed at runtime.
I tried to change the FileAppender.File property, but it doesn't work too.
Resolved this problem with stuartd's tip: calling ActivateOptions().

Run solution exe after installtion using installshield

I want to run my exe after installation using InstallShield.
InstallShield completes the setup correctly but do not run the exe.
I found another way to add an exe in startup but it runs after restart.
I would like it to run without restart.
Is it possible ?
What version and edition of InstallShield are you using? Also what project type are you using? (InstallScript, InstallScript MSI, Basic MSI? )
Assuming Basic MSI, InstallShield has a built-in pattern to support this story:
1) Click on the Project Assistant Tab
2) Click on the Installation Interview Icon (Page)
3) Click Yes for "Do you want to give the users the option to launch your application when the installation completes?
4) Click the browse button to select the EXE that should be the target of the operation.
By default the checkbox (launch program) on the setup complete dialog will not be selected. To select it automatically add the property LAUNCHPROGRAM to the property table and set it to a value of '1'.
Christopher Painter's answer will work for you most of the time. Those are the initial steps to take, but there are some additional details if you find that isn't enough. For instance, skb reported that this didn't work for him. I found that I was in the same boat (even though I've built a dozen other installers which had this work!).
Follow Christopher Painter's instructions.
Click on the "Installation Designer" tab. Within "User Interface" select "Dialogs".
Within "All Dialogs", expand "SetupCompleteSuccess", and select "Behavior".
Select the "Ok" push button control. Then, select "Events". (look to the bottom of the screen where it says Events/Subscriptions/Conditions)
You should have a "DoAction" event, with an "argument" equal to "IS_LAUNCH_MY_PROGRAM_PLEASE" and a "condition" of "LAUNCHPROGRAM". If not - add that. "LAUNCHPROGRAM" refers to the property of that name. It will have a value of 1 if the launch checkbox is selected, and thus meet this condition. IS_LAUNCH_MY_PROGRAM_PLEASE refers to the Custom Action which is launched. If you want, you can change that CA here to make any custom action fire instead. I opted to leave this alone, but replace the CA with one of my own.
Open your list of Custom Actions (Behavior and logic... Custom actions and sequences). You should find a CA there named IS_LAUNCH_MY_PROGRAM_PLEASE. Delete it!
Add your own IS_LAUNCH_MY_PROGRAM_PLEASE CA. Right-click "Custom Action" (the list header) and select the type of CA you want - or launch the wizard. Just be sure to name it "IS_LAUNCH_MY_PROGRAM_PLEASE" if you left the dialog behavior as it defaults.
To launch an exe - with the WORKING DIRECTORY changed (which was the reason my app wouldn't appear, and apparently skb's as well based on the comments) Select "New EXE"..."Path referencing a directory". Change "Return processing" to "Asynchronous (no wait for completion)". Note the "MSI type number" becomes 226. Set the "Working directory" to INSTALLDIR(assuming the program you want to launch should be found in your new program's directory). Set "Filename & command line" to [INSTALLDIR]YourApp.exe.

Access Front MySql Back Runtime Error 7878

RunTime Error The Data has been changed.
I`m having a difficult time with one of my sub-forms. It used to work without complaints but I guess now it decided to be a little verbose. On this form I have a subform that has a variety of checkbox options. Whenever the user enters a checkbox option and then exits to the main form there is an On Exit Event which runs. It combines some textboxes from various forms and then puts that value in a textbox on the main form.
var1 = [Form1]![Textbox].Value
var2 = [Form2]![Textbox].Value
var3 = [Form3]![Textbox].Value
Me.[TextBox].Value = var1 & var2 & var3
For some reason upon exiting the subform I am getting the Runtime error.
The pattern is not apparent.
I can navigate from the subform to the main form without making any changes in either without receiving an error message.
If I go into the subform, make a change, exit the subform, the textbox will be updated with no complaint, however if I go back into the subform, do not make a change and then go back to the main form, then I get the runtime error
similarly after making sure that behavior 1 is true I can go into the subform, change something come back out, but if I try to go back into the subform and make an additional change I will get a complaint. (I was able to fix this by making an on enter event refresh the subform)
I am unable to get the Runtime Error fixed though... :(
I see that this is an issue for many people with no solution. Here was my work around.
From my observation the form that was having it's Textbox.value updated is somehow silently updated by either the on enter or on exit of it's subform so when the on exit action of updating that textbox occurs it complains that the main form was updated, thus leaving me to conclude that when that form is updated it is not shown to the user.
Thus, my work around is to requery the main form on the subform's exit in order to get that new data loaded and changed.
Caveat!! Requery will by default bring you back to the first record thus presenting the possibility of changing the textbox of the wrong record. Thus as part of the requerying process, if you choose this hack, you will have to bookmark the current open record, requery, and then fetch that record again. I used the code from this webpage in order to achieve the desired effect. Thus circumnavigating the 7878.
Requery and stay on record:
http://www.baldyweb.com/Requery.htm

Resources