The user asks that a dialog box pops up before executing an action, asking him to select some suppliers and perform actions only for these suppliers. Then he will think of using the dialog class, and write the following:Code:
Code
Static Void Dialogdemo (ARGs _ ARGs)
{
Dialog = New Dialog ();
Dialogfield;
Vendaccount;
Boolean retvalue;
;
Dialogfield = Dialog. addfield (typeid (vendaccount ));
Retvalue = Dialog. Run ();
If (Retvalue)
{
Vendaccount = Dialogfield. Value ();
// Do something else
}
}
Everything seems perfect, but there is a problem. You can only select one vendor. You need to select multiple suppliers. The replaceonlookup attribute of the control is used to control this, But dialogfield does not have this method, what should I do? Add.
Add the replaceonlookup method to dialogfield as follows:
Code
Void Replaceonlookup (Boolean R)
{
STR name;
// If properties exists then we are on server
If (Properties)
{
Name = # Propertyreplaceonlookup;
If ( ! Properties. exists (name ))
Properties. Add (name, True );
Properties. Value (name, R );
}
Else
This . Fieldcontrol (). replaceonlookup (R );
}
Modify the Unpack method and add the new attributes.
Case # Propertyreplaceonlookup:
This . Replaceonlookup (unpackedproperties. valueindex (I ));
Break ;
In this way, you can call this method to change the properties of the control.
Code
Static Void Dialogdemo (ARGs _ ARGs)
{
Dialog = New Dialog ();
Dialogfield;
Vendaccount;
Boolean retvalue;
;
Dialogfield = Dialog. addfield (typeid (vendaccount ));
Dialogfield. replaceonlookup ( False );
Retvalue = Dialog. Run ();
If (Retvalue)
{
Vendaccount = Dialogfield. Value ();
// Do something else
}
}
Shows the effect: