Page 1 of 1

Detect key press or key down event

Posted: Wed Jul 11, 2012 7:09 am
by khalprin
Is there a way to detect a key press or key down event in any of the installation dialogs? I'd like to handle an F1 key press and show the user some help information.

Re: Detect key press or key down event

Posted: Wed Jul 11, 2012 8:22 am
by FrancescoT
Dear khalprin,

I am very sorry but it is not possible.

Eventually you can use a button that triggers an action.

Regards.

Re: Detect key press or key down event

Posted: Wed Jul 11, 2012 8:37 am
by khalprin
How would I use a button? I only see actions like showing the next dialog, going back, or closing the dialog?

Re: Detect key press or key down event

Posted: Wed Jul 11, 2012 9:28 am
by FrancescoT
Dear khalprin,

To capture a custom button selection do the following:

- Open your Dialog with Dialog Editor.
- Add a Button to your dialog (with the following sample code I used the Welcome Dialog)
- Set the ID property of the button as you like (in my sample I used MYBUTTON)
- Double click the button and in the Object Behavior tab set "Return from Dialog" as Perform action.
- Close Dialog Editor and Save your Dialog settings .
- In your main script use the returned value by Display Dialog command.

With the following code snippet I used the value returned by the Welcome Dialog to show a Yes / NO MessageBox.
If the Yes button is selected the control is returned to the dialog, otherwise it will continue with the next dialog

Code: Select all

Set Variable MYCONTINUE to TRUE
while Variable MYCONTINUE Equals TRUE loop
  Display Dialog: welcome, wait for dialog to return (modal)
   
  if Variable WIZARD Equals MYBUTTON
    MessageBox: Debug, Button Pressed!
    if Variable MYCONTINUE Equals YES
      Set Variable MYCONTINUE to TRUE
    else
      Set Variable MYCONTINUE to FALSE
    end
  else
    Set Variable MYCONTINUE to FALSE
  end
wend

Code: Select all

~InstallAware Clipboard Data~
~Wend~
~{64AA6E6A-C231-441B-ADF0-93DEBF46C851}~
~End~
~{FAB9D3E9-EC92-40CB-B7AD-246603C6D797}~
~Set Variable~
~{E2174D05-6B42-458D-A473-7056D655F9B4}~
~MYCONTINUE$MYAH$MYAH$FALSE~
~FALSE~
~Else~
~{36B0EF7E-CD2C-415A-8D67-0DEB8F766D5E}~
~End~
~{6070EB8A-4A11-4298-974E-D617C0E7536D}~
~Set Variable~
~{82444A24-68BD-40F4-A68F-D79BD3D8C7CD}~
~MYCONTINUE$MYAH$MYAH$FALSE~
~FALSE~
~Else~
~{E4464388-5C02-4E3C-B492-B5F4125A7FBE}~
~Set Variable~
~{E93EA6FB-2C8E-4C84-85EF-5C973AD52817}~
~MYCONTINUE$MYAH$MYAH$FALSE~
~TRUE~
~If~
~{DE885F90-0192-4CC7-88AF-821E388073F2}~
~MYCONTINUE~
~0~
~YES~
~FALSE~
~MessageBox~
~{91BB14C8-1CCE-414F-8A46-E5A663A6BFCE}~
~Debug~
~Button Pressed!~
~0~
~4~
~MYCONTINUE~
~If~
~{6889DD72-BFEF-439B-9345-B88511867DC0}~
~WIZARD~
~0~
~MYBUTTON~
~FALSE~
~Comment~
~{0EC1FBDC-ADB3-4C6A-80AA-41B90DDBE3AF}~
~~
~Display Dialog~
~{63796225-243F-42DF-A695-E76AC201D100}~
~welcome~
~WIZARD~
~TRUE~
~~
~TRUE~
~FALSE~
~While~
~{8C1ABAEE-25E9-49B0-88F2-0E445ED62701}~
~MYCONTINUE~
~0~
~TRUE~
~FALSE~
~Set Variable~
~{A656420B-C11B-4BB4-A4A7-539EDAC9EC46}~
~MYCONTINUE$MYAH$MYAH$FALSE~
~TRUE~
Hope this helps you.

Regards

Re: Detect key press or key down event

Posted: Wed Jul 11, 2012 10:45 am
by khalprin
Ah...I see. Thanks.

Re: Detect key press or key down event

Posted: Wed Jul 11, 2012 11:21 am
by FrancescoT
:D