Page 1 of 1

Custom dialog with button should disable some controls

Posted: Tue Jun 12, 2007 8:12 am
by jls
I have a custom dialog with some editboxes and a button.
Then the user click on the button the editboxes should be disabled.


I use this code:

Display Dialog: DLLVisual, wait for dialog to return (modal)
if Variable CHOICE Equals LOGIN
editbox1.enabled := false >> here I need some help
end


One more question:

The dialog is not complete then the user click on the button. It must wait for the user to click Next.

Is my code above correct?

Take a look at attachment.
Here is what I want:
1)User select ClientId,Access code
2)Click Login
3)disable ClientId,Access code enable Store
4)select Store
5)Click Next

Jørgen

File Attached:

wiz.jpg

I have updated my question (loop,text and DLL result)

Posted: Wed Jun 13, 2007 7:37 am
by jls
I have some questions.
Her is my code with comments:

Code: Select all

  Apply Install (get result into variable SUCCESS)
    if Variable SUCCESS not Equals ERROR
      if Variable SUCCESS not Equals CANCEL
        Set Variable ISLOGIN to False
        Set Variable ACCESSCODE to 
        Set Variable STORES to 
        Set Variable CLIENTID to aa
        Set Variable ARESULT to False
       
//Getting a text value from a DLL
//The dll creates a INI file with the test value
//Can this be done simpler?
       
        Call DLL Function $SUPPORTDIR$\\testdll.dll->GETCLIENTID (get result into variable ARESULT)
        Get INI $TARGETDIR$\\TMPFILE.ini, [SECTION] CLIENTID Value into Variable CLIENTID
       
//Showing my custom form       
        Display Dialog: DLLVisual, wait for dialog to return (modal)

//The user Click on LOGIN
        if Variable CHOICE Equals LOGIN
          Call DLL Function $SUPPORTDIR$\\testdll.dll->LOGIN (get result into variable ISLOGIN)
          if Variable ISLOGIN Equals TRUE
//Getting values for a dropdown list    
            Call DLL Function $SUPPORTDIR$\\testdll.dll->GETSTORES (get result into variable ARESULT)
            Get INI $TARGETDIR$\\TMPFILE.ini, [SECTION] STORES Value into Variable STORES
            Set Variable EDTSTATE to LOGIN
//Updating the dialog
            Display Dialog: DLLVisual, wait for dialog to return (modal)
            else
          end
        end

//If everything is OK do this
        Set Variable DLLRESULT to false
        Call DLL Function $SUPPORTDIR$\\testdll.dll->CreateINI (get result into variable DLLRESULT)
        if Variable DLLRESULT not Equals TRUE
          Set Variable REMOVE to TRUE
          Apply Uninstall (get result into variable SUCCESS)
          else
          if Variable SUCCESS not Equals CANCEL
            Run Program $SUPPORTDIR$\\TestAppMan.exe "$TARGETDIR$" (WAIT)
            Run Program $SUPPORTDIR$\\TestApp.exe "$TARGETDIR$" (WAIT)
          end
        end
      end
    end
Question 1
How can I make a loop.
I want to be able to click on the loginbutton check the result and if the result is not ok the user should be able to change values and try again


Question 2
How do I update the enabled state and text values on my form?

Question 3
Can I have text as resultvalues from Call DLL Function?

File Attached:

wiz.jpg

some changes

Posted: Thu Jun 14, 2007 3:34 am
by jls
I have tried to change my code to this:

Code: Select all

label: DOLOGIN
Set Variable DOUNINSTALL to False
Set Variable STORE to 
if Variable SUCCESS not Equals ERROR
  if Variable SUCCESS not Equals CANCEL
    Set Variable ISLOGIN to False
    Set Variable ACCESSCODE to 
    Set Variable STORES to 
    Set Variable CLIENTID to aa
    Set Variable ARESULT to False
    Call DLL Function $SUPPORTDIR$\\testdll.dll->GETCLIENTID (get result into variable ARESULT)
    Get INI $TARGETDIR$\\TMPFILE.ini, [SECTION] CLIENTID Value into Variable CLIENTID
    Display Dialog: DLLVisual, wait for dialog to return (modal)
    if Variable CHOICE Equals LOGIN
      Call DLL Function $SUPPORTDIR$\\testdll.dll->LOGIN (get result into variable ISLOGIN)
      if Variable ISLOGIN Equals TRUE
        Set Variable EDTSTATE to LOGIN
        Call DLL Function $SUPPORTDIR$\\testdll.dll->GETSTORES (get result into variable ARESULT)
        Get INI $TARGETDIR$\\TMPFILE.ini, [SECTION] STORES Value into Variable STORES
        Display Dialog: DLLVisual, wait for dialog to return (modal)
        if Variable CHOICE Equals CANCEL
          Set Variable DOUNINSTALL to True
        end
        else
        GoTo Label: DOLOGIN
      end
    end
  end
end
if Variable STORE not Equals 
  if Variable SUCCESS not Equals ERROR
    if Variable SUCCESS not Equals CANCEL
      Set Variable DLLRESULT to false
      Call DLL Function $SUPPORTDIR$\\testdll.dll->CreateINI (get result into variable DLLRESULT)
      if Variable DLLRESULT not Equals TRUE
        Set Variable DOUNINSTALL to True
        else
        if Variable SUCCESS not Equals CANCEL
          Run Program $SUPPORTDIR$\\TestAppMan.exe "$TARGETDIR$" (WAIT)
          Run Program $SUPPORTDIR$\\TestApp.exe "$TARGETDIR$" (WAIT)
        end
      end
    end
  end
end
if Variable DOUNINSTALL Equals True
  Set Variable REMOVE to TRUE
  Apply Uninstall (get result into variable SUCCESS)
end

Most of it works, but I don't know if everything is correct done.

This doesn't work:
I call Display Dialog twice
If I click Cancel the second time the setup stop working.

(I still want answers from my previous post)

Jørgen

Posted: Sat Jun 16, 2007 10:18 pm
by MichaelNesmith
You cannot directly set control properties from the script. However, you can set variables. So, a standard trick that is used in InstallAware themes, as well as other dialogs, is to:

1. Add a hidden label to a form
2. Set its caption to a $VARIABLE$
3. Author dialog rules based on the caption of the label
4. Set the values of the VARIABLE from script before showing the dialog

Update the form controls

Posted: Sun Jun 17, 2007 1:54 pm
by jls
I did as you have described in your post.

I question is:

If I have a button on the form that do something is this the correct implementation:



Display Dialog: DLLVisual, wait for dialog to return (modal)
if Variable CHOICE Equals LOGIN //the user press the LOGIN button
Set Variable ISLOGIN to True
Display Dialog: DLLVisual, wait for dialog to return (modal) //update visual appearance

Jørgen

Posted: Mon Jun 22, 2009 4:04 pm
by Tiago
MichaelNesmith wrote:3. Author dialog rules based on the caption of the label
Hi Michael,

What kind of "dialog rules" can I author, for instance?

Thanks in advance! :)

Posted: Mon Jun 22, 2009 7:04 pm
by MichaelNesmith
Take a look at the pre-built themes for ideas and samples!

Posted: Tue Jun 23, 2009 8:18 am
by Tiago
I finally noticed that in the window that appears when I double-click a dialog control there is a tab named "Object Rules" where I can set some very interesting stuff. Thanks for the great advice!