/ Forums / Advansys Formativ / Formativ Creator / NewControlBoxDialog bug & stds issue / Reply To: NewControlBoxDialog bug & stds issue

#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