SetCancelCaption
Описание и параметры
void SetCancelCaption( string caption );
Метод устанавливает текстовую надпись caption кнопке Отмена.
Параметры функции
| Параметр | Описание |
|---|---|
| caption | Надпись кнопки Отмена. |
Смотрите также
Примеры использования
<?
if(!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED!==true)die();
class Step1 extends CWizardStep
{
function InitStep()
{
$this->SetStepID("step1"); //ID шага
$this->SetTitle("Первый шаг"); //Заголовок шага
$this->SetSubTitle("Шаг приветствие"); //Подзаголовок шага
$this->SetNextStep("step2"); //Кнопка Далее, ведущая на второй шаг
$this->SetFinishStep("step4"); //Кнопка Готово, ведущая на 4ый шаг
$this->SetCancelStep("cancel"); //Кнопк Отмена, ведущая на шаг Отмены
}
function ShowStep()
{
//Содержимое шага
$this->content .= "Шаг 1";
}
}
class Step2 extends CWizardStep
{
function InitStep()
{
$this->SetTitle("Второй шаг");
$this->SetSubTitle("Свои надписи к кнопкам");
$this->SetStepID("step2");
$this->SetFinishStep("step4");
$this->SetNextStep("step3");
$this->SetPrevStep("step1"); //Кнопка Назад, ведущая на первый шаг
$this->SetCancelStep("cancel");
//Изменим надписи к кнопкам
$this->SetPrevCaption("Назад к шагу 1");
$this->SetNextCaption("Вперед");
$this->SetFinishCaption("Финиш");
}
function ShowStep()
{
$this->content .= "Шаг 2";
}
}
class Step3 extends CWizardStep
{
function InitStep()
{
$this->SetTitle("Третий шаг");
$this->SetSubTitle("Автосабмит");
//В системных шаблонах кнопка Далее нажмется автоматически
$this->SetAutoSubmit();
$this->SetStepID("step3");
$this->SetPrevStep("step2");
$this->SetFinishStep("step4");
$this->SetNextStep("step4");
$this->SetCancelStep("cancel");
}
function ShowStep()
{
$this->content .= "Шаг 3";
}
}
class Step4 extends CWizardStep
{
function InitStep()
{
$this->SetTitle("Четвертый шаг");
$this->SetSubTitle("Финиш");
$this->SetStepID("step4");
$this->SetPrevStep("step3");
$this->SetCancelStep("cancel");
}
function ShowStep()
{
$this->content .= "Шаг 4";
}
}
class CancelStep extends CWizardStep
{
function InitStep()
{
$this->SetStepID("cancel");
//В системном шаблоне по уомлчанию
//JS-обработчик закроет окно мастера,
//т.к. кнопка отмена одна на странице шага
$this->SetCancelStep("cancel");
//Изменим надпись кнопке Отмена
$this->SetCancelCaption("Закрыть");
}
function ShowStep()
{
$this->content .= "Отмена";
}
}
?>
Статическое определение шагов в файле .description.php
<?
if(!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED!==true)die();
$arWizardDescription = Array(
"NAME" => "Мой мастер",
"STEPS" => Array("Step1", "Step2", "Step3", "Step4", "CancelStep"),
);
?>
Или динамическое определение шагов в файле wizard.php
<?
//Создаем мастер
$wizard = new CWizardBase("Мой мастер", $package);
//Добавляем шаги
$wizard->AddSteps(Array("Step1", "Step2", "Step3", "Step4", "CancelStep"));
//Выводим на экран
$wizard->Display();
?>
© «Битрикс», 2001-2025, «1С-Битрикс», 2025