次の方法で共有


Change Pages When a User Chooses a Button Sample

File: ...\Samples\Solution\Controls\PgFrame\Msgbox.scx

This sample makes it possible for you to interactively construct a message box.

There are six command button combinations possible in a message box. Each of these combinations is displayed on a separate page in a page frame on the Messagebox Builder form.

The option buttons, labeled 0 through 5, make it possible for you to specify which combination of command buttons you want to be displayed in your message box. The selected button in the page indicates the default Messagebox button selection. The ActivePage property of the page frame is set to the Value of the Option group.

Constructing the MESSAGEBOX Code

In the InteractiveChange event of the controls on the form, the WriteCode method of the form is called to dynamically construct the MESSAGEBOX code.

* WriteCode Method
#DEFINE QM '"'

cString = '=MESSAGEBOX('
cString = cString + QM + ALLTRIM(STRTRAN(THIS.edtMessage.Value, CHR(13)+CHR(10), QM + '+CHR(13)+' + QM)) + QM + ','
cString = cString + THIS.cboIcon.Value + '+' 
cString = cString + THIS.DefaultButton + '+' 
cString = cString + ALLTRIM(STR(THIS.opgButtons.Value - 1)) + ','
cString = cString + QM + ALLTRIM(THIS.txtCaption.Value) + QM + ')'

THIS.edtCode.Value = cString

See Also

Tasks

Present a User with Multiple Choices Sample

Display Different Pages without Tabs Sample

Reference

Messagebox Handler Foundation Class

Other Resources

Controls Solution Samples