PDA

View Full Version : TaskDialog wrong return value.



Boris
12-Oct-2009, 01:02 PM
Why I'm always getting a value of 1 in eReply with this code?
Is it possible to add a "Cancel" button, instead of showing it as a radio option?


Get Initialise of (oSigCJTaskDialog(Self)) to hoDialog

Set pbShowWindowsExitButton of hoDialog to True
Set psTitle of hoDialog to "Sage Mobile"
Set piMainIcon of hoDialog to eTaskIconCustom
Set psMainIconImage of hoDialog to "sincronizar.ico"
Set psMainInstructionText of hoDialog to "Sincronización"
Set psContentText of hoDialog to ("Escoja el método de sincronización que desee utilizar.")

Set TaskDialogOptionRadio of hoDialog to "Red Privada Virtual" 100
Set TaskDialogOptionRadio of hoDialog to "eMail (sólo Envío de pedidos)" 101
Set TaskDialogOptionRadio of hoDialog to "Webservice" 103
Set TaskDialogOptionRadio of hoDialog to "Cancelar" 104
// Set piDefaultRadioOption of hoDialog to 102

Set psFooterText of hoDialog to ("Si el método de sincronización escogido falla, inténtelo nuevamente con otro!")
Set piFooterIcon of hoDialog to eTaskIconInfo

Get ShowDialog of (oSigCJTaskDialog(Self)) to eReply
Showln eReply

Ian Smith
12-Oct-2009, 02:37 PM
Hi Boris

Because that is the value for the OK button, which is the default if you do not define any others, the fact that we have not told you now to define the other buttons is totally irrelevant:D.

To add a standard button just set the required pbShowButton property to true

e.g.


Set pbShowButtonClose to true
Set pbShowButtonOk to true


Other buttons available are

pbShowButtonYes
pbShowButtonNo
pbShowButtonCancel
pbShowButtonRetry
When clicked the buttons return the following values.

ButtonOk 1
ButtonYes 2
ButtonNo 4
ButtonCancel 8
ButtonRetry 16
ButtonClose 32
The standard buttons are a property of the control. I have not checked to see if the order they are displayed can be set.

Boris
12-Oct-2009, 03:27 PM
Thanks, I'm almost there!
Now, how can I get the current radio button selected?

chuckatkinson
12-Oct-2009, 04:07 PM
Object oPoTaskDialog is a cSigCJTaskDialog
Set Size to 100 100
Set Location to 53 594

Property Integer piRadioOptionSelected -1

Procedure OnCreate
Handle hoWin
Forward Send OnCreate
Move Self to ghoPOTaskDialog
End_Procedure

Procedure OnRadioSelected Integer iRadio_ID
Set piRadioOptionSelected to iRadio_ID
End_Procedure

Function SendPODialog Returns Integer
Handle hoDialog
Integer iReply

Get Initialise to hoDialog

Set pbShowWindowsExitButton of hoDialog to True

Set psTitle of hoDialog to "Send Purchase Orders"
Set piMainIcon of hoDialog to eTaskIconCustom
Set psMainIconImage of hoDialog to "Question_32.ico"

Set psContentText of hoDialog to ("Select the Branch PO Back Order Status from " + CLF ;
+ "the following options...")

Set TaskDialogOptionRadio of hoDialog to "Create Branch PO as CANCEL Shorts" 100
Set TaskDialogOptionRadio of hoDialog to "Create Branch PO as BACKORDER Shorts" 101
Set TaskDialogOptionRadio of hoDialog to "Or ... Do Not Send Purchase Orders at this time" 102

Set piDefaultRadioOption of hoDialog to 100
Set piRadioOptionSelected of hoDialog to 100

Set psFooterText of hoDialog to ("You can manually change this at the branch later")
Set piFooterIcon of hoDialog to eTaskIconInfo

Get ShowDialog of hoDialog to iReply

If (iReply<>8) Begin
Get piRadioOptionSelected to iReply
End

Function_Return iReply
End_Function


Above is an example of getting the radio selected.