[Project implementation Notes] modify the Dialog

Source: Internet
Author: User

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:

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.