/ Forums / Advansys Formativ / Formativ Creator / NewControlBoxDialog bug & stds issue

  • Creator
    Topic
  • #3530
    rgesner
    Participant

      Stds: The button locations in the NewControlBoxDialog do not seem to be controllable (a pity), and the order of buttons 1 & 2 is contrary to Windows (and GroupWise) interface standards, with the cancel button (2) to the left of button 1. This makes virtually all dialogs error-prone. Since the [X] in the upper right corner of the dialog returns the same 2 code as button 2, I can’t adjust this by interpreting the buttons differently.

      Bug: I used NewControlBoxDialog to create a dialog with 5 buttons.
      Buttons 1-4 return integers 1, 2, 3, & 4, however button 5 returns a 6.

      Sample code follows:

      dim rButton
      dim SigDlg

      Sub Main(Client, GWEvent)

      set SigDlg = Utilities.NewControlBoxDialog
      with SigDlg
      .Caption = CAPTION
      .Title = “Select Signature”
      .Button1Caption = “&Save”
      .Button2Caption = “&None”
      .Button3Visible = TRUE
      .Button3Caption = “&Personal”
      .Button4Visible = TRUE
      .Button4Caption = “&Casual”
      .Button5Visible = TRUE
      .Button5Caption = “&Disclaimer”
      .Description = “description”
      end with

      ‘ SigDlg.AutoSize = TRUE
      SigDlg.Height = 120
      SigDlg.ShowWizardImage = FALSE

      rButton = SigDlg.Execute

      msgBox (rButton)

      Set SigDlg = nothing
      Set rButton = nothing

      End Su

    • Author
      Replies
    • #5356
      rgesner
      Participant

        Oh, duh, just set:

        Button1Visible = FALSE

        and button two becomes the rightmost button, putting Cancel where it ought to be.

        That helps, but greater control would still be nice, and button 5 still returns a 6…

        #5360
        Support 2
        Moderator

          Thanks for your feedback. The return values of the buttons are effectively arbitrary numbers. It is correct that Button 5 returns a value of 6 and you will find that Button 6 returns a value of 7. This design is based on the value of constants used within the ‘behind the scenes’ code in the Utility Object DLL.

          The best way to make your code appear more intuitive is to use the inbuilt Formativ constants for the button return values, i.e. Btn1 for Button 1, Btn5 for Button 5 and so on. For example,

          if rButton = Btn5 then
          ‘do something
          end if

          In regards to the OK and Cancel button positioning, you can simply change the captions of the first two buttons (buttons 1 & 2) to achieve your desired interface requirements and use the Btn1 and Btn2 constants when you check the dialog return value.

          I hope this helps clarify the operation of the dialog buttons. Please let me know if you have any other questions.

          Thanks,

          Advansys Support

          #5358
          rgesner
          Participant

            Using the constants and switching the button labels doesn’t really help because the upper-right [X] (close) returns 2, the same as button2 and the Btn2 constant, so using Button 2 as OK would mean that a close dialog action would be interpreted as OK instead as cancel, so I still have to suppress button 1.

            Although Button6 may internally be asigned to 7, that’s not what I’m seeing, because using the following code, button 6 doesn’t even appear, so I can’t tell what it would return and can’t use it.

            The combined effect of these problems effectively leaves me with only four usable buttons.

            Also, if enable SigDlg.AutoSize = TRUE in the following, it causes an out of range error in the last line. What’s going on there?

            set SigDlg = Utilities.NewControlBoxDialog
            with SigDlg
            .Caption = CAPTION
            .Title = “Select Signature”
            .Button1Visible = FALSE ‘returns 1 if used
            .Button2Caption = “&None” ‘2, same as Close [X]
            .Button3Visible = TRUE
            .Button3Caption = “&Personal” ‘3
            .Button4Visible = TRUE
            .Button4Caption = “&Casual” ‘4
            .Button5Visible = TRUE
            .Button5Caption = “&Disclaimer” ‘6 (not 5)
            .Button6Visible = TRUE
            .Button6Caption = “&View/Edit” ‘doesn’t work
            end with

            ‘ SigDlg.AutoSize = TRUE
            SigDlg.Height = 120
            SigDlg.ShowWizardImage = FALSE

            rButton = SigDlg.Execute
            msgBox (rButton & “sdffs” & Btn2)
            SigList = Array(“Unused”,”Cancel”,”Personal”,”Casual”,”Button5bug”,”Disclaimer”)
            SigFile = SIGNATURE_LOCATION & SigList(rButton – 1) & “.sig”

            quote:


            Originally posted by Support 2:
            Thanks for your feedback. The return values of the buttons are effectively arbitrary numbers. It is correct that Button 5 returns a value of 6 and you will find that Button 6 returns a value of 7. This design is based on the value of constants used within the ‘behind the scenes’ code in the Utility Object DLL.

            The best way to make your code appear more intuitive is to use the inbuilt Formativ constants for the button return values, i.e. Btn1 for Button 1, Btn5 for Button 5 and so on. For example,

            if rButton = Btn5 then
            ‘do something
            end if

            In regards to the OK and Cancel button positioning, you can simply change the captions of the first two buttons (buttons 1 & 2) to achieve your desired interface requirements and use the Btn1 and Btn2 constants when you check the dialog return value.

            I hope this helps clarify the operation of the dialog buttons. Please let me know if you have any other questions.

            Thanks,

            Advansys Support


            #5359
            Support 2
            Moderator

              Thanks for the additional code and background. The AutoSize problem appears to be a bug caused by no controls being added to the dialog, such as edit box, text box, check box etc..

              The second issue is that Button 6 does not appear. This is due to the WizardImage being hidden, in which case Button 6 is automatically made invisible.

              We will research the best way to resolve these issues and get back to you.

              Thanks,

              Advansys Support

              #5357
              Support 2
              Moderator

                The Formativ engineering team reviewed the issues and agreed with your observations. Today we updated the installation file to include the following fixes/enhancements:

                • Fixed a bug that caused an index out of bounds error if a dialog with no controls had its AutoSize property set to TRUE.
                • Button 6 on the standard dialog is no longer hidden if the Wizard Image is turned off.
                • Added a new property to the standard dialog – CancelButton. This property specifies which Formativ dialog button functions as the Cancel button. The default is Button 2 (Btn2).
                • Added a new property to the standard dialog – DefaultButton. This property specifies which Formativ dialog button functions as the Default button, which has the initial focus. The default is Button 1 (Btn1). If another button does not have the focus, then the default button value is returned when the Enter key is pressed.
                • StdDlgButtons constants have been updated to reflect the new internal values used to represent the six standard dialog buttons. The return values are now sequential from 1 to 6 and directly relate to the number in the button name. As long as you have not hard coded button values in your macros, this change will not affect you. If you have hard coded button values for Buttons 5 and 6, you should replace them with the appropriate StdDlgButtons constants (i.e. Btn5 and Btn6) to ensure correct behavior.
                • Updated some of the shipping macros to take advantage of the new CancelButton property.

                The modified macro example below illustrates a couple of the updates.

                code:


                Sub Main(Client, GWEvent)

                const SIGNATURE_LOCATION = "c:signatures"

                set SigDlg = Utilities.NewControlBoxDialog
                with SigDlg
                .Caption = CAPTION
                .Title = "Select Signature"
                .CancelButton = Btn1
                .Button1Caption = "&None"
                .Button2Caption = "&Personal"
                .Button3Visible = TRUE
                .Button3Caption = "&Casual"
                .Button4Visible = TRUE
                .Button4Caption = "&Disclaimer"
                .Button5Visible = TRUE
                .Button5Caption = "&View/Edit"
                end with

                SigDlg.Height = 120
                SigDlg.ShowWizardImage = FALSE

                rButton = SigDlg.Execute

                SigList = Array("Cancel","Personal","Casual","Disclaimer","ViewEdit")

                if rButton <> 1 then
                SigFile = SIGNATURE_LOCATION & SigList(rButton - 1) & ".sig"
                MsgBox(SigFile)
                else
                MsgBox("Canceled!")
                end if

                End Sub


                Thank you again for your feedback. We hope that this update will more effectively address your and other users dialog requirements. Please download the update from the Formativ download page and let us know if you have any further problems or suggestions.

                Thanks,

                Advansys Support

                #5355
                rgesner
                Participant

                  Your promptness in addressing these problems is a good omen for the future of what promises to be a very valuable product.

                  Thanks, and I’ll be sure to keep constructive suggestions coming to improve Formativ as I encounter problems or have good ideas.

                  – Rusty

                Viewing 6 replies - 1 through 6 (of 6 total)
                • You must be logged in to reply to this topic.